Build dependencies #254
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 dependencies | |
on: | |
workflow_dispatch: | |
jobs: | |
compile: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
triplet: x64-windows-static | |
- os: macos-13 | |
triplet: x64-osx | |
- os: ubuntu-latest | |
triplet: x64-linux | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up nasm | |
if: matrix.os != 'windows-latest' | |
uses: ilammy/setup-nasm@v1 | |
- name: Set up vcpkg | |
shell: bash | |
run: | | |
git clone https://github.com/Microsoft/vcpkg.git | |
./vcpkg/bootstrap-vcpkg.sh | |
- name: Configure project (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
cmake -B library\src\main\cpp\build -S library\src\main\cpp ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake ^ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Configure project (macOS) | |
if: matrix.os == 'macos-13' | |
shell: bash | |
run: | | |
cmake -B library/src/main/cpp/build -S library/src/main/cpp \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Configure project (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
cmake -B library/src/main/cpp/build -S library/src/main/cpp \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic" \ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Build project (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
cmake --build library\src\main\cpp\build --config Release --parallel | |
- name: Build project (non-Windows) | |
if: matrix.os != 'windows-latest' | |
shell: bash | |
run: | | |
cmake --build library/src/main/cpp/build --config Release --parallel | |
- name: Upload artifact (Windows) | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.triplet }} | |
path: ${{ github.workspace }}\library\src\main\cpp\build\Release\klarity.dll | |
- name: Upload artifact (macOS) | |
if: matrix.os == 'macos-13' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.triplet }} | |
path: ${{ github.workspace }}/library/src/main/cpp/build/libklarity.dylib | |
- name: Upload artifact (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.triplet }} | |
path: ${{ github.workspace }}/library/src/main/cpp/build/libklarity.so |