@@ -29,9 +29,44 @@ steps:
29
29
echo "build_config=${{ parameters.build_config }}"
30
30
displayName : ' Print Parameters'
31
31
32
+ - bash : |
33
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
34
+ echo '##vso[task.prependpath]$HOME/.cargo/bin'
35
+ source "$HOME/.cargo/env"
36
+ rustup toolchain install 1.86.0
37
+ rustup override set 1.86.0
38
+ if [ "$(arch)" = "arm64" ]; then
39
+ rustup target add aarch64-apple-darwin --toolchain 1.86.0
40
+ fi
41
+ rustc --version
42
+ rustup show active-toolchain
43
+ displayName : ' Install Rust Toolchain'
44
+ workingDirectory : ' $(Build.Repository.LocalPath)'
45
+
46
+ - bash : |
47
+ brew update --quiet
48
+ brew install --quiet llvm@18
49
+ LLVM_PREFIX="$(brew --prefix llvm@18)"
50
+ echo "##vso[task.setvariable variable=LLVM_PREFIX]$LLVM_PREFIX"
51
+ echo "##vso[task.prependpath]$LLVM_PREFIX/bin"
52
+ displayName : ' Install LLVM'
53
+ workingDirectory : ' $(Build.Repository.LocalPath)'
54
+
32
55
- powershell : |
33
56
$env:MACOSX_DEPLOYMENT_TARGET = "12.0" # Monterey
34
- cmake --preset macos_$(arch)_$(ep)_$(build_config)
57
+ $env:CC="$env:LLVM_PREFIX\bin\clang"
58
+ $env:CXX="$env:LLVM_PREFIX\bin\clang++"
59
+ if ("$(arch)" -eq "arm64") {
60
+ $env:CARGO_BUILD_TARGET = "aarch64-apple-darwin"
61
+ $env:CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER = $env:CC
62
+ $env:CC_aarch64_apple_darwin = $env:CC
63
+ $env:CXX_aarch64_apple_darwin = $env:CXX
64
+ Remove-Item Env:CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER -ErrorAction SilentlyContinue
65
+ Remove-Item Env:CC_x86_64_apple_darwin -ErrorAction SilentlyContinue
66
+ cmake --preset macos_$(arch)_$(ep)_$(build_config) -DCMAKE_OSX_ARCHITECTURES=arm64 -DRust_CARGO_TARGET=aarch64-apple-darwin
67
+ } else {
68
+ cmake --preset macos_$(arch)_$(ep)_$(build_config)
69
+ }
35
70
displayName : ' Configure CMake C API'
36
71
workingDirectory : ' $(Build.Repository.LocalPath)'
37
72
46
81
displayName: 'Install wheel'
47
82
48
83
- powershell : |
84
+ $env:RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup"
49
85
cmake --build --preset macos_$(arch)_$(ep)_$(build_config) --target package
50
86
displayName: 'Package C/C++ API'
51
87
workingDirectory: '$(Build.Repository.LocalPath)'
@@ -95,6 +131,7 @@ steps:
95
131
displayName: 'Install wheel'
96
132
97
133
- powershell : |
134
+ $env:RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup"
98
135
# From: https://github.com/pypa/cibuildwheel/blob/93542c397cfe940bcbb8f1eff5c37d345ea16653/cibuildwheel/macos.py#L247-L260
99
136
if ("$(arch)" -eq "arm64") {
100
137
$env:_PYTHON_HOST_PLATFORM = "macosx-12.0-arm64"
0 commit comments