Skip to content

Commit e2e488d

Browse files
authored
Revert "iOS packaging pipeline stability" (#19135)
Reverts #19097 because it broken Android CI pipeline.
1 parent c92f72e commit e2e488d

File tree

3 files changed

+42
-41
lines changed

3 files changed

+42
-41
lines changed

cmake/external/onnxruntime_external_deps.cmake

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -108,53 +108,48 @@ FetchContent_Declare(
108108
)
109109

110110
# Download a protoc binary from Internet if needed
111-
if(NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
111+
if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
112112
# This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
113113
# download protoc from Protobuf's Github release page and pass the local path to the ONNX_CUSTOM_PROTOC_EXECUTABLE
114114
# variable.
115-
if (APPLE)
116-
# Using CMAKE_CROSSCOMPILING is not recommended for Apple target devices.
117-
# https://cmake.org/cmake/help/v3.26/variable/CMAKE_CROSSCOMPILING.html
118-
# To keep it simple, just download and use the universal protoc binary for Apple builds.
115+
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
116+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
117+
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
118+
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win64} URL_HASH SHA1=${DEP_SHA1_protoc_win64})
119+
FetchContent_Populate(protoc_binary)
120+
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86")
121+
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win32} URL_HASH SHA1=${DEP_SHA1_protoc_win32})
122+
FetchContent_Populate(protoc_binary)
123+
endif()
124+
if(protoc_binary_SOURCE_DIR)
125+
message("Use prebuilt protoc")
126+
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc.exe)
127+
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
128+
endif()
129+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
130+
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
131+
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x64})
132+
FetchContent_Populate(protoc_binary)
133+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86?)$")
134+
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x86} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x86})
135+
FetchContent_Populate(protoc_binary)
136+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64.*")
137+
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_aarch64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_aarch64})
138+
FetchContent_Populate(protoc_binary)
139+
endif()
140+
if(protoc_binary_SOURCE_DIR)
141+
message("Use prebuilt protoc")
142+
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
143+
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
144+
endif()
145+
elseif ((CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
119146
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_mac_universal} URL_HASH SHA1=${DEP_SHA1_protoc_mac_universal})
120147
FetchContent_Populate(protoc_binary)
121148
if(protoc_binary_SOURCE_DIR)
122149
message("Use prebuilt protoc")
123150
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
124151
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
125152
endif()
126-
elseif(CMAKE_CROSSCOMPILING)
127-
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
128-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
129-
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
130-
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win64} URL_HASH SHA1=${DEP_SHA1_protoc_win64})
131-
FetchContent_Populate(protoc_binary)
132-
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86")
133-
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win32} URL_HASH SHA1=${DEP_SHA1_protoc_win32})
134-
FetchContent_Populate(protoc_binary)
135-
endif()
136-
if(protoc_binary_SOURCE_DIR)
137-
message("Use prebuilt protoc")
138-
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc.exe)
139-
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
140-
endif()
141-
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
142-
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
143-
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x64})
144-
FetchContent_Populate(protoc_binary)
145-
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86?)$")
146-
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x86} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x86})
147-
FetchContent_Populate(protoc_binary)
148-
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64.*")
149-
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_aarch64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_aarch64})
150-
FetchContent_Populate(protoc_binary)
151-
endif()
152-
if(protoc_binary_SOURCE_DIR)
153-
message("Use prebuilt protoc")
154-
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
155-
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
156-
endif()
157-
endif()
158153
endif()
159154
endif()
160155

@@ -189,9 +184,9 @@ FetchContent_Declare(
189184
)
190185

191186
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
192-
#TODO: we'd better to turn the following option off. However, it will cause
187+
#TODO: we'd better to turn the following option off. However, it will cause
193188
# ".\build.bat --config Debug --parallel --skip_submodule_sync --update" fail with an error message:
194-
# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
189+
# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
195190
# not in any export set.
196191
#set(protobuf_INSTALL OFF CACHE BOOL "Install protobuf binaries and files" FORCE)
197192
set(protobuf_USE_EXTERNAL_GTEST ON CACHE BOOL "" FORCE)
@@ -567,3 +562,4 @@ endif()
567562

568563
FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR)
569564
FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR)
565+

tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ stages:
5353
displayName: "Set common variables"
5454

5555
pool:
56-
vmImage: "macOS-12" # macOS-13 seems less stable. macOS-12 will work for this job.
56+
vmImage: "macOS-13"
5757

5858
timeoutInMinutes: 5
5959

tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ stages:
7878
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
7979
displayName: "Install Python requirements"
8080
81+
- script: |
82+
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
83+
displayName: "Build Host Protoc"
84+
8185
# create and test mobile pods
8286
- script: |
8387
python tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
@@ -87,7 +91,8 @@ stages:
8791
--test \
8892
--variant ${{ parameters.packageVariant }} \
8993
--build-settings-file "${{ variables.buildSettingsFile }}" \
90-
${{ variables.optionalIncludeOpsByConfigOption }}
94+
${{ variables.optionalIncludeOpsByConfigOption }} \
95+
-b="--path_to_protoc_exe=$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
9196
displayName: "Build macOS/iOS framework and assemble pod package files"
9297
9398
- script: |

0 commit comments

Comments
 (0)