Skip to content

Commit

Permalink
ci: Add macos-13 CI build and test jobs (#30)
Browse files Browse the repository at this point in the history
* ci: Add macos-13 CI build and test jobs
* build: Add build and test presets for macOSX
* build: Specify the macOSX SDK to be used
* build: Activate experimental libc++ features on MacOS
* build: Rename toolchains to match triplets
  • Loading branch information
BurningEnlightenment authored Aug 11, 2023
1 parent fe74557 commit 5d45459
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 10 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/cpp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
os: [macos-13, ubuntu-22.04, windows-2022]
compiler: [gcc, clang, msvc]
exclude:
- os: windows-2022
compiler: gcc
- os: macos-13
compiler: msvc
- os: ubuntu-22.04
compiler: msvc
- os: windows-2022
compiler: gcc
include:
- os: macos-13
triplet: x64-macos
- os: ubuntu-22.04
triplet: x64-linux
- os: windows-2022
Expand Down
81 changes: 76 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-linux-clang",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/clang-x64-linux.cmake"
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang.cmake"
}
},
{
Expand All @@ -137,7 +137,7 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-linux-clang-15",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/clang-15-x64-linux.cmake",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-15.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": true
}
},
Expand All @@ -147,10 +147,40 @@
"x64-linux"
],
"cacheVariables": {
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/gcc-12-x64-linux.cmake",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake",
"CMAKE_CXX_FLAGS": "-fconcepts-diagnostics-depth=0 -ftemplate-backtrace-limit=0 -fsanitize=address,leak,undefined -g -fno-omit-frame-pointer",
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address,leak,undefined",
"CMAKE_CXX_COMPILER": "g++"
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address,leak,undefined"
}
},
{
"name": "x64-macos",
"hidden": true,
"inherits": [ "base" ],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-osx"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [
"macOS"
]
}
}
},
{
"name": "x64-macos-clang",
"inherits": [ "x64-macos" ],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-osx-clang-15-brew",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-clang-15-brew.cmake"
}
},
{
"name": "x64-macos-gcc",
"inherits": [ "x64-macos" ],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-osx-gcc-12",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-gcc-12.cmake"
}
}
],
Expand Down Expand Up @@ -194,6 +224,26 @@
"name": "x64-linux-gcc-release",
"inherits": "x64-linux-gcc",
"configuration": "RelWithDebInfo"
},
{
"name": "x64-macos-clang",
"configurePreset": "x64-macos-clang",
"configuration": "Debug"
},
{
"name": "x64-macos-clang-release",
"inherits": "x64-macos-clang",
"configuration": "RelWithDebInfo"
},
{
"name": "x64-macos-gcc",
"configurePreset": "x64-macos-gcc",
"configuration": "Debug"
},
{
"name": "x64-macos-gcc-release",
"inherits": "x64-macos-gcc",
"configuration": "RelWithDebInfo"
}
],
"testPresets": [
Expand Down Expand Up @@ -245,6 +295,27 @@
"name": "x64-linux-gcc-release",
"inherits": "x64-linux-gcc",
"configuration": "RelWithDebInfo"
},
{
"name": "x64-macos-clang",
"configurePreset": "x64-macos-clang",
"configuration": "Debug"
},
{
"name": "x64-macos-clang-release",
"inherits": "x64-macos-clang",
"configuration": "RelWithDebInfo"
},
{
"name": "x64-macos-gcc",
"inherits": "sanitizer_env",
"configurePreset": "x64-macos-gcc",
"configuration": "Debug"
},
{
"name": "x64-macos-gcc-release",
"inherits": "x64-macos-gcc",
"configuration": "RelWithDebInfo"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions tools/toolchains/x64-macos-clang-15-brew.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_SYSTEM_PROCESSOR AMD64)

execute_process(COMMAND brew --prefix llvm@15 OUTPUT_VARIABLE BREW_LLVM_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CMAKE_C_COMPILER "${BREW_LLVM_PATH}/bin/clang")
set(CMAKE_CXX_COMPILER "${BREW_LLVM_PATH}/bin/clang++")
set(CMAKE_OSX_SYSROOT /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)

set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation -fexperimental-library")
8 changes: 8 additions & 0 deletions tools/toolchains/x64-macos-gcc-12.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(CMAKE_SYSTEM_PROCESSOR AMD64)

set(CMAKE_C_COMPILER gcc-12)
set(CMAKE_CXX_COMPILER g++-12)
set(CMAKE_OSX_SYSROOT /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)

set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
2 changes: 1 addition & 1 deletion tools/triplets/x64-linux-clang-15.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/clang-15-x64-linux.cmake")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-linux-clang-15.cmake")
2 changes: 1 addition & 1 deletion tools/triplets/x64-linux-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/clang-x64-linux.cmake")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-linux-clang.cmake")
7 changes: 7 additions & 0 deletions tools/triplets/x64-osx-clang-15-brew.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-macos-clang-15-brew.cmake")
6 changes: 6 additions & 0 deletions tools/triplets/x64-osx-gcc-12.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-macos-gcc-12.cmake")

0 comments on commit 5d45459

Please sign in to comment.