Skip to content

Commit

Permalink
apple framework packaging yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 committed Sep 14, 2024
1 parent 84a0541 commit 9fe196e
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .pipelines/nuget-publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ parameters:
type: boolean
default: true

- name: enable_apple_framework
displayName: 'Whether Apple framework for iOS & macOS is built.'
type: boolean
default: false

- name: ort_version
displayName: 'OnnxRuntime version'
type: string
Expand Down Expand Up @@ -89,6 +94,7 @@ stages:
enable_win_dml: ${{ parameters.enable_win_dml }}
enable_win_arm64: ${{ parameters.enable_win_arm64 }}
enable_macos_cpu: ${{ parameters.enable_macos_cpu }}
enable_apple_framework: ${{ parameters.enable_apple_framework }}
ort_version: ${{ parameters.ort_version }}
ort_cuda_version: ${{ parameters.ort_cuda_version }}
ort_dml_version: ${{ parameters.ort_dml_version }}
Expand All @@ -104,6 +110,7 @@ stages:
enable_win_dml: ${{ parameters.enable_win_dml }}
enable_win_arm64: ${{ parameters.enable_win_arm64 }}
enable_macos_cpu: ${{ parameters.enable_macos_cpu }}
enable_apple_framework: ${{ parameters.enable_apple_framework }}
ort_version: ${{ parameters.ort_version }}
ort_cuda_version: ${{ parameters.ort_cuda_version }}
ort_dml_version: ${{ parameters.ort_dml_version }}
Expand Down
7 changes: 7 additions & 0 deletions .pipelines/stages/capi-packaging-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,10 @@ stages:
ort_version: ${{ parameters.ort_version }}
os: 'osx'
build_config: ${{ parameters.build_config }}

- ${{ if eq(parameters.enable_macos_cpu, true) }}:
- template: jobs/capi-packaging-job.yml
parameters:
os: 'ios'
ort_version: ${{ parameters.ort_version }}
build_config: ${{ parameters.build_config }}
6 changes: 6 additions & 0 deletions .pipelines/stages/jobs/capi-packaging-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ parameters:
- 'linux'
- 'win'
- 'osx'
- 'ios'
- name: build_config
type: string
default: 'release'
Expand Down Expand Up @@ -143,4 +144,9 @@ jobs:
ep: ${{ parameters.ep }}
build_config: ${{ parameters.build_config }}

- ${{ if eq(parameters.os, 'ios') }}:
- template: steps/capi-appleframework-step.yml
parameters:
build_config: ${{ parameters.build_config }}

- template: steps/compliant-and-cleanup-step.yml
5 changes: 5 additions & 0 deletions .pipelines/stages/jobs/nuget-packaging-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ parameters:
type: boolean
default: false

- name: enable_apple_framework
displayName: 'Whether Apple framework for iOS & macOS is built.'
type: boolean
default: false

- name: ort_version
type: string

Expand Down
10 changes: 3 additions & 7 deletions .pipelines/stages/jobs/steps/capi-appleframework-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ steps:

- template: utils/set-nightly-build-option-variable.yml

- powershell: |
New-Item -ItemType Directory -Path $(Build.Repository.LocalPath)\ort\lib -Force
$tmp = New-TemporaryFile
Invoke-WebRequest -Uri 'https://download.onnxruntime.ai/pod-archive-onnxruntime-c-1.19.2.zip'
$tmp | Expand-Archive -DestinationPath $(Build.Repository.LocalPath)\ort\lib
displayName: 'Download ORT xcframework'
workingDirectory: '$(Build.Repository.LocalPath)'
- template: utils/download-ort.yml
parameters:
archiveType: 'zip'

- script: |
python3 tools/ci_build/github/apple/build_apple_framework.py \
Expand Down
12 changes: 11 additions & 1 deletion .pipelines/stages/jobs/steps/utils/download-ort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ parameters:
- name: ep
type: string
default: cpu

variables:
- name: ort_native_package_name
${{ if eq(parameters.os, 'ios') }}:
value: 'ios'
${{ if eq(parameters.os, 'android') }}:
value: 'android'
${{ else }}:
value: $(os)-$(arch)

steps:

- task: DownloadPackage@1
Expand All @@ -25,7 +35,7 @@ steps:
displayName: Unzip OnnxRuntime
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.Repository.LocalPath)/ort/runtimes/$(os)-$(arch)/native'
SourceFolder: '$(Build.Repository.LocalPath)/ort/runtimes/$(ort_native_package_name)/native'
TargetFolder: '$(Build.Repository.LocalPath)/ort/lib'
- ${{ else }}:
- script: |
Expand Down
6 changes: 6 additions & 0 deletions .pipelines/stages/nuget-packaging-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ parameters:
type: boolean
default: true

- name: enable_apple_framework
displayName: 'Whether Apple framework for iOS & macOS is built.'
type: boolean
default: false

- name: ort_version
type: string
- name: ort_cuda_version
Expand All @@ -57,6 +62,7 @@ stages:
enable_win_cpu: ${{ parameters.enable_win_cpu }}
enable_win_arm64: ${{ parameters.enable_win_arm64 }}
enable_macos_cpu: ${{ parameters.enable_macos_cpu }}
enable_apple_framework: ${{ parameters.enable_apple_framework }}
- ${{ if or(eq(parameters.enable_linux_cuda, true), eq(parameters.enable_win_cuda, true)) }}:
- template: jobs/nuget-packaging-job.yml
parameters:
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _get_opencv_toolchain_file():

if args.macos == "Catalyst":
macabi_target = f"{args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi"
cmake_args += [
command += [
"-DCMAKE_CXX_COMPILER_TARGET=" + macabi_target,
"-DCMAKE_C_COMPILER_TARGET=" + macabi_target,
"-DCMAKE_CC_COMPILER_TARGET=" + macabi_target,
Expand Down

0 comments on commit 9fe196e

Please sign in to comment.