Skip to content

Commit 383aa7f

Browse files
authored
Enable guidance by default on macos (microsoft#1514)
Enable guidance by default on macos
1 parent 788513a commit 383aa7f

File tree

9 files changed

+54
-16
lines changed

9 files changed

+54
-16
lines changed

.github/workflows/linux-cpu-x64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ jobs:
9393
run: |
9494
set -e -x
9595
rm -rf build
96-
cmake --preset linux_gcc_cpu_release -DUSE_GUIDANCE=ON
97-
cmake --build --preset linux_gcc_cpu_release -DUSE_GUIDANCE=ON
96+
cmake --preset linux_gcc_cpu_release
97+
cmake --build --preset linux_gcc_cpu_release
9898
9999
- name: Install the python wheel and test dependencies
100100
run: |

.github/workflows/linux-cpu-x64-nightly-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
run: |
5050
set -e -x
5151
rm -rf build
52-
cmake --preset linux_gcc_cpu_release -DUSE_GUIDANCE=ON
53-
cmake --build --preset linux_gcc_cpu_release -DUSE_GUIDANCE=ON
52+
cmake --preset linux_gcc_cpu_release
53+
cmake --build --preset linux_gcc_cpu_release
5454
5555
- name: Install the python wheel and test dependencies
5656
run: |

.github/workflows/mac-cpu-arm64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ jobs:
6666
run: |
6767
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d. -f1,2)
6868
export RUSTFLAGS='-C link-arg=-Wl,-undefined,dynamic_lookup -C link-arg=-Wl,-no_dead_strip_inits_and_terms'
69-
cmake --preset macos_arm64_cpu_release -DUSE_GUIDANCE=ON
69+
cmake --preset macos_arm64_cpu_release
7070
7171
- name: Build with CMake
7272
run: |
7373
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d. -f1,2)
7474
export RUSTFLAGS='-C link-arg=-Wl,-undefined,dynamic_lookup -C link-arg=-Wl,-no_dead_strip_inits_and_terms'
75-
cmake --build --preset macos_arm64_cpu_release --parallel -DUSE_GUIDANCE=ON
75+
cmake --build --preset macos_arm64_cpu_release --parallel
7676
continue-on-error: false
7777

7878
- name: Install the python wheel and test dependencies

.github/workflows/win-cpu-arm64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ jobs:
8080
run: |
8181
python -m pip install wheel requests
8282
83-
cmake --preset windows_arm64_cpu_release -DUSE_GUIDANCE=ON
83+
cmake --preset windows_arm64_cpu_release
8484
8585
- name: Build with CMake
8686
run: |
87-
cmake --build --preset windows_arm64_cpu_release --parallel -DUSE_GUIDANCE=ON
87+
cmake --build --preset windows_arm64_cpu_release --parallel
8888
8989
- name: Install the Python Wheel and Test Dependencies
9090
run: |

.github/workflows/win-cpu-x64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ jobs:
9595

9696
- name: Configure CMake
9797
run: |
98-
cmake --preset windows_x64_cpu_release -DUSE_GUIDANCE=ON
98+
cmake --preset windows_x64_cpu_release
9999
100100
- name: Build with CMake
101101
run: |
102-
cmake --build --preset windows_x64_cpu_release --parallel -DUSE_GUIDANCE=ON
102+
cmake --build --preset windows_x64_cpu_release --parallel
103103
104104
- name: Install the python wheel and test dependencies
105105
run: |

.github/workflows/win-cuda-x64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ jobs:
8080
8181
- name: Configure CMake
8282
run: |
83-
cmake --preset windows_x64_cuda_release -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }} -DUSE_GUIDANCE=ON
83+
cmake --preset windows_x64_cuda_release -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }}
8484
8585
- name: Build with CMake
8686
run: |
87-
cmake --build --preset windows_x64_cuda_release --parallel -DUSE_GUIDANCE=ON
87+
cmake --build --preset windows_x64_cuda_release --parallel
8888
8989
- name: Add CUDA to PATH
9090
run: |

.github/workflows/win-directml-x64-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ jobs:
9898
9999
- name: Configure CMake
100100
run: |
101-
cmake --preset windows_x64_directml_release -DTEST_PHI2=True -DUSE_GUIDANCE=ON
101+
cmake --preset windows_x64_directml_release -DTEST_PHI2=True
102102
103103
- name: Build with CMake
104104
run: |
105-
cmake --build --preset windows_x64_directml_release --parallel -DUSE_GUIDANCE=ON
105+
cmake --build --preset windows_x64_directml_release --parallel
106106
107107
- name: Install the Python Wheel and Test Dependencies
108108
run: |

.pipelines/stages/jobs/steps/capi-macos-step.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,44 @@ steps:
2929
echo "build_config=${{ parameters.build_config }}"
3030
displayName: 'Print Parameters'
3131

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+
3255
- powershell: |
3356
$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+
}
3570
displayName: 'Configure CMake C API'
3671
workingDirectory: '$(Build.Repository.LocalPath)'
3772

@@ -46,6 +81,7 @@ steps:
4681
displayName: 'Install wheel'
4782
4883
- powershell: |
84+
$env:RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup"
4985
cmake --build --preset macos_$(arch)_$(ep)_$(build_config) --target package
5086
displayName: 'Package C/C++ API'
5187
workingDirectory: '$(Build.Repository.LocalPath)'
@@ -95,6 +131,7 @@ steps:
95131
displayName: 'Install wheel'
96132
97133
- powershell: |
134+
$env:RUSTFLAGS="-C link-arg=-undefined -C link-arg=dynamic_lookup"
98135
# From: https://github.com/pypa/cibuildwheel/blob/93542c397cfe940bcbb8f1eff5c37d345ea16653/cibuildwheel/macos.py#L247-L260
99136
if ("$(arch)" -eq "arm64") {
100137
$env:_PYTHON_HOST_PLATFORM = "macosx-12.0-arm64"

cmake/presets/CMakeMacOSConfigPresets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"cacheVariables": {
1212
"CMAKE_POSITION_INDEPENDENT_CODE": "ON",
1313
"USE_CUDA": "OFF",
14-
"USE_ROCM": "OFF"
14+
"USE_ROCM": "OFF",
15+
"USE_GUIDANCE": "ON"
1516
},
1617
"environment": {
1718
"CC": "clang",

0 commit comments

Comments
 (0)