Vcpkg universal build 2 #310
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
build_type: | |
- "Debug" | |
- "Release" | |
platform: | |
# - "windows-latest" | |
# - "ubuntu-latest" | |
- "macos-latest" | |
include: | |
# - platform: "windows-latest" | |
# vcpkg_triplet: "x64-windows-static" | |
# - platform: "ubuntu-latest" | |
# vcpkg_triplet: "x64-linux" | |
- platform: "macos-latest" | |
vcpkg_triplet: "universal-osx" | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
actions: write | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.10.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install vcpkg | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
cd vcpkg && ./bootstrap-vcpkg.sh | |
echo "VCPKG_ROOT=${{github.workspace}}/vcpkg" >> $GITHUB_ENV | |
echo "${{github.workspace}}/vcpkg" >> $GITHUB_PATH | |
./vcpkg integrate install | |
shell: bash | |
- name: Merge arm64/x86_64 binaries | |
if: matrix.platform == 'macos-latest' | |
run: | | |
brew install pkg-config rsync | |
vcpkg install --triplet arm64-osx | |
cp -r vcpkg_installed/arm64-osx . | |
vcpkg install --triplet x64-osx | |
rsync -au --delete arm64-osx/ vcpkg_installed/arm64-osx | |
curl -o lipo-dir-merge.py https://raw.githubusercontent.com/faaxm/lipo-dir-merge/main/lipo-dir-merge.py | |
python3 lipo-dir-merge.py vcpkg_installed/x64-osx vcpkg_installed/arm64-osx vcpkg_installed/${{matrix.vcpkg_triplet}} | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" | |
- name: CMake | |
if: matrix.platform != 'macos-latest' | |
run: | | |
cmake --preset=default -DVCPKG_TARGET_TRIPLET=${{matrix.vcpkg_triplet}} | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} | |
- name: Build | |
run: | | |
cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} | |
cpack --config ${{github.workspace}}/build/CPackConfig.cmake -C ${{matrix.build_type}} -G ZIP | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{matrix.platform}} ${{matrix.build_type}} binaries | |
path: ${{github.workspace}}/*.zip |