mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-27 22:45:57 +00:00
iOS packaging pipeline stability (#19097)
- Remove protoc build step which sometimes times out. Download protoc instead. - Use macOS-12 image in the set variables stage. It seems more stable.
This commit is contained in:
parent
5558912d7b
commit
e1e45901e2
3 changed files with 41 additions and 42 deletions
74
cmake/external/onnxruntime_external_deps.cmake
vendored
74
cmake/external/onnxruntime_external_deps.cmake
vendored
|
|
@ -108,41 +108,14 @@ FetchContent_Declare(
|
|||
)
|
||||
|
||||
# Download a protoc binary from Internet if needed
|
||||
if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
|
||||
if(NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
|
||||
# This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
|
||||
# download protoc from Protobuf's Github release page and pass the local path to the ONNX_CUSTOM_PROTOC_EXECUTABLE
|
||||
# variable.
|
||||
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win64} URL_HASH SHA1=${DEP_SHA1_protoc_win64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win32} URL_HASH SHA1=${DEP_SHA1_protoc_win32})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
endif()
|
||||
if(protoc_binary_SOURCE_DIR)
|
||||
message("Use prebuilt protoc")
|
||||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc.exe)
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
endif()
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86?)$")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x86} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x86})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64.*")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_aarch64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_aarch64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
endif()
|
||||
if(protoc_binary_SOURCE_DIR)
|
||||
message("Use prebuilt protoc")
|
||||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
endif()
|
||||
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")
|
||||
if (APPLE)
|
||||
# Using CMAKE_CROSSCOMPILING is not recommended for Apple target devices.
|
||||
# https://cmake.org/cmake/help/v3.26/variable/CMAKE_CROSSCOMPILING.html
|
||||
# To keep it simple, just download and use the universal protoc binary for Apple builds.
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_mac_universal} URL_HASH SHA1=${DEP_SHA1_protoc_mac_universal})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
if(protoc_binary_SOURCE_DIR)
|
||||
|
|
@ -150,6 +123,38 @@ if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
|
|||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
endif()
|
||||
elseif(CMAKE_CROSSCOMPILING)
|
||||
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win64} URL_HASH SHA1=${DEP_SHA1_protoc_win64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_win32} URL_HASH SHA1=${DEP_SHA1_protoc_win32})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
endif()
|
||||
if(protoc_binary_SOURCE_DIR)
|
||||
message("Use prebuilt protoc")
|
||||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc.exe)
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
endif()
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86?)$")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_x86} URL_HASH SHA1=${DEP_SHA1_protoc_linux_x86})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64.*")
|
||||
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_linux_aarch64} URL_HASH SHA1=${DEP_SHA1_protoc_linux_aarch64})
|
||||
FetchContent_Populate(protoc_binary)
|
||||
endif()
|
||||
if(protoc_binary_SOURCE_DIR)
|
||||
message("Use prebuilt protoc")
|
||||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -184,9 +189,9 @@ FetchContent_Declare(
|
|||
)
|
||||
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
|
||||
#TODO: we'd better to turn the following option off. However, it will cause
|
||||
#TODO: we'd better to turn the following option off. However, it will cause
|
||||
# ".\build.bat --config Debug --parallel --skip_submodule_sync --update" fail with an error message:
|
||||
# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
|
||||
# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
|
||||
# not in any export set.
|
||||
#set(protobuf_INSTALL OFF CACHE BOOL "Install protobuf binaries and files" FORCE)
|
||||
set(protobuf_USE_EXTERNAL_GTEST ON CACHE BOOL "" FORCE)
|
||||
|
|
@ -562,4 +567,3 @@ endif()
|
|||
|
||||
FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR)
|
||||
FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR)
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ stages:
|
|||
displayName: "Set common variables"
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
vmImage: "macOS-12" # macOS-13 seems less stable. macOS-12 will work for this job.
|
||||
|
||||
timeoutInMinutes: 5
|
||||
|
||||
|
|
|
|||
|
|
@ -78,10 +78,6 @@ stages:
|
|||
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
|
||||
displayName: "Install Python requirements"
|
||||
|
||||
- script: |
|
||||
$(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
|
||||
displayName: "Build Host Protoc"
|
||||
|
||||
# create and test mobile pods
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
|
||||
|
|
@ -91,8 +87,7 @@ stages:
|
|||
--test \
|
||||
--variant ${{ parameters.packageVariant }} \
|
||||
--build-settings-file "${{ variables.buildSettingsFile }}" \
|
||||
${{ variables.optionalIncludeOpsByConfigOption }} \
|
||||
-b="--path_to_protoc_exe=$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
|
||||
${{ variables.optionalIncludeOpsByConfigOption }}
|
||||
displayName: "Build macOS/iOS framework and assemble pod package files"
|
||||
|
||||
- script: |
|
||||
|
|
|
|||
Loading…
Reference in a new issue