Skip to content

Commit

Permalink
meson: Allow tests to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Jan 14, 2025
1 parent 97ee9db commit 56792a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ if get_option('stemming')
endif
endif

if get_option('installed_tests') and not get_option('tests')
error('-Dinstalled_tests=true is incompatible with -Dtests=false')
endif

# use gperf for faster string -> enum matching
gperf = find_program('gperf')

Expand All @@ -227,7 +231,9 @@ subdir('po/')
subdir('data/')
subdir('contrib/')
subdir('docs/')
subdir('tests/')
if get_option('tests')
subdir('tests/')
endif
if get_option('qt')
subdir('qt/')
endif
10 changes: 10 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ option('install-docs',
value : true,
description : 'Install documentation for API and specification'
)
option('tests',
description: 'Build the test suite',
type: 'boolean',
value: true
)
option('installed_tests',
description: 'Install the test suite',
type: 'boolean',
value: true
)

#
# For development
Expand Down
4 changes: 3 additions & 1 deletion tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Meson definition for AppStream Tests

subdir('installed-tests/')
if get_option('installed_tests')
subdir('installed-tests/')
endif

as_test_env = []
as_test_args = [meson.current_source_dir()]
Expand Down

0 comments on commit 56792a2

Please sign in to comment.