Skip to content

Commit 4200b0d

Browse files
committed
Fix vcpkg on MacOS
1 parent 9f89618 commit 4200b0d

5 files changed

Lines changed: 35 additions & 14 deletions

File tree

.github/actions/common-macos/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ inputs:
55
required: true
66
build-preset:
77
required: true
8+
vcpkg-triplet:
9+
required: true
810

911
runs:
1012
using: "composite"
@@ -17,7 +19,7 @@ runs:
1719
run: |
1820
cmake --preset ${{ inputs.config-preset }} \
1921
-G Xcode \
20-
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
22+
-DVCPKG_TARGET_TRIPLET=${{ vcpkg-triplet }} \
2123
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.6
2224
shell: bash
2325

.github/workflows/build.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
uses: actions/checkout@v4
1414
with:
1515
submodules: recursive
16-
17-
- uses: ./.github/actions/common-windows
16+
17+
- name: Configure and build
18+
uses: ./.github/actions/common-windows
1819
with:
1920
config-preset: Release
2021
build-preset: Release
@@ -36,19 +37,34 @@ jobs:
3637
uses: actions/checkout@v4
3738
with:
3839
submodules: recursive
39-
40-
- uses: ./.github/actions/common-macos
40+
41+
- name: Configure and build x64
42+
uses: ./.github/actions/common-macos
4143
with:
4244
config-preset: Release
4345
build-preset: Release
46+
vcpkg-triplet: x64-osx
47+
48+
- name: Configure and build arm64
49+
uses: ./.github/actions/common-macos
50+
with:
51+
config-preset: Debug
52+
build-preset: Tests
53+
vcpkg-triplet: arm64-osx
54+
55+
- name: Merge binaries
56+
run: |
57+
cp -R ./bin/x86_x64/Release/PartStackerGUI.app ./bin/universal/Release/PartStackerGUI.app
58+
lipo -create \
59+
./bin/x86_x64/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI \
60+
./bin/arm64/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI \
61+
-output ./bin/universal/Release/PartStackerGUI.app/Contents/MacOS/PartStackerGUI
4462
4563
- name: Package into DMG
4664
run: |
47-
mkdir -p ./bin/Release/dmg-root
48-
mv ./bin/Release/PartStackerGUI.app ./bin/Release/dmg-root/
4965
hdiutil create \
5066
-volname "PartStackerGUI" \
51-
-srcfolder ./bin/Release/dmg-root \
67+
-srcfolder ./bin/universal/Release \
5268
-format UDZO \
5369
./bin/Release/PartStackerGUI-mac.dmg
5470

.github/workflows/test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ jobs:
1010
uses: actions/checkout@v4
1111
with:
1212
submodules: recursive
13-
14-
- uses: ./.github/actions/common-windows
13+
14+
- name: Configure and build
15+
uses: ./.github/actions/common-windows
1516
with:
1617
config-preset: Debug
1718
build-preset: Tests
@@ -28,11 +29,13 @@ jobs:
2829
uses: actions/checkout@v4
2930
with:
3031
submodules: recursive
31-
32-
- uses: ./.github/actions/common-macos
32+
33+
- name: Configure and build
34+
uses: ./.github/actions/common-macos
3335
with:
3436
config-preset: Debug
3537
build-preset: Tests
38+
vcpkg-triplet: arm64-osx
3639

3740
- name: Run Tests
3841
run: |

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.30)
33
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
44
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "" FORCE)
55
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
6-
set(VCPKG_TARGET_TRIPLET "x64-osx" CACHE STRING "" FORCE)
6+
set(VCPKG_TARGET_TRIPLET "arm64-osx" CACHE STRING "" FORCE)
77
else()
88
message(FATAL_ERROR "Unsupported platform: ${CMAKE_HOST_SYSTEM_NAME}")
99
endif()

src/pstack/gui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ set(PSTACK_OUTPUT_FILE_NAME "PartStackerGUI")
3939
pstack_configure_target_info(pstack_gui)
4040
set_target_properties(pstack_gui PROPERTIES
4141
OUTPUT_NAME ${PSTACK_OUTPUT_FILE_NAME}
42-
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
42+
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/${CMAKE_OSX_ARCHITECTURES}/bin"
4343
)

0 commit comments

Comments
 (0)