-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add CMake tryrun cache for macOS ARM64 to speed up configure #124046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
87c665f
2bdb866
0813387
1f7e23b
9f87830
b5e5129
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,22 @@ if [[ "$host_arch" == "armel" ]]; then | |
| cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1" | ||
| fi | ||
|
|
||
| # Use platform-specific tryrun cache to speed up CMake configure (opt-out via CLR_CMAKE_SKIP_PLATFORM_CACHE=1) | ||
| if [[ "$CLR_CMAKE_SKIP_PLATFORM_CACHE" != "1" ]]; then | ||
| if [[ "$target_os" == "osx" && "$host_arch" == "arm64" && -f "$scriptroot/tryrun.osx-arm64.cmake" ]]; then | ||
| # Extract current AppleClang major version | ||
| current_clang_version=$(clang --version 2>/dev/null | head -1 | sed -n 's/.*clang version \([0-9]*\)\..*/\1/p') | ||
| # Extract expected version from cache file | ||
| cache_clang_version=$(grep -o 'CLR_CMAKE_PLATFORM_CACHE_COMPILER_VERSION "[0-9]*"' "$scriptroot/tryrun.osx-arm64.cmake" 2>/dev/null | sed 's/.*"\([0-9]*\)".*/\1/') | ||
|
|
||
| if [[ -n "$current_clang_version" && -n "$cache_clang_version" && "$current_clang_version" == "$cache_clang_version" ]]; then | ||
| cmake_extra_defines="-C $scriptroot/tryrun.osx-arm64.cmake $cmake_extra_defines" | ||
| elif [[ -n "$current_clang_version" && -n "$cache_clang_version" ]]; then | ||
| echo "Skipping platform cache: AppleClang version mismatch (current: $current_clang_version, cache: $cache_clang_version)" | ||
| fi | ||
| fi | ||
| fi | ||
|
Comment on lines
88
to
102
|
||
|
|
||
| if ! cmake_command=$(command -v cmake); then | ||
| echo "CMake was not found in PATH." | ||
| exit 1 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block can run during cross-compiles to macOS arm64 as well (when
CROSSCOMPILE=1,target_os=osx,host_arch=arm64). In that casetryrun.cmakeis already loaded earlier, and addingtryrun.osx-arm64.cmakecan override TRY_RUN results (e.g., Darwin values ineng/native/tryrun.cmake), leading to inconsistent configuration between cross and native paths. Consider skipping the platform cache whenCROSSCOMPILE=1(or otherwise ensuring the two caches cannot conflict).