Skip to content

Commit

Permalink
Building tests is optional (#122)
Browse files Browse the repository at this point in the history
It's better to base the test-building condition on a command-line option
instead of the presence of Catch2. Building the tests is not necessary
for normal usage of redsea anyway.
  • Loading branch information
windytan committed Jan 1, 2025
1 parent 1600a9f commit 2bed407
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Install dependencies (brew)
run: brew install meson libsndfile liquid-dsp nlohmann-json catch2 perl gcovr
- name: meson setup
run: meson setup -Dwerror=true -Db_sanitize=address,undefined -Db_lundef=false -Db_coverage=true build
run: meson setup -Dwerror=true -Db_sanitize=address,undefined -Db_lundef=false -Db_coverage=true build -Dbuild_tests=true
- name: compile & install
run: cd build && meson install
- name: download test data
Expand Down
6 changes: 4 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ executable(
### Unit tests ###
##################

catch2 = dependency('catch2-with-main', required: false)
build_tests = get_option('build_tests')

if build_tests
catch2 = dependency('catch2-with-main', required: true)

if catch2.found()
unit_test_exe = executable(
'redsea-test-unit',
[
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('build_tests', type: 'boolean', value: false, description: 'Build unit tests (requires Catch2)')

0 comments on commit 2bed407

Please sign in to comment.