From 8c5caefdac3768542a7b5bbe17fdbf350bdf5c8a Mon Sep 17 00:00:00 2001 From: Tomasz Rudzki Date: Tue, 21 Jul 2026 22:30:13 +0100 Subject: [PATCH 1/2] Add Windows compatibility to the CMake build Guard the libm link in the examples (MSVC has no separate math library) and export all symbols when building oar as a DLL so an import library is generated. --- CMakeLists.txt | 4 ++++ tests/examples/CMakeLists.txt | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe432aa..677ba5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/tests/examples/CMakeLists.txt b/tests/examples/CMakeLists.txt index 2fdd5e5..99ab931 100644 --- a/tests/examples/CMakeLists.txt +++ b/tests/examples/CMakeLists.txt @@ -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() From d86fc101720a162a8cc574b8443c5c19e70fe0f6 Mon Sep 17 00:00:00 2001 From: Tomasz Rudzki Date: Tue, 21 Jul 2026 22:30:13 +0100 Subject: [PATCH 2/2] Add GitHub Actions CI workflow Build the library (shared and static) with examples on Linux, macOS and Windows, run the example programs as smoke tests, and run the obr unit tests via ctest. --- .github/workflows/ci-cmake.yml | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci-cmake.yml diff --git a/.github/workflows/ci-cmake.yml b/.github/workflows/ci-cmake.yml new file mode 100644 index 0000000..c075919 --- /dev/null +++ b/.github/workflows/ci-cmake.yml @@ -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