Skip to content

Commit

Permalink
fix(GODT-1952): Ensure C++ libs are compatible with macOS Big Sur
Browse files Browse the repository at this point in the history
Use custom vcpkg target triplets and triplet overlay to extend the
existing triplet list.
  • Loading branch information
LBeernaertProton committed Oct 26, 2022
1 parent d07d8ad commit 6f89ef0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-parser/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ runs:
- name: Configure CMake project (mac)
if: ${{ runner.os == 'macOS' }}
run: |
cmake -B build-x64 -S internal/parser -G Ninja -W no-dev -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-osx -DCMAKE_OSX_ARCHITECTURES=x86_64 -DVCPKG_OSX_ARCHITECTURES=x86_64 -DVCPKG_BUILD_TYPE=release
cmake -B build-arm64 -S internal/parser -G Ninja -W no-dev -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=arm64-osx -DCMAKE_OSX_ARCHITECTURES=arm64 -DVCPKG_OSX_ARCHITECTURES=arm64 -DVCPKG_BUILD_TYPE=release
cmake -B build-x64 -S internal/parser -G Ninja -W no-dev -DCMAKE_BUILD_TYPE=Release -DVCPKG_OVERLAY_TRIPLETS="$PWD/internal/parser/overlay-triplet" -DVCPKG_HOST_TRIPLET=x64-osx-min-11.0 -DVCPKG_TARGET_TRIPLET=x64-osx-min-11.0 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DVCPKG_OSX_ARCHITECTURES=x86_64 -DVCPKG_BUILD_TYPE=release
cmake -B build-arm64 -S internal/parser -G Ninja -W no-dev -DCMAKE_BUILD_TYPE=Release -DVCPKG_OVERLAY_TRIPLETS="$PWD/internal/parser/overlay-triplet" -DVCPKG_TARGET_TRIPLET=arm64-osx-min-11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 -DVCPKG_OSX_ARCHITECTURES=arm64 -DVCPKG_BUILD_TYPE=release
shell: bash

- name: Configure CMake project (not windows & not mac)
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ run:
go: 1.18
skip-files:
- internal/parser/parser.go
- internal/parser/extern

linters:
presets:
Expand Down
4 changes: 3 additions & 1 deletion internal/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.14)

set(VCPKG_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")

project(Gluon VERSION 0.1.0 LANGUAGES CXX)
Expand All @@ -17,7 +19,7 @@ set(CMAKE_DEBUG_POSTFIX "d")

if (APPLE)
# Can't rely only on CMake's system information as it is possible to cross-compile for both x64 and arm64 on mac OS
if ("${VCPKG_TARGET_TRIPLET}" STREQUAL "x64-osx")
if ("${VCPKG_TARGET_TRIPLET}" STREQUAL "x64-osx-min-11.0")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/Darwin/x86_64)
else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/Darwin/arm64)
Expand Down
7 changes: 7 additions & 0 deletions internal/parser/overlay-triplet/arm64-osx-min-11.0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_OSX_DEPLOYMENT_TARGET "11.0")
8 changes: 8 additions & 0 deletions internal/parser/overlay-triplet/x64-osx-min-11.0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_OSX_DEPLOYMENT_TARGET "11.0")

0 comments on commit 6f89ef0

Please sign in to comment.