diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/frameworks/1 boost/meson.build | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/1 boost/meson.build')
-rw-r--r-- | meson/test cases/frameworks/1 boost/meson.build | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/1 boost/meson.build b/meson/test cases/frameworks/1 boost/meson.build new file mode 100644 index 000000000..83570f09f --- /dev/null +++ b/meson/test cases/frameworks/1 boost/meson.build @@ -0,0 +1,72 @@ +# this test requires the following on Ubuntu: libboost-{system,python,log,thread,test}-dev +project('boosttest', 'cpp', + default_options : ['cpp_std=c++14']) + +s = get_option('static') + +dep = dependency('boost', static: s, required: false) +if not dep.found() + error('MESON_SKIP_TEST boost not found.') +endif + +# We want to have multiple separate configurations of Boost +# within one project. The need to be independent of each other. +# Use one without a library dependency and one with it. + +linkdep = dependency('boost', static: s, modules : ['thread', 'system', 'date_time']) +testdep = dependency('boost', static: s, modules : ['unit_test_framework']) +nomoddep = dependency('boost', static: s) +extralibdep = dependency('boost', static: s, modules : ['thread', 'system', 'date_time', 'log_setup', 'log', 'filesystem', 'regex']) +notfound = dependency('boost', static: s, modules : ['this_should_not_exist_on_any_systen'], required: false) + +assert(not notfound.found()) + +pymod = import('python') +python2 = pymod.find_installation('python2', required: false , disabler: true) +python3 = pymod.find_installation('python3', required: host_machine.system() == 'linux', disabler: true) +python2dep = python2.dependency(required: false , embed: true, disabler: true) +python3dep = python3.dependency(required: host_machine.system() == 'linux', embed: true, disabler: true) + +# compile python 2/3 modules only if we found a corresponding python version +if(python2dep.found() and host_machine.system() == 'linux' and not s) + bpython2dep = dependency('boost', static: s, modules : ['python'], required: false, disabler: true) +else + python2dep = disabler() + bpython2dep = disabler() +endif + +if(python3dep.found() and host_machine.system() == 'linux' and not s) + bpython3dep = dependency('boost', static: s, modules : ['python3']) +else + python3dep = disabler() + bpython3dep = disabler() +endif + +linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) +unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) +nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep) +extralibexe = executable('extralibexe', 'extralib.cpp', dependencies : extralibdep) + +# python modules are shared libraries +python2module = shared_library('python2_module', ['python_module.cpp'], dependencies: [python2dep, bpython2dep], name_prefix: '', cpp_args: ['-DMOD_NAME=python2_module']) +python3module = shared_library('python3_module', ['python_module.cpp'], dependencies: [python3dep, bpython3dep], name_prefix: '', cpp_args: ['-DMOD_NAME=python3_module']) + +test('Boost linktest', linkexe, timeout: 60) +test('Boost UTF test', unitexe, timeout: 60) +test('Boost nomod', nomodexe) +if host_machine.system() != 'darwin' or s + # Segfaults on macOS with dynamic linking since Boost 1.73 + # https://github.com/mesonbuild/meson/issues/7535 + test('Boost extralib test', extralibexe) +endif + +# explicitly use the correct python interpreter so that we don't have to provide two different python scripts that have different shebang lines +python2interpreter = find_program(python2.path(), required: false, disabler: true) +test('Boost Python2', python2interpreter, args: ['./test_python_module.py', meson.current_build_dir()], workdir: meson.current_source_dir(), depends: python2module) +python3interpreter = find_program(python3.path(), required: false, disabler: true) +test('Boost Python3', python3interpreter, args: ['./test_python_module.py', meson.current_build_dir()], workdir: meson.current_source_dir(), depends: python3module) + +subdir('partial_dep') + +# check we can apply a version constraint +dependency('boost', static: s, version: '>=@0@'.format(dep.version())) |