Skip to content

Commit

Permalink
Add macOS/iOS/iOSSimulator CI builds
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Feb 1, 2025
1 parent 2168269 commit 88d1766
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 14 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,48 @@ jobs:
with:
name: ubuntu_${{ matrix.container }}
path: libcdoc*.*
macos:
name: Build on macOS for ${{ matrix.target }}
runs-on: macos-latest
strategy:
matrix:
target: [macos, iphoneos, iphonesimulator]
include:
- target: iphoneos
triplet: arm64-ios
- target: iphonesimulator
triplet: arm64-ios-simulator
env:
DEST: ${{ github.workspace }}/${{ matrix.target }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
brew update
brew install --formula ninja flatbuffers swig doxygen boost [email protected]
brew unlink [email protected] || true
brew unlink [email protected] || true
- name: Prepare vcpkg
if: matrix.target != 'macos'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
- name: Build
run: |
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ env.DEST }}
cmake --build --preset ${{ matrix.target }}
- name: Test
if: matrix.target == 'macos'
run: cmake --build --preset ${{ matrix.target }} --target test
- name: Install
run: cmake --build --preset ${{ matrix.target }} --target install/strip
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ env.DEST }}/**
72 changes: 72 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,78 @@
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
}
},
{
"name": "macos",
"description": "This macos build is only available on macOS",
"binaryDir": "${sourceDir}/build/${presetName}",
"generator": "Ninja",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"cacheVariables": {
"CMAKE_OSX_ARCHITECTURES": "arm64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0",
"CMAKE_FIND_ROOT_PATH": "$env{DEST};/opt/homebrew",
"FRAMEWORK_DESTINATION": "$env{DEST}/lib"
},
"installDir": "$env{DEST}"
},
{
"name": "mobile",
"hidden": true,
"environment": {
"DEST_SUFFIX": ".${presetName}"
},
"cacheVariables": {
"CMAKE_DISABLE_FIND_PACKAGE_Boost": "YES",
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen": "YES"
}
},
{
"name": "ios",
"hidden": true,
"inherits": ["mobile", "macos"],
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "iOS",
"CMAKE_OSX_SYSROOT": "${presetName}",
"CMAKE_OSX_DEPLOYMENT_TARGET": "15.0",
"CMAKE_DISABLE_FIND_PACKAGE_SWIG": "YES",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "iphoneos",
"inherits": "ios",
"description": "This iphoneos build is only available on macOS",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "arm64-ios"
}
},
{
"name": "iphonesimulator",
"inherits": "ios",
"description": "This iphonesimulator build is only available on macOS",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "arm64-ios-simulator"
}
}
],
"buildPresets":
[
{
"name": "macos",
"configurePreset": "macos"
},
{
"name": "iphoneos",
"configurePreset": "iphoneos"
},
{
"name": "iphonesimulator",
"configurePreset": "iphonesimulator"
}
]
}
9 changes: 0 additions & 9 deletions CMakeUserPresets.json

This file was deleted.

3 changes: 2 additions & 1 deletion libcdoc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ if(SWIG_FOUND)
INSTALL_RPATH $<$<PLATFORM_ID:Darwin>:/Library/Frameworks>
SWIG_COMPILE_DEFINITIONS $<$<PLATFORM_ID:Windows>:SWIGWIN>
)
install(TARGETS cdoc_java DESTINATION $<IF:$<PLATFORM_ID:Darwin>,/Library/Java/Extensions,${CMAKE_INSTALL_LIBDIR}>)
#install(TARGETS cdoc_java DESTINATION $<IF:$<PLATFORM_ID:Darwin>,/Library/Java/Extensions,${CMAKE_INSTALL_LIBDIR}>)
install(TARGETS cdoc_java DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/java/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ee/ria/libcdoc FILES_MATCHING PATTERN "*.java")
if(WIN32)
install(FILES $<TARGET_PDB_FILE:cdoc_java> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
Expand Down
18 changes: 14 additions & 4 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
"dependencies": [
"zlib",
{
"name": "zlib",
"platform": "!osx & !ios"
},
{
"name": "libxml2",
"default-features": false
"default-features": false,
"platform": "!osx & !ios"
},
"flatbuffers",
"openssl"
{
"name": "flatbuffers",
"platform": "!osx & !ios"
},
{
"name": "openssl",
"platform": "!osx"
}
],
"features": {
"tests": { "description": "Build tests", "dependencies": ["boost-test"] }
Expand Down

0 comments on commit 88d1766

Please sign in to comment.