From 86b1e8a00dd80bcd9a5c58f654c1d250dbfc9882 Mon Sep 17 00:00:00 2001 From: Saikari Date: Sat, 1 Nov 2025 16:44:40 +0300 Subject: [PATCH] Add macOS CI workflow and update CMake presets for vcpkg integration --- .github/workflows/cmake-multi-platform.yml | 36 ++++++++++++++++++++++ CMakePresets.json | 20 +++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 2c01dd4f..d1ab7026 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -84,3 +84,39 @@ jobs: - name: Run unit_tests.exe shell: bash run: ./out/Release/unit_tests.exe + + ############################################################################## + # 3) macOS – AppleClang / Ninja + ############################################################################## + macosx-build-and-test: + name: macOS (AppleClang) + runs-on: macOS-latest + env: + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + steps: + - name: Install basic tool-chain with Homebrew + shell: bash + run: | + brew install cmake ninja + + - name: Checkout repository (with sub-modules) + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up vcpkg + shell: bash + run: | + git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT" + + - name: Configure (cmake --preset) + shell: bash + run: cmake --preset darwin-release-vcpkg -DOMATH_BUILD_TESTS=ON -DOMATH_BUILD_BENCHMARK=OFF -DVCPKG_MANIFEST_FEATURES="imgui;avx2;tests" + + - name: Build + shell: bash + run: cmake --build cmake-build/build/darwin-release-vcpkg --target unit_tests omath + + - name: Run unit_tests + shell: bash + run: ./out/Release/unit_tests diff --git a/CMakePresets.json b/CMakePresets.json index 5e493b52..130a049d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -127,7 +127,8 @@ "binaryDir": "${sourceDir}/cmake-build/build/${presetName}", "installDir": "${sourceDir}/cmake-build/install/${presetName}", "cacheVariables": { - "CMAKE_CXX_COMPILER": "clang++" + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_MAKE_PROGRAM": "ninja" }, "condition": { "type": "equals", @@ -135,6 +136,17 @@ "rhs": "Darwin" } }, + { + "name": "darwin-base-vcpkg", + "hidden": true, + "inherits": "darwin-base", + "cacheVariables": { + "OMATH_BUILD_VIA_VCPKG": "ON", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_INSTALLED_DIR": "${sourceDir}/cmake-build/vcpkg_installed", + "VCPKG_MANIFEST_FEATURES": "tests;imgui;avx2" + } + }, { "name": "darwin-debug", "displayName": "Darwin Debug", @@ -146,7 +158,7 @@ { "name": "darwin-debug-vcpkg", "displayName": "Darwin Debug", - "inherits": "darwin-base", + "inherits": "darwin-base-vcpkg", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } @@ -154,7 +166,7 @@ { "name": "darwin-release", "displayName": "Darwin Release", - "inherits": "darwin-debug", + "inherits": "darwin-base", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } @@ -162,7 +174,7 @@ { "name": "darwin-release-vcpkg", "displayName": "Darwin Release", - "inherits": "darwin-debug", + "inherits": "darwin-base-vcpkg", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }