From 095f3458858bcb1a473b12411e9b462707321dfd Mon Sep 17 00:00:00 2001 From: Braden Ganetsky Date: Fri, 18 Jul 2025 19:23:19 -0500 Subject: [PATCH 1/3] Set up caching in GitHub Actions --- .github/actions/caching/action.yml | 16 ++++++++++++++++ .github/workflows/build.yml | 17 ++++++++++++++--- .github/workflows/test.yml | 20 ++++++++++++++++---- 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 .github/actions/caching/action.yml diff --git a/.github/actions/caching/action.yml b/.github/actions/caching/action.yml new file mode 100644 index 0000000..da7b6d7 --- /dev/null +++ b/.github/actions/caching/action.yml @@ -0,0 +1,16 @@ +name: caching + +inputs: + key-prefix: + required: true + +runs: + using: "composite" + steps: + - name: Cache build directory + uses: actions/cache@v4 + with: + path: | + build + external/vcpkg + key: ${{ inputs.key-prefix }}-2025-07-18 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73b8755..9913fc2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,14 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - - uses: ./.github/actions/common-windows + + - name: Caching + uses: ./.github/actions/caching + with: + key-prefix: windows-build + + - name: Configure and build + uses: ./.github/actions/common-windows with: config-preset: Release build-preset: Release @@ -36,7 +42,12 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - + + - name: Caching + uses: ./.github/actions/caching + with: + key-prefix: macos-build + - uses: ./.github/actions/common-macos with: config-preset: Release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d9ee6c..40316e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,8 +10,14 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - - uses: ./.github/actions/common-windows + + - name: Caching + uses: ./.github/actions/caching + with: + key-prefix: windows-build + + - name: Configure and build + uses: ./.github/actions/common-windows with: config-preset: Debug build-preset: Tests @@ -28,8 +34,14 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - - uses: ./.github/actions/common-macos + + - name: Caching + uses: ./.github/actions/caching + with: + key-prefix: macos-build + + - name: Configure and build + uses: ./.github/actions/common-macos with: config-preset: Debug build-preset: Tests From 28a394295c538a2c9de01b34b05c66b613c8cd2b Mon Sep 17 00:00:00 2001 From: Braden Ganetsky Date: Fri, 18 Jul 2025 19:23:19 -0500 Subject: [PATCH 2/3] Rollback vcpkg to wxWidgets 3.2.6, since 3.2.7 has an issue with GL on Mac --- external/vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/vcpkg b/external/vcpkg index f26ec39..66ddab6 160000 --- a/external/vcpkg +++ b/external/vcpkg @@ -1 +1 @@ -Subproject commit f26ec398c25c4980f33a50391f00a75f7ad62ef7 +Subproject commit 66ddab67e28a9c8f53abe2063e0fb5ccd16e7103 From f5259541b8605448c416dfb1331dd0ad32c0066b Mon Sep 17 00:00:00 2001 From: Braden Ganetsky Date: Fri, 18 Jul 2025 19:23:20 -0500 Subject: [PATCH 3/3] Fix vcpkg usage for Mac --- .github/actions/common-macos/action.yml | 7 ++++++- .github/workflows/build.yml | 27 +++++++++++++++++++++---- .github/workflows/test.yml | 2 ++ CMakeLists.txt | 14 +++++++------ src/pstack/gui/CMakeLists.txt | 2 +- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/.github/actions/common-macos/action.yml b/.github/actions/common-macos/action.yml index e709921..ab78a4b 100644 --- a/.github/actions/common-macos/action.yml +++ b/.github/actions/common-macos/action.yml @@ -5,6 +5,10 @@ inputs: required: true build-preset: required: true + vcpkg-triplet: + required: true + arch: + required: true runs: using: "composite" @@ -17,7 +21,8 @@ runs: run: | cmake --preset ${{ inputs.config-preset }} \ -G Xcode \ - -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + -DVCPKG_TARGET_TRIPLET=${{ inputs.vcpkg-triplet }} \ + -DCMAKE_OSX_ARCHITECTURES=${{ inputs.arch }} \ -DCMAKE_OSX_DEPLOYMENT_TARGET=11.6 shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9913fc2..0695a7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,18 +48,37 @@ jobs: with: key-prefix: macos-build - - uses: ./.github/actions/common-macos + - name: Configure and build x64 + uses: ./.github/actions/common-macos with: config-preset: Release build-preset: Release + vcpkg-triplet: x64-osx + arch: x86_64 + + - name: Configure and build arm64 + uses: ./.github/actions/common-macos + with: + config-preset: Release + build-preset: Release + vcpkg-triplet: arm64-osx + arch: arm64 + + - name: Merge binaries + run: | + mkdir -p ./bin/Release + cp -R ./bin/x86_64/Release/PartStackerGUI.app ./bin/Release/PartStackerGUI.app + lipo -create \ + ./bin/x86_64/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI \ + ./bin/arm64/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI \ + -output ./bin/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI - name: Package into DMG run: | - mkdir -p ./bin/Release/dmg-root - mv ./bin/Release/PartStackerGUI.app ./bin/Release/dmg-root/ + mkdir -p ./bin/Release hdiutil create \ -volname "PartStackerGUI" \ - -srcfolder ./bin/Release/dmg-root \ + -srcfolder ./bin/Release \ -format UDZO \ ./bin/Release/PartStackerGUI-mac.dmg diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40316e8..d6a970f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,8 @@ jobs: with: config-preset: Debug build-preset: Tests + vcpkg-triplet: arm64-osx + arch: arm64 - name: Run Tests run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 94fce5d..e4d9404 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,13 @@ cmake_minimum_required(VERSION 3.30) -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "" FORCE) -elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - set(VCPKG_TARGET_TRIPLET "x64-osx" CACHE STRING "" FORCE) -else() - message(FATAL_ERROR "Unsupported platform: ${CMAKE_HOST_SYSTEM_NAME}") +if(NOT DEFINED VCPKG_TARGET_TRIPLET) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "" FORCE) + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(VCPKG_TARGET_TRIPLET "arm64-osx" CACHE STRING "" FORCE) + else() + message(FATAL_ERROR "Unsupported platform: ${CMAKE_HOST_SYSTEM_NAME}") + endif() endif() project(PartStacker LANGUAGES CXX) diff --git a/src/pstack/gui/CMakeLists.txt b/src/pstack/gui/CMakeLists.txt index 72e0f76..2e194b2 100644 --- a/src/pstack/gui/CMakeLists.txt +++ b/src/pstack/gui/CMakeLists.txt @@ -39,5 +39,5 @@ set(PSTACK_OUTPUT_FILE_NAME "PartStackerGUI") pstack_configure_target_info(pstack_gui) set_target_properties(pstack_gui PROPERTIES OUTPUT_NAME ${PSTACK_OUTPUT_FILE_NAME} - RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin/${CMAKE_OSX_ARCHITECTURES}" )