From 42fe2d7f7330839e6f39df1ec7213cee053a66b3 Mon Sep 17 00:00:00 2001 From: Bruno Alexandre Rosa <1791393+brunoalr@users.noreply.github.com> Date: Fri, 10 Oct 2025 15:11:42 -0300 Subject: [PATCH] move logic inside runner == macos if --- .ci/compile.sh | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index e9d5ddc4a..627e1f885 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -11,7 +11,7 @@ # --debug or --release sets the build type ie CMAKE_BUILD_TYPE # --ccache [] uses ccache and shows stats, optionally provide size # --dir sets the name of the build dir, default is "build" -# --target-macos-version sets the min os version - only used for x86 (Intel) macOS builds +# --target-macos-version sets the min os version - only used for macOS builds # uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR # (correspond to args: --debug/--release --install --package --suffix --server --test --ccache --dir ) # exitcode: 1 for failure, 3 for invalid arguments @@ -133,26 +133,6 @@ fi if [[ $USE_VCPKG ]]; then flags+=("-DUSE_VCPKG=1") fi -if [[ $TARGET_MACOS_VERSION ]]; then - # CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version - flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=${TARGET_MACOS_VERSION}") - - # vcpkg dependencies need a vcpkg triplet file to compile to the target macOS version - # an easy way is to copy the x64-osx.cmake file and modify it - TRIPLETS_DIR="../cmake/triplets" - mkdir -p "$TRIPLETS_DIR" - # Replace dots with hyphens in triplet name for vcpkg compatibility - TRIPLET_VERSION=$(echo "${TARGET_MACOS_VERSION}" | sed 's/\./-/g') - TRIPLET_FILE="$TRIPLETS_DIR/x64-osx-${TRIPLET_VERSION}.cmake" - cp ../vcpkg/triplets/x64-osx.cmake "$TRIPLET_FILE" - echo "set(VCPKG_CMAKE_SYSTEM_VERSION ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" - echo "set(VCPKG_OSX_DEPLOYMENT_TARGET ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" - flags+=("-DVCPKG_OVERLAY_TRIPLETS=$TRIPLETS_DIR") - flags+=("-DVCPKG_TARGET_TRIPLET=x64-osx-${TRIPLET_VERSION}") - echo "::group::Generated triplet $TRIPLET_FILE" - cat "$TRIPLET_FILE" - echo "::endgroup::" -fi # Add cmake --build flags buildflags=(--config "$BUILDTYPE") @@ -169,6 +149,27 @@ function ccachestatsverbose() { # Compile if [[ $RUNNER_OS == macOS ]]; then + if [[ $TARGET_MACOS_VERSION ]]; then + # CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version + flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=${TARGET_MACOS_VERSION}") + + # vcpkg dependencies need a vcpkg triplet file to compile to the target macOS version + # an easy way is to copy the x64-osx.cmake file and modify it + TRIPLETS_DIR="../cmake/triplets" + mkdir -p "$TRIPLETS_DIR" + # Replace dots with hyphens in triplet name for vcpkg compatibility + TRIPLET_VERSION=$(echo "${TARGET_MACOS_VERSION}" | sed 's/\./-/g') + TRIPLET_FILE="$TRIPLETS_DIR/x64-osx-${TRIPLET_VERSION}.cmake" + cp ../vcpkg/triplets/x64-osx.cmake "$TRIPLET_FILE" + echo "set(VCPKG_CMAKE_SYSTEM_VERSION ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" + echo "set(VCPKG_OSX_DEPLOYMENT_TARGET ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" + flags+=("-DVCPKG_OVERLAY_TRIPLETS=$TRIPLETS_DIR") + flags+=("-DVCPKG_TARGET_TRIPLET=x64-osx-${TRIPLET_VERSION}") + echo "::group::Generated triplet $TRIPLET_FILE" + cat "$TRIPLET_FILE" + echo "::endgroup::" + fi + echo "::group::Signing Certificate" if [[ -n "$MACOS_CERTIFICATE_NAME" ]]; then echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12