meson: Change build options' name
This commit is contained in:
parent
39f49ac39f
commit
24bc513ea1
@ -47,25 +47,25 @@ libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'),
|
|||||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')]
|
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')]
|
||||||
|
|
||||||
# Explicit define legacy support
|
# Explicit define legacy support
|
||||||
add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(with_legacy_support),
|
add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level),
|
||||||
language: 'c')
|
language: 'c')
|
||||||
|
|
||||||
if with_legacy_support == 0
|
if legacy_level == 0
|
||||||
message('Legacy support: DISABLED')
|
message('Legacy support: DISABLED')
|
||||||
else
|
else
|
||||||
# See ZSTD_LEGACY_SUPPORT of lib/README.md
|
# See ZSTD_LEGACY_SUPPORT of lib/README.md
|
||||||
message('Enable legacy support back to version 0.@0@'.format(with_legacy_support))
|
message('Enable legacy support back to version 0.@0@'.format(legacy_level))
|
||||||
|
|
||||||
libzstd_includes += [ include_directories(join_paths(zstd_rootdir, 'lib/legacy')) ]
|
libzstd_includes += [ include_directories(join_paths(zstd_rootdir, 'lib/legacy')) ]
|
||||||
foreach i : [1, 2, 3, 4, 5, 6, 7]
|
foreach i : [1, 2, 3, 4, 5, 6, 7]
|
||||||
if with_legacy_support <= i
|
if legacy_level <= i
|
||||||
libzstd_sources += join_paths(zstd_rootdir, 'lib/legacy/zstd_v0@0@.c'.format(i))
|
libzstd_sources += join_paths(zstd_rootdir, 'lib/legacy/zstd_v0@0@.c'.format(i))
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libzstd_deps = []
|
libzstd_deps = []
|
||||||
if enable_multithread
|
if use_multi_thread
|
||||||
message('Enable multi-threading support')
|
message('Enable multi-threading support')
|
||||||
add_project_arguments('-DZSTD_MULTITHREAD', language: 'c')
|
add_project_arguments('-DZSTD_MULTITHREAD', language: 'c')
|
||||||
libzstd_deps = [ thread_dep ]
|
libzstd_deps = [ thread_dep ]
|
||||||
@ -93,7 +93,8 @@ endif
|
|||||||
libzstd_c_args += mingw_ansi_stdio_flags
|
libzstd_c_args += mingw_ansi_stdio_flags
|
||||||
|
|
||||||
libzstd_debug_cflags = []
|
libzstd_debug_cflags = []
|
||||||
if enable_debug and meson_buildtype == 'debug'
|
if use_debug
|
||||||
|
libzstd_c_args += '-DDEBUGLEVEL=@0@'.format(debug_level)
|
||||||
if cc_id == compiler_gcc or cc_id == compiler_clang
|
if cc_id == compiler_gcc or cc_id == compiler_clang
|
||||||
libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum',
|
libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum',
|
||||||
'-Wdeclaration-after-statement', '-Wstrict-prototypes',
|
'-Wdeclaration-after-statement', '-Wstrict-prototypes',
|
||||||
|
@ -15,7 +15,6 @@ project('zstd',
|
|||||||
'cpp_std=c++11',
|
'cpp_std=c++11',
|
||||||
'buildtype=release'],
|
'buildtype=release'],
|
||||||
version: '1.3.8',
|
version: '1.3.8',
|
||||||
# for install_man
|
|
||||||
meson_version: '>=0.47.0')
|
meson_version: '>=0.47.0')
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
@ -67,20 +66,23 @@ zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name())
|
|||||||
# Project options
|
# Project options
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
enable_debug = get_option('debug')
|
# Built-in options
|
||||||
default_library_type = get_option('default_library')
|
use_debug = get_option('debug')
|
||||||
meson_buildtype = get_option('buildtype')
|
|
||||||
with_legacy_support = get_option('with-legacy-support')
|
# Custom options
|
||||||
with_programs = get_option('with-programs')
|
debug_level = get_option('debug_level')
|
||||||
with_tests = get_option('with-tests')
|
legacy_level = get_option('legacy_level')
|
||||||
with_contrib = get_option('with-contrib')
|
use_backtrace = get_option('backtrace')
|
||||||
with_debug_level = get_option('with-debug-level')
|
use_static_runtime = get_option('static_runtime')
|
||||||
enable_multithread = get_option('enable-multithread')
|
|
||||||
enable_static_runtime = get_option('enable-static-runtime')
|
build_programs = get_option('build_programs')
|
||||||
enable_zlib = get_option('enable-zlib')
|
build_contrib = get_option('build_contrib')
|
||||||
enable_lzma = get_option('enable-lzma')
|
build_tests = get_option('build_tests')
|
||||||
enable_lz4 = get_option('enable-lz4')
|
|
||||||
enable_backtrace = get_option('enable-backtrace')
|
feature_multi_thread = get_option('multi_thread')
|
||||||
|
feature_zlib = get_option('zlib')
|
||||||
|
feature_lzma = get_option('lzma')
|
||||||
|
feature_lz4 = get_option('lz4')
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Helper scripts for Meson
|
# Helper scripts for Meson
|
||||||
@ -110,12 +112,16 @@ endif
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
libm_dep = cc.find_library('m', required: with_tests)
|
libm_dep = cc.find_library('m', required: build_tests)
|
||||||
thread_dep = dependency('threads', required: enable_multithread)
|
thread_dep = dependency('threads', required: feature_multi_thread)
|
||||||
|
use_multi_thread = thread_dep.found()
|
||||||
# Arguments in dependency should be equivalent to those passed to pkg-config
|
# Arguments in dependency should be equivalent to those passed to pkg-config
|
||||||
zlib_dep = dependency('zlib', required: enable_zlib)
|
zlib_dep = dependency('zlib', required: feature_zlib)
|
||||||
lzma_dep = dependency('liblzma', required: enable_lzma)
|
use_zlib = zlib_dep.found()
|
||||||
lz4_dep = dependency('liblz4', required: enable_lz4)
|
lzma_dep = dependency('liblzma', required: feature_lzma)
|
||||||
|
use_lzma = lzma_dep.found()
|
||||||
|
lz4_dep = dependency('liblz4', required: feature_lz4)
|
||||||
|
use_lz4 = lz4_dep.found()
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
@ -134,7 +140,7 @@ if [compiler_gcc, compiler_clang].contains(cc_id)
|
|||||||
add_project_arguments(cxx_compile_flags, language : 'cpp')
|
add_project_arguments(cxx_compile_flags, language : 'cpp')
|
||||||
elif cc_id == compiler_msvc
|
elif cc_id == compiler_msvc
|
||||||
msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
|
msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
|
||||||
if enable_multithread
|
if use_multi_thread
|
||||||
msvc_compile_flags += '/MP'
|
msvc_compile_flags += '/MP'
|
||||||
endif
|
endif
|
||||||
if enable_static_runtime
|
if enable_static_runtime
|
||||||
@ -149,14 +155,14 @@ endif
|
|||||||
|
|
||||||
subdir('lib')
|
subdir('lib')
|
||||||
|
|
||||||
if with_programs
|
if build_programs
|
||||||
subdir('programs')
|
subdir('programs')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_tests
|
if build_tests
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_contrib
|
if build_contrib
|
||||||
subdir('contrib')
|
subdir('contrib')
|
||||||
endif
|
endif
|
||||||
|
@ -8,25 +8,29 @@
|
|||||||
# in the COPYING file in the root directory of this source tree).
|
# in the COPYING file in the root directory of this source tree).
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
option('with-legacy-support', type: 'integer', min: 0, max: 7, value: '5',
|
# Read guidelines from https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
|
||||||
|
|
||||||
|
option('legacy_level', type: 'integer', min: 0, max: 7, value: '5',
|
||||||
description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+')
|
description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+')
|
||||||
option('with-programs', type: 'boolean', value: true,
|
option('debug_level', type: 'integer', min: 0, max: 9, value: 1,
|
||||||
description: 'Enable programs build')
|
|
||||||
option('with-contrib', type: 'boolean', value: false,
|
|
||||||
description: 'Enable contrib build')
|
|
||||||
option('with-tests', type: 'boolean', value: false,
|
|
||||||
description: 'Enable tests build')
|
|
||||||
option('with-debug-level', type: 'integer', min: 0, max: 9, value: 1, # Since 0.45.0
|
|
||||||
description: 'Enable run-time debug. See lib/common/debug.h')
|
description: 'Enable run-time debug. See lib/common/debug.h')
|
||||||
option('enable-multithread', type: 'boolean', value: true,
|
option('backtrace', type: 'boolean', value: false,
|
||||||
description: 'Enable multi-threading when pthread is detected')
|
description: 'Display a stack backtrace when execution generates a runtime exception')
|
||||||
option('enable-static-runtime', type: 'boolean', value: false,
|
option('static_runtime', type: 'boolean', value: false,
|
||||||
description: 'Link to static run-time libraries on MSVC')
|
description: 'Link to static run-time libraries on MSVC')
|
||||||
option('enable-zlib', type: 'boolean', value: false,
|
|
||||||
|
option('build_programs', type: 'boolean', value: true,
|
||||||
|
description: 'Enable programs build')
|
||||||
|
option('build_tests', type: 'boolean', value: false,
|
||||||
|
description: 'Enable tests build')
|
||||||
|
option('build_contrib', type: 'boolean', value: false,
|
||||||
|
description: 'Enable contrib build')
|
||||||
|
|
||||||
|
option('multi_thread', type: 'feature', value: 'enabled',
|
||||||
|
description: 'Enable multi-threading when pthread is detected')
|
||||||
|
option('zlib', type: 'feature', value: 'auto',
|
||||||
description: 'Enable zlib support')
|
description: 'Enable zlib support')
|
||||||
option('enable-lzma', type: 'boolean', value: false,
|
option('lzma', type: 'feature', value: 'auto',
|
||||||
description: 'Enable lzma support')
|
description: 'Enable lzma support')
|
||||||
option('enable-lz4', type: 'boolean', value: false,
|
option('lz4', type: 'feature', value: 'auto',
|
||||||
description: 'Enable lz4 support')
|
description: 'Enable lz4 support')
|
||||||
option('enable-backtrace', type: 'boolean', value: false,
|
|
||||||
description: 'Display a stack backtrace when execution generates a runtime exception. Only in debug build mode.')
|
|
||||||
|
@ -19,31 +19,31 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
|
|||||||
join_paths(zstd_rootdir, 'programs/dibio.c')]
|
join_paths(zstd_rootdir, 'programs/dibio.c')]
|
||||||
|
|
||||||
zstd_c_args = libzstd_debug_cflags
|
zstd_c_args = libzstd_debug_cflags
|
||||||
if enable_multithread
|
if use_multi_thread
|
||||||
zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
|
zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
zstd_deps = [ libzstd_dep ]
|
zstd_deps = [ libzstd_dep ]
|
||||||
if enable_zlib and zlib_dep.found()
|
if use_zlib
|
||||||
zstd_deps += [ zlib_dep ]
|
zstd_deps += [ zlib_dep ]
|
||||||
zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
|
zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if enable_lzma and lzma_dep.found()
|
if use_lzma
|
||||||
zstd_deps += [ lzma_dep ]
|
zstd_deps += [ lzma_dep ]
|
||||||
zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
|
zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if enable_lz4 and lz4_dep.found()
|
if use_lz4
|
||||||
zstd_deps += [ lz4_dep ]
|
zstd_deps += [ lz4_dep ]
|
||||||
zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
|
zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export_dynamic_on_windows = false
|
export_dynamic_on_windows = false
|
||||||
# explicit backtrace enable/disable for Linux & Darwin
|
# explicit backtrace enable/disable for Linux & Darwin
|
||||||
if not enable_backtrace
|
if not use_backtrace
|
||||||
zstd_c_args += '-DBACKTRACE_ENABLE=0'
|
zstd_c_args += '-DBACKTRACE_ENABLE=0'
|
||||||
elif enable_debug and host_machine_os == os_windows # MinGW target
|
elif use_debug and host_machine_os == os_windows # MinGW target
|
||||||
zstd_c_args += '-DBACKTRACE_ENABLE=1'
|
zstd_c_args += '-DBACKTRACE_ENABLE=1'
|
||||||
export_dynamic_on_windows = true
|
export_dynamic_on_windows = true
|
||||||
endif
|
endif
|
||||||
@ -86,7 +86,7 @@ InstallSymlink_py = '../InstallSymlink.py'
|
|||||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdcat', zstd_bindir)
|
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdcat', zstd_bindir)
|
||||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'unzstd', zstd_bindir)
|
meson.add_install_script(InstallSymlink_py, 'zstd', 'unzstd', zstd_bindir)
|
||||||
|
|
||||||
if enable_multithread
|
if use_multi_thread
|
||||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdmt', zstd_bindir)
|
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdmt', zstd_bindir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -105,6 +105,6 @@ install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
|
|||||||
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'zstdcat.1.gz', zstd_man1_dir)
|
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'zstdcat.1.gz', zstd_man1_dir)
|
||||||
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'unzstd.1.gz', zstd_man1_dir)
|
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'unzstd.1.gz', zstd_man1_dir)
|
||||||
|
|
||||||
if enable_multithread
|
if use_multi_thread
|
||||||
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'zstdmt.1.gz', zstd_man1_dir)
|
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'zstdmt.1.gz', zstd_man1_dir)
|
||||||
endif
|
endif
|
||||||
|
@ -139,7 +139,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 ],
|
dependencies: [ libzstd_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')]
|
||||||
@ -177,7 +177,7 @@ test('test-fullbench-1', fullbench, args: ['-i1'],
|
|||||||
test('test-fullbench-2', fullbench, args: ['-i1', '-P0'],
|
test('test-fullbench-2', fullbench, args: ['-i1', '-P0'],
|
||||||
depends: [fullbench, datagen])
|
depends: [fullbench, datagen])
|
||||||
|
|
||||||
if enable_zlib
|
if use_zlib
|
||||||
test('test-fuzzer', fuzzer, args: ['-v', FUZZERTEST] + FUZZER_FLAGS)
|
test('test-fuzzer', fuzzer, args: ['-v', FUZZERTEST] + FUZZER_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user