Statically linking boost libraries #29
This file contains hidden or 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 macOS Universal Binary | |
on: | |
push: | |
branches: | |
- 'master' | |
release: | |
types: [published] # Trigger on published release | |
jobs: | |
build-universal-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Dependencies | |
run: | | |
brew update | |
brew install cmake ninja llvm | |
- name: Install vcpkg | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
cd vcpkg | |
./bootstrap-vcpkg.sh | |
echo "VCPKG_ROOT=$PWD" >> $GITHUB_ENV | |
echo "$VCPKG_ROOT" >> $GITHUB_PATH | |
- name: Install Boost for x86_64 | |
run: | | |
$VCPKG_ROOT/vcpkg install --triplet=x64-osx | |
- name: Install Boost for arm64 | |
run: | | |
$VCPKG_ROOT/vcpkg install --triplet=arm64-osx | |
- name: Configure Build with vcpkg for x86_64 | |
run: | | |
mkdir -p build_x86_64 | |
cd build_x86_64 | |
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ | |
-DCMAKE_OSX_ARCHITECTURES="x86_64" \ | |
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" | |
- name: Build Project for x86_64 | |
run: | | |
cd build_x86_64 | |
cmake --build . | |
- name: Configure Build with vcpkg for arm64 | |
run: | | |
mkdir -p build_arm64 | |
cd build_arm64 | |
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ | |
-DCMAKE_OSX_ARCHITECTURES="arm64" \ | |
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" | |
- name: Build Project for arm64 | |
run: | | |
cd build_arm64 | |
cmake --build . | |
- name: Combine the binaries into a universal binary | |
run: | | |
mkdir -p artifacts | |
lipo -create -output artifacts/shinysocks-macos \ | |
build_x86_64/bin/shinysocks \ | |
build_arm64/bin/shinysocks | |
- name: Verify Universal Binary | |
run: | | |
file artifacts/shinysocks-macos | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logfault-macos | |
path: artifacts/* | |
retention-days: 1 | |
- name: Upload Release Artifact | |
if: github.event_name == 'release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: artifacts/shinysocks-macos | |
name: shinysocks-macos | |
token: ${{ secrets.GITHUB_TOKEN }} |