Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CMake

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
library: [shared, static]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'

# CMAKE_Fortran_COMPILER=NOTFOUND stops Eigen's blas/ subdirectory from
# probing for a Fortran compiler (its check_language call skips the probe
# when the cache variable is already defined), which otherwise fails on
# Windows runners where MinGW gfortran is on the PATH alongside the MSVC
# toolchain.
- name: Configure
run: >
cmake -S . -B build
${{ runner.os == 'Windows' && '-G Ninja' || '' }}
-DOAR_BUILD_EXAMPLES=ON
-DOAR_BUILD_SHARED_LIBRARY=${{ matrix.library == 'shared' && 'ON' || 'OFF' }}
-DCMAKE_Fortran_COMPILER=NOTFOUND

- name: Build
run: cmake --build build --parallel

- name: Run smoke tests
shell: bash
run: |
export PATH="$PWD/build:$PATH"
./build/tests/examples/test_audio_element_types
./build/tests/examples/test_channel_based_rendering
./build/tests/examples/test_scene_based_rendering
./build/tests/examples/test_object_based_rendering

- name: Run obr unit tests
run: ctest --test-dir build/src/renderer/obr/obr_capi/obr -L obr --output-on-failure
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.28)
set(PROJECT_N oar)
project(${PROJECT_N} VERSION 1.0.0)

# Export all symbols when building oar as a DLL so an import library is
# generated for the examples to link against.
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
Expand Down
8 changes: 5 additions & 3 deletions tests/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ set_property(TARGET test_audio_element_types PROPERTY C_STANDARD 99)
set_property(TARGET test_channel_based_rendering PROPERTY C_STANDARD 99)
set_property(TARGET test_scene_based_rendering PROPERTY C_STANDARD 99)
set_property(TARGET test_object_based_rendering PROPERTY C_STANDARD 99)
target_link_libraries(test_channel_based_rendering PRIVATE m)
target_link_libraries(test_scene_based_rendering PRIVATE m)
target_link_libraries(test_object_based_rendering PRIVATE m)
if(NOT MSVC)
target_link_libraries(test_channel_based_rendering PRIVATE m)
target_link_libraries(test_scene_based_rendering PRIVATE m)
target_link_libraries(test_object_based_rendering PRIVATE m)
endif()
Loading