Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson subproject sample test control #78

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions example/api2-samples/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#libavcpp = subproject('avcpp')
#avcpp_dep = libavcpp.get_variable('avcpp_dep')

if not get_option('build_samples')
subdir_done()
endif

samples = [
'api2-decode',
'api2-decode-encode-video',
Expand Down
30 changes: 13 additions & 17 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
project(
'avcpp',
'cpp',
meson_version: '>= 0.50.0',
meson_version: '>= 0.54.0',
default_options : [
'c_std=c11',
'cpp_std=c++17'
'cpp_std=c++17',
'build_tests=@0@'.format(not meson.is_subproject()),
'build_samples=@0@'.format(not meson.is_subproject()),
],
version: '2.0.99',
)

if not meson.is_subproject()
subdir('src')
subdir('src')
subdir('example/api2-samples')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently has slight semantic difference, since meson will be visiting 'example/api2-samples' subdirectory, it will be created in build directory when using non flat layout. Dunno if this mkdir is a concern, or not, but guess I should mention it.

subdir('tests')

if get_option('build_samples')
subdir('example/api2-samples')
endif
meson.override_dependency('avcpp', avcpp_dep)

if get_option('build_tests')
subdir('tests')
endif
else
subdir('src')
endif

if meson.version().version_compare('>=0.54.0')
meson.override_dependency('avcpp', avcpp_dep)
endif
summary({
'Build samples' : get_option('build_samples'),
'Build tests' : get_option('build_tests')
}, section: 'Extra', bool_yn: true,
)
5 changes: 5 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#get catch2

if not get_option('build_tests')
subdir_done()
endif

catch2 = dependency('catch2', required: true, fallback:['catch2','catch2_dep'])

#create main_test as library and export the dependency
Expand Down