Merge pull request #2746 from eli-schwartz/meson-fixup

meson fixups
This commit is contained in:
Yann Collet 2021-08-23 15:57:47 -07:00 committed by GitHub
commit be82a0ab8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 43 deletions

View File

@ -18,7 +18,7 @@ pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')] join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')]
pzstd = executable('pzstd', pzstd = executable('pzstd',
pzstd_sources, pzstd_sources,
cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic', '-Wno-deprecated-declarations' ], cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-Wno-deprecated-declarations' ],
include_directories: pzstd_includes, include_directories: pzstd_includes,
dependencies: [ libzstd_dep, thread_dep ], dependencies: [ libzstd_dep, thread_dep ],
install: true) install: true)

View File

@ -108,6 +108,7 @@ libzstd = library('zstd',
libzstd_sources, libzstd_sources,
include_directories: libzstd_includes, include_directories: libzstd_includes,
c_args: libzstd_c_args, c_args: libzstd_c_args,
gnu_symbol_visibility: 'hidden',
dependencies: libzstd_deps, dependencies: libzstd_deps,
install: true, install: true,
version: zstd_libversion) version: zstd_libversion)

View File

@ -14,10 +14,14 @@ project('zstd',
default_options : [ default_options : [
'c_std=gnu99', 'c_std=gnu99',
'cpp_std=c++11', 'cpp_std=c++11',
'buildtype=release' 'buildtype=release',
'warning_level=3',
# -Wdocumentation does not actually pass, nor do the test binaries,
# so this isn't safe
#'werror=true'
], ],
version: 'DUMMY', version: 'DUMMY',
meson_version: '>=0.47.0') meson_version: '>=0.48.0')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp') cxx = meson.get_compiler('cpp')
@ -106,10 +110,8 @@ use_lz4 = lz4_dep.found()
add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c'])
if [compiler_gcc, compiler_clang].contains(cc_id) if [compiler_gcc, compiler_clang].contains(cc_id)
common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] common_warning_flags = [ '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ]
if cc_id == compiler_clang if cc_id == compiler_clang
# Should use Meson's own --werror build option
#common_warning_flags += '-Werror'
common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation'] common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation']
endif endif
cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes']) cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes'])

View File

@ -18,7 +18,9 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
join_paths(zstd_rootdir, 'programs/benchzstd.c'), join_paths(zstd_rootdir, 'programs/benchzstd.c'),
join_paths(zstd_rootdir, 'programs/datagen.c'), join_paths(zstd_rootdir, 'programs/datagen.c'),
join_paths(zstd_rootdir, 'programs/dibio.c'), join_paths(zstd_rootdir, 'programs/dibio.c'),
join_paths(zstd_rootdir, 'programs/zstdcli_trace.c')] join_paths(zstd_rootdir, 'programs/zstdcli_trace.c'),
# needed due to use of private symbol + -fvisibility=hidden
join_paths(zstd_rootdir, 'lib/common/xxhash.c')]
zstd_c_args = libzstd_debug_cflags zstd_c_args = libzstd_debug_cflags
if use_multi_thread if use_multi_thread

View File

@ -29,64 +29,62 @@ ZSTDRTTEST = ['--test-large-data']
test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ] test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ]
datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), testcommon_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
join_paths(zstd_rootdir, 'tests/datagencli.c')] join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'programs/benchfn.c'),
join_paths(zstd_rootdir, 'programs/benchzstd.c')]
testcommon = static_library('testcommon',
testcommon_sources,
# needed due to use of private symbol + -fvisibility=hidden
objects: libzstd.extract_all_objects(recursive: false))
testcommon_dep = declare_dependency(link_with: testcommon,
dependencies: libzstd_deps,
include_directories: libzstd_includes)
datagen_sources = [join_paths(zstd_rootdir, 'tests/datagencli.c')]
datagen = executable('datagen', datagen = executable('datagen',
datagen_sources, datagen_sources,
c_args: [ '-DNDEBUG' ], c_args: [ '-DNDEBUG' ],
include_directories: test_includes, include_directories: test_includes,
dependencies: libzstd_dep, dependencies: testcommon_dep,
install: false) install: false)
fullbench_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), fullbench_sources = [join_paths(zstd_rootdir, 'tests/fullbench.c')]
join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'programs/benchfn.c'),
join_paths(zstd_rootdir, 'programs/benchzstd.c'),
join_paths(zstd_rootdir, 'tests/fullbench.c')]
fullbench = executable('fullbench', fullbench = executable('fullbench',
fullbench_sources, fullbench_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: libzstd_dep, dependencies: testcommon_dep,
install: false) install: false)
fuzzer_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), fuzzer_sources = [join_paths(zstd_rootdir, 'tests/fuzzer.c')]
join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'tests/fuzzer.c')]
fuzzer = executable('fuzzer', fuzzer = executable('fuzzer',
fuzzer_sources, fuzzer_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: [ libzstd_dep, thread_dep ], dependencies: [ testcommon_dep, thread_dep ],
install: false) install: false)
zstreamtest_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), zstreamtest_sources = [join_paths(zstd_rootdir, 'tests/seqgen.c'),
join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'tests/seqgen.c'),
join_paths(zstd_rootdir, 'tests/zstreamtest.c')] join_paths(zstd_rootdir, 'tests/zstreamtest.c')]
zstreamtest = executable('zstreamtest', zstreamtest = executable('zstreamtest',
zstreamtest_sources, zstreamtest_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: libzstd_dep, dependencies: testcommon_dep,
install: false) install: false)
paramgrill_sources = [join_paths(zstd_rootdir, 'programs/benchfn.c'), paramgrill_sources = [join_paths(zstd_rootdir, 'tests/paramgrill.c')]
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'programs/benchzstd.c'),
join_paths(zstd_rootdir, 'programs/datagen.c'),
join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'tests/paramgrill.c')]
paramgrill = executable('paramgrill', paramgrill = executable('paramgrill',
paramgrill_sources, paramgrill_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: [ libzstd_dep, libm_dep ], dependencies: [ testcommon_dep, libm_dep ],
install: false) install: false)
roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')] roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')]
roundTripCrash = executable('roundTripCrash', roundTripCrash = executable('roundTripCrash',
roundTripCrash_sources, roundTripCrash_sources,
dependencies: [ libzstd_dep ], dependencies: [ testcommon_dep ],
install: false) install: false)
longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')] longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')]
@ -111,18 +109,14 @@ if 0 < legacy_level and legacy_level <= 4
install: false) install: false)
endif endif
decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'), decodecorpus_sources = [join_paths(zstd_rootdir, 'tests/decodecorpus.c')]
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'tests/decodecorpus.c')]
decodecorpus = executable('decodecorpus', decodecorpus = executable('decodecorpus',
decodecorpus_sources, decodecorpus_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: [ libzstd_dep, libm_dep ], dependencies: [ testcommon_dep, libm_dep ],
install: false) install: false)
poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'), poolTests_sources = [join_paths(zstd_rootdir, 'tests/poolTests.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),
join_paths(zstd_rootdir, 'tests/poolTests.c'),
join_paths(zstd_rootdir, 'lib/common/pool.c'), join_paths(zstd_rootdir, 'lib/common/pool.c'),
join_paths(zstd_rootdir, 'lib/common/threading.c'), join_paths(zstd_rootdir, 'lib/common/threading.c'),
join_paths(zstd_rootdir, 'lib/common/zstd_common.c'), join_paths(zstd_rootdir, 'lib/common/zstd_common.c'),
@ -130,7 +124,7 @@ poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
poolTests = executable('poolTests', poolTests = executable('poolTests',
poolTests_sources, poolTests_sources,
include_directories: test_includes, include_directories: test_includes,
dependencies: [ libzstd_dep, thread_dep ], dependencies: [ testcommon_dep, thread_dep ],
install: false) install: false)
checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')] checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')]