Skip to content

Commit 21bc401

Browse files
committed
Add macOS/iOS/iOSSimulator CI builds
Signed-off-by: Raul Metsma <[email protected]>
1 parent 48f665a commit 21bc401

File tree

4 files changed

+128
-13
lines changed

4 files changed

+128
-13
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,45 @@ jobs:
4040
with:
4141
name: ubuntu_${{ matrix.container }}
4242
path: libcdoc*.*
43+
macos:
44+
name: Build on macOS for ${{ matrix.target }}
45+
runs-on: macos-latest
46+
strategy:
47+
matrix:
48+
target: [macos, iphoneos, iphonesimulator]
49+
include:
50+
- target: iphoneos
51+
triplet: arm64-ios
52+
- target: iphonesimulator
53+
triplet: arm64-ios-simulator
54+
env:
55+
DEST: ${{ github.workspace }}/${{ matrix.target }}
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
- name: Install dependencies
60+
run: |
61+
brew update
62+
brew install --formula ninja flatbuffers swig doxygen boost [email protected]
63+
brew unlink [email protected] || true
64+
brew unlink [email protected] || true
65+
- name: Prepare vcpkg
66+
if: matrix.target != 'macos'
67+
uses: lukka/run-vcpkg@v11
68+
with:
69+
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
70+
vcpkgJsonGlob: ./vcpkg.json
71+
runVcpkgInstall: true
72+
env:
73+
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
74+
- name: Build macOS
75+
run: |
76+
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ env.DEST }}
77+
cmake --build --preset ${{ matrix.target }}
78+
cmake --build --preset ${{ matrix.target }} --target test
79+
cmake --build --preset ${{ matrix.target }} --target install/strip
80+
- name: Archive artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.target }}
84+
path: ${{ env.DEST }}/**

CMakePresets.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,78 @@
1414
"CMAKE_C_COMPILER": "cl.exe",
1515
"CMAKE_CXX_COMPILER": "cl.exe"
1616
}
17+
},
18+
{
19+
"name": "macos",
20+
"description": "This macos build is only available on macOS",
21+
"binaryDir": "${sourceDir}/build/${presetName}",
22+
"generator": "Ninja",
23+
"condition": {
24+
"type": "equals",
25+
"lhs": "${hostSystemName}",
26+
"rhs": "Darwin"
27+
},
28+
"cacheVariables": {
29+
"CMAKE_OSX_ARCHITECTURES": "arm64",
30+
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0",
31+
"CMAKE_FIND_ROOT_PATH": "$env{DEST};/opt/homebrew"
32+
},
33+
"installDir": "$env{DEST}"
34+
},
35+
{
36+
"name": "mobile",
37+
"hidden": true,
38+
"environment": {
39+
"DEST_SUFFIX": ".${presetName}"
40+
},
41+
"cacheVariables": {
42+
"CMAKE_DISABLE_FIND_PACKAGE_Boost": "YES",
43+
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen": "YES"
44+
}
45+
},
46+
{
47+
"name": "ios",
48+
"hidden": true,
49+
"inherits": ["mobile", "macos"],
50+
"cacheVariables": {
51+
"CMAKE_SYSTEM_NAME": "iOS",
52+
"CMAKE_OSX_SYSROOT": "${presetName}",
53+
"CMAKE_OSX_DEPLOYMENT_TARGET": "15.0",
54+
"CMAKE_DISABLE_FIND_PACKAGE_SWIG": "YES",
55+
"FRAMEWORK_DESTINATION": "$env{DEST}/lib",
56+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
57+
}
58+
},
59+
{
60+
"name": "iphoneos",
61+
"inherits": "ios",
62+
"description": "This iphoneos build is only available on macOS",
63+
"cacheVariables": {
64+
"VCPKG_TARGET_TRIPLET": "arm64-ios"
65+
}
66+
},
67+
{
68+
"name": "iphonesimulator",
69+
"inherits": "ios",
70+
"description": "This iphonesimulator build is only available on macOS",
71+
"cacheVariables": {
72+
"VCPKG_TARGET_TRIPLET": "arm64-ios-simulator"
73+
}
1774
}
75+
],
76+
"buildPresets":
77+
[
78+
{
79+
"name": "macos",
80+
"configurePreset": "macos"
81+
},
82+
{
83+
"name": "iphoneos",
84+
"configurePreset": "iphoneos"
85+
},
86+
{
87+
"name": "iphonesimulator",
88+
"configurePreset": "iphonesimulator"
89+
}
1890
]
1991
}

CMakeUserPresets.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

vcpkg.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
{
22
"dependencies": [
3-
"zlib",
3+
{
4+
"name": "zlib",
5+
"platform": "!osx & !ios"
6+
},
47
{
58
"name": "libxml2",
6-
"default-features": false
9+
"default-features": false,
10+
"platform": "!osx & !ios"
711
},
8-
"flatbuffers",
9-
"openssl"
12+
{
13+
"name": "flatbuffers",
14+
"platform": "!osx & !ios"
15+
},
16+
{
17+
"name": "openssl",
18+
"platform": "!osx"
19+
}
1020
],
1121
"features": {
1222
"tests": { "description": "Build tests", "dependencies": ["boost-test"] }

0 commit comments

Comments
 (0)