Skip to content

Commit

Permalink
Added macOS CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe2933 committed Sep 30, 2024
1 parent e8ba401 commit 2211733
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Linux

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

on:
push:
paths:
- '**'
- '!README.md'
- '!LICENSE.txt'
- '!doc/**'
- '!.github/workflows/*.yml'
- '.github/workflows/macos.yml'

jobs:
build:
runs-on: macos-15-arm64
steps:
- uses: actions/checkout@v4

- name: Install Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: latest
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true

- name: Install Ninja
run: brew install ninja

- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Configure
run: |
mv .github/workflows/scripts/* .
cmake --preset=macos-clang-18
- name: Build
run: cmake --build build --config release
12 changes: 12 additions & 0 deletions .github/workflows/scripts/CMakeUserPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/triplets",
"VCPKG_TARGET_TRIPLET": "x64-linux-clang"
}
},
{
"name": "macos-clang-18",
"displayName": "macOS + Clang 18",
"inherits": "default",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "/opt/homebrew/opt/llvm@18/bin/clang++",
"CMAKE_CXX_FLAGS": "-nostdinc++ -nostdlib++ -isystem /opt/homebrew/opt/llvm@18/include/c++/v1",
"CMAKE_EXE_LINKER_FLAGS": "-L /opt/homebrew/opt/llvm@18/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@18/lib/c++ -lc++",
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/triplets",
"VCPKG_TARGET_TRIPLET": "arm64-osx-clang"
}
}
]
}
3 changes: 3 additions & 0 deletions .github/workflows/scripts/arm64-osx-clang-toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_CXX_COMPILER /opt/homebrew/opt/llvm@18/bin/clang++)
set(CMAKE_CXX_FLAGS "-nostdinc++ -nostdlib++ -isystem /opt/homebrew/opt/llvm@18/include/c++/v1")
set(CMAKE_EXE_LINKER_FLAGS "-L /opt/homebrew/opt/llvm@18/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@18/lib/c++ -lc++")
5 changes: 5 additions & 0 deletions .github/workflows/scripts/triplets/arm64-osx-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/../arm64-osx-clang-toolchain.cmake)

0 comments on commit 2211733

Please sign in to comment.