Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/caching/action.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .github/actions/common-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
required: true
build-preset:
required: true
vcpkg-triplet:
required: true
arch:
required: true

runs:
using: "composite"
Expand All @@ -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

Expand Down
44 changes: 37 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,19 +42,43 @@ 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 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

Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,11 +34,19 @@ 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
vcpkg-triplet: arm64-osx
arch: arm64

- name: Run Tests
run: |
Expand Down
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion external/vcpkg
Submodule vcpkg updated 1863 files
2 changes: 1 addition & 1 deletion src/pstack/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)