Merge pull request #10351 from keszybz/meson-cpp-fixups

Meson c++-related fixups
This commit is contained in:
Yu Watanabe 2018-10-10 19:50:35 +09:00 committed by GitHub
commit 12a509e512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -27,6 +27,13 @@ substs = configuration_data()
substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
substs.set('PACKAGE_VERSION', meson.project_version())
want_ossfuzz = get_option('oss-fuzz')
want_libfuzzer = get_option('llvm-fuzz')
if want_ossfuzz and want_libfuzzer
error('only one of oss-fuzz and llvm-fuzz can be specified')
endif
fuzzer_build = want_ossfuzz or want_libfuzzer
#####################################################################
# Try to install the git pre-commit hook
@ -274,25 +281,18 @@ want_tests = get_option('tests')
slow_tests = want_tests != 'false' and get_option('slow-tests')
install_tests = get_option('install-tests')
cxx = find_program('c++', required : false)
cxx = find_program('c++', required : fuzzer_build)
if cxx.found()
# Used only for tests
add_languages('cpp')
cpp_cmd = ' '.join(meson.get_compiler('cpp').cmd_array())
cxx_cmd = ' '.join(meson.get_compiler('cpp').cmd_array())
else
cpp_cmd = ''
cxx_cmd = ''
endif
want_ossfuzz = get_option('oss-fuzz')
want_libfuzzer = get_option('llvm-fuzz')
fuzzer_build = want_ossfuzz or want_libfuzzer
if want_ossfuzz and want_libfuzzer
error('only one of oss-fuzz and llvm-fuzz can be specified')
endif
if want_libfuzzer
fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
endif
if want_ossfuzz
elif want_ossfuzz
fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
endif

View File

@ -9,7 +9,7 @@ sanitize_address = custom_target(
'fuzzers',
'-Db_lundef=false -Db_sanitize=address',
' '.join(cc.cmd_array()),
cpp_cmd])
cxx_cmd])
sanitizers = [['address', sanitize_address]]