Build native #9
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 native | |
on: | |
workflow_dispatch: | |
jobs: | |
compile: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
triplet: x64-windows | |
binary_ext: dll | |
- os: ubuntu-latest | |
triplet: x64-linux | |
binary_ext: so | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up FFmpeg | |
uses: FedericoCarboni/setup-ffmpeg@v1 | |
id: setup-ffmpeg | |
- name: Build PortAudio | |
run: | | |
git clone https://github.com/PortAudio/portaudio.git | |
cd portaudio | |
git checkout v19.7.0 | |
cmake -B build -DPA_BUILD_SHARED=OFF -DPA_BUILD_STATIC=ON | |
cmake --build build --config Release | |
shell: bash | |
- name: Build klarity | |
run: | | |
cmake -S core/src/main/cpp -B build \ | |
-DFFMPEG_INCLUDE_DIRS="${{ steps.setup-ffmpeg.outputs.ffmpeg-root }}/include" \ | |
-DFFMPEG_LIBRARY_DIRS="${{ steps.setup-ffmpeg.outputs.ffmpeg-root }}/lib" \ | |
-DPORTAUDIO_INCLUDE_DIRS="${{ github.workspace }}/portaudio/include" \ | |
-DPORTAUDIO_LIBRARY_DIRS="${{ github.workspace }}/portaudio/build" | |
cmake --build build --config Release | |
shell: bash | |
- name: Find built shared library | |
id: find-lib | |
run: | | |
cd build | |
if [ -f libklarity.so ]; then echo "LIB_NAME=libklarity.so" >> $GITHUB_ENV; fi | |
if [ -f klarity.dll ]; then echo "LIB_NAME=klarity.dll" >> $GITHUB_ENV; fi | |
if [ -f libklarity.dylib ]; then echo "LIB_NAME=libklarity.dylib" >> $GITHUB_ENV; fi | |
shell: bash | |
- name: Upload shared library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: klarity-${{ matrix.os }} | |
path: build/${{ env.LIB_NAME }} |