try passing triplets config as cmake variables

This commit is contained in:
Bruno Alexandre Rosa 2025-10-10 14:43:50 -03:00
parent 0e5a02ae53
commit 77e83e8590

View file

@ -137,21 +137,25 @@ if [[ $TARGET_MACOS_VERSION ]]; then
# CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version # CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version
flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=${TARGET_MACOS_VERSION}") flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=${TARGET_MACOS_VERSION}")
# testing passing vcpkg triplets config as cmake variables
flags+=("-DVCPKG_CMAKE_SYSTEM_VERSION=${TARGET_MACOS_VERSION}")
flags+=("-DVCPKG_OSX_DEPLOYMENT_TARGET=${TARGET_MACOS_VERSION}")
# vcpkg dependencies need a vcpkg triplet file to compile to the 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 # an easy way is to copy the x64-osx.cmake file and modify it
TRIPLETS_DIR="../cmake/triplets" # TRIPLETS_DIR="../cmake/triplets"
mkdir -p "$TRIPLETS_DIR" # mkdir -p "$TRIPLETS_DIR"
# Replace dots with hyphens in triplet name for vcpkg compatibility # # Replace dots with hyphens in triplet name for vcpkg compatibility
TRIPLET_VERSION=$(echo "${TARGET_MACOS_VERSION}" | sed 's/\./-/g') # TRIPLET_VERSION=$(echo "${TARGET_MACOS_VERSION}" | sed 's/\./-/g')
TRIPLET_FILE="$TRIPLETS_DIR/x64-osx-${TRIPLET_VERSION}.cmake" # TRIPLET_FILE="$TRIPLETS_DIR/x64-osx-${TRIPLET_VERSION}.cmake"
cp ../vcpkg/triplets/x64-osx.cmake "$TRIPLET_FILE" # cp ../vcpkg/triplets/x64-osx.cmake "$TRIPLET_FILE"
echo "set(VCPKG_CMAKE_SYSTEM_VERSION ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" # echo "set(VCPKG_CMAKE_SYSTEM_VERSION ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE"
echo "set(VCPKG_OSX_DEPLOYMENT_TARGET ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE" # echo "set(VCPKG_OSX_DEPLOYMENT_TARGET ${TARGET_MACOS_VERSION})" >> "$TRIPLET_FILE"
flags+=("-DVCPKG_OVERLAY_TRIPLETS=$TRIPLETS_DIR") # flags+=("-DVCPKG_OVERLAY_TRIPLETS=$TRIPLETS_DIR")
flags+=("-DVCPKG_TARGET_TRIPLET=x64-osx-${TRIPLET_VERSION}") # flags+=("-DVCPKG_TARGET_TRIPLET=x64-osx-${TRIPLET_VERSION}")
echo "::group::Generated triplet $TRIPLET_FILE" # echo "::group::Generated triplet $TRIPLET_FILE"
cat "$TRIPLET_FILE" # cat "$TRIPLET_FILE"
echo "::endgroup::" # echo "::endgroup::"
fi fi
# Add cmake --build flags # Add cmake --build flags