Initial support for Windows build
This commit is contained in:
parent
2337429e8d
commit
0a0683f5b2
@ -7,27 +7,23 @@
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# #############################################################################
|
||||
|
||||
zstd_source_dir = join_paths('..', '..', '..', '..')
|
||||
library_dir = join_paths(zstd_source_dir, 'lib')
|
||||
library_common_dir = join_paths(library_dir, 'common')
|
||||
programs_dir = join_paths(zstd_source_dir, 'programs')
|
||||
contrib_gen_html_dir = join_paths(zstd_source_dir, 'contrib', 'gen_html')
|
||||
zstd_rootdir = '../../../..'
|
||||
|
||||
gen_html_includes = include_directories(programs_dir,
|
||||
library_dir,
|
||||
library_common_dir,
|
||||
contrib_gen_html_dir)
|
||||
gen_html_includes = include_directories(join_paths(zstd_rootdir, 'programs'),
|
||||
join_paths(zstd_rootdir, 'lib'),
|
||||
join_paths(zstd_rootdir, 'lib/common'),
|
||||
join_paths(zstd_rootdir, 'contrib/gen_html'))
|
||||
|
||||
gen_html = executable('gen_html',
|
||||
join_paths(contrib_gen_html_dir, 'gen_html.cpp'),
|
||||
include_directories: gen_html_includes,
|
||||
install: false)
|
||||
join_paths(zstd_rootdir, 'contrib/gen_html/gen_html.cpp'),
|
||||
include_directories: gen_html_includes,
|
||||
install: false)
|
||||
|
||||
# Update zstd manual
|
||||
zstd_manual_html = custom_target('zstd_manual.html',
|
||||
output : 'zstd_manual.html',
|
||||
command : [gen_html,
|
||||
zstd_version,
|
||||
join_paths(meson.current_source_dir(), library_dir, 'zstd.h'),
|
||||
'@OUTPUT@'],
|
||||
install : false)
|
||||
output : 'zstd_manual.html',
|
||||
command : [gen_html,
|
||||
zstd_version,
|
||||
join_paths(meson.current_source_dir(), join_paths(zstd_rootdir, 'lib/zstd.h')),
|
||||
'@OUTPUT@'],
|
||||
install : false)
|
||||
|
@ -7,26 +7,18 @@
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# #############################################################################
|
||||
|
||||
zstd_source_dir = join_paths('..', '..', '..', '..')
|
||||
library_dir = join_paths(zstd_source_dir, 'lib')
|
||||
library_common_dir = join_paths(library_dir, 'common')
|
||||
programs_dir = join_paths(zstd_source_dir, 'programs')
|
||||
contrib_pzstd_dir = join_paths(zstd_source_dir, 'contrib', 'pzstd')
|
||||
|
||||
pzstd_includes = include_directories(programs_dir,
|
||||
library_dir,
|
||||
library_common_dir,
|
||||
contrib_pzstd_dir)
|
||||
pzstd_sources = [join_paths(programs_dir, 'util.c'),
|
||||
join_paths(contrib_pzstd_dir, 'main.cpp'),
|
||||
join_paths(contrib_pzstd_dir, 'Options.cpp'),
|
||||
join_paths(contrib_pzstd_dir, 'Pzstd.cpp'),
|
||||
join_paths(contrib_pzstd_dir, 'SkippableFrame.cpp')]
|
||||
zstd_rootdir = '../../../..'
|
||||
|
||||
pzstd_includes = include_directories(join_paths(zstd_rootdir, 'programs'),
|
||||
join_paths(zstd_rootdir, 'contrib/pzstd'))
|
||||
pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
|
||||
join_paths(zstd_rootdir, 'contrib/pzstd/main.cpp'),
|
||||
join_paths(zstd_rootdir, 'contrib/pzstd/Options.cpp'),
|
||||
join_paths(zstd_rootdir, 'contrib/pzstd/Pzstd.cpp'),
|
||||
join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')]
|
||||
pzstd = executable('pzstd',
|
||||
pzstd_sources,
|
||||
cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ],
|
||||
include_directories: pzstd_includes,
|
||||
link_with: libzstd,
|
||||
dependencies: [ thread_dep ],
|
||||
install: true)
|
||||
pzstd_sources,
|
||||
cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ],
|
||||
include_directories: pzstd_includes,
|
||||
dependencies: [ libzstd_dep, thread_dep ],
|
||||
install: true)
|
||||
|
@ -8,113 +8,121 @@
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# #############################################################################
|
||||
|
||||
zstd_source_dir = join_paths('..', '..', '..')
|
||||
library_dir = join_paths(zstd_source_dir, 'lib')
|
||||
library_common_dir = join_paths(library_dir, 'common')
|
||||
library_compress_dir = join_paths(library_dir, 'compress')
|
||||
library_decompress_dir = join_paths(library_dir, 'decompress')
|
||||
library_dictbuilder_dir = join_paths(library_dir, 'dictBuilder')
|
||||
library_deprecated_dir = join_paths(library_dir, 'deprecated')
|
||||
library_legacy_dir = join_paths(library_dir, 'legacy')
|
||||
zstd_rootdir = '../../..'
|
||||
|
||||
libzstd_includes = [include_directories(library_dir,
|
||||
library_common_dir,
|
||||
library_compress_dir,
|
||||
library_decompress_dir,
|
||||
library_dictbuilder_dir,
|
||||
library_deprecated_dir)]
|
||||
libzstd_includes = [include_directories(join_paths(zstd_rootdir,'lib'),
|
||||
join_paths(zstd_rootdir, 'lib/common'),
|
||||
join_paths(zstd_rootdir, 'lib/compress'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated'))]
|
||||
|
||||
libzstd_sources = [join_paths(library_common_dir, 'entropy_common.c'),
|
||||
join_paths(library_common_dir, 'fse_decompress.c'),
|
||||
join_paths(library_common_dir, 'threading.c'),
|
||||
join_paths(library_common_dir, 'pool.c'),
|
||||
join_paths(library_common_dir, 'zstd_common.c'),
|
||||
join_paths(library_common_dir, 'error_private.c'),
|
||||
join_paths(library_common_dir, 'xxhash.c'),
|
||||
join_paths(library_compress_dir, 'hist.c'),
|
||||
join_paths(library_compress_dir, 'fse_compress.c'),
|
||||
join_paths(library_compress_dir, 'huf_compress.c'),
|
||||
join_paths(library_compress_dir, 'zstd_compress.c'),
|
||||
join_paths(library_compress_dir, 'zstdmt_compress.c'),
|
||||
join_paths(library_compress_dir, 'zstd_fast.c'),
|
||||
join_paths(library_compress_dir, 'zstd_double_fast.c'),
|
||||
join_paths(library_compress_dir, 'zstd_lazy.c'),
|
||||
join_paths(library_compress_dir, 'zstd_opt.c'),
|
||||
join_paths(library_compress_dir, 'zstd_ldm.c'),
|
||||
join_paths(library_decompress_dir, 'huf_decompress.c'),
|
||||
join_paths(library_decompress_dir, 'zstd_decompress.c'),
|
||||
join_paths(library_decompress_dir, 'zstd_decompress_block.c'),
|
||||
join_paths(library_decompress_dir, 'zstd_ddict.c'),
|
||||
join_paths(library_dictbuilder_dir, 'cover.c'),
|
||||
join_paths(library_dictbuilder_dir, 'fastcover.c'),
|
||||
join_paths(library_dictbuilder_dir, 'divsufsort.c'),
|
||||
join_paths(library_dictbuilder_dir, 'zdict.c'),
|
||||
join_paths(library_deprecated_dir, 'zbuff_common.c'),
|
||||
join_paths(library_deprecated_dir, 'zbuff_compress.c'),
|
||||
join_paths(library_deprecated_dir, 'zbuff_decompress.c')]
|
||||
libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/fse_decompress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/threading.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/pool.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/zstd_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/error_private.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/xxhash.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/hist.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/fse_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/huf_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstdmt_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_fast.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_double_fast.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_lazy.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_opt.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/zstd_ldm.c'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress/huf_decompress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress_block.c'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress/zstd_ddict.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/cover.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/fastcover.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/divsufsort.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')]
|
||||
|
||||
if with_legacy_support == '0'
|
||||
with_legacy_support = 'false'
|
||||
endif
|
||||
if with_legacy_support != 'false'
|
||||
if with_legacy_support == 'true'
|
||||
with_legacy_support = '5'
|
||||
endif
|
||||
legacy_int = with_legacy_support.to_int()
|
||||
if legacy_int < 0 or legacy_int >= 8
|
||||
legacy_int = 0
|
||||
endif
|
||||
add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_int),
|
||||
language: 'c')
|
||||
libzstd_includes += [ include_directories(library_legacy_dir) ]
|
||||
# See ZSTD_LEGACY_SUPPORT of lib/README.md
|
||||
message('Enable legacy support back to version 0.@0@'.format(legacy_int))
|
||||
if legacy_int <= 1
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v01.c')
|
||||
endif
|
||||
if legacy_int <= 2
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v02.c')
|
||||
endif
|
||||
if legacy_int <= 3
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v03.c')
|
||||
endif
|
||||
if legacy_int <= 4
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v04.c')
|
||||
endif
|
||||
if legacy_int <= 5
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v05.c')
|
||||
endif
|
||||
if legacy_int <= 6
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v06.c')
|
||||
endif
|
||||
if legacy_int <= 7
|
||||
libzstd_sources += join_paths(library_legacy_dir, 'zstd_v07.c')
|
||||
endif
|
||||
endif
|
||||
# Explicit define legacy support
|
||||
add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(with_legacy_support),
|
||||
language: 'c')
|
||||
|
||||
if enable_multithread
|
||||
message('Enable multi-threading support')
|
||||
add_project_arguments('-DZSTD_MULTITHREAD', language: 'c')
|
||||
libzstd_deps = [ thread_dep ]
|
||||
if with_legacy_support == 0
|
||||
message('Legacy support: DISABLED')
|
||||
else
|
||||
libzstd_deps = []
|
||||
# See ZSTD_LEGACY_SUPPORT of lib/README.md
|
||||
message('Enable legacy support back to version 0.@0@'.format(with_legacy_support))
|
||||
|
||||
libzstd_includes += [ include_directories(join_paths(zstd_rootdir, 'lib/legacy')) ]
|
||||
foreach i : [1, 2, 3, 4, 5, 6, 7]
|
||||
if with_legacy_support <= i
|
||||
libzstd_sources += join_paths(zstd_rootdir, 'lib/legacy/zstd_v0@0@.c'.format(i))
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
||||
libzstd_deps = []
|
||||
if enable_multithread
|
||||
message('Enable multi-threading support')
|
||||
add_project_arguments('-DZSTD_MULTITHREAD', language: 'c')
|
||||
libzstd_deps = [ thread_dep ]
|
||||
endif
|
||||
|
||||
libzstd_c_args = []
|
||||
if cc_id == compiler_msvc
|
||||
if default_library_type != 'static'
|
||||
libzstd_sources += [windows_mod.compile_resources(
|
||||
join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'))]
|
||||
libzstd_c_args += ['-DZSTD_DLL_EXPORT=1',
|
||||
'-DZSTD_HEAPMODE=0',
|
||||
'-D_CONSOLE',
|
||||
'-D_CRT_SECURE_NO_WARNINGS']
|
||||
else
|
||||
libzstd_c_args += ['-DZSTD_HEAPMODE=0',
|
||||
'-D_CRT_SECURE_NO_WARNINGS']
|
||||
endif
|
||||
endif
|
||||
|
||||
mingw_ansi_stdio_flags = []
|
||||
if host_machine_os == os_windows and cc_id == compiler_gcc
|
||||
mingw_ansi_stdio_flags = [ '-D__USE_MINGW_ANSI_STDIO' ]
|
||||
endif
|
||||
libzstd_c_args += mingw_ansi_stdio_flags
|
||||
|
||||
libzstd_debug_cflags = []
|
||||
if enable_debug and meson_buildtype == 'debug'
|
||||
if cc_id == compiler_gcc or cc_id == compiler_clang
|
||||
libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum',
|
||||
'-Wdeclaration-after-statement', '-Wstrict-prototypes',
|
||||
'-Wundef', '-Wpointer-arith', '-Wformat-security', '-Wvla',
|
||||
'-Wformat=2', '-Winit-self', '-Wfloat-equal', '-Wwrite-strings',
|
||||
'-Wredundant-decls', '-Wmissing-prototypes', '-Wc++-compat']
|
||||
endif
|
||||
endif
|
||||
libzstd_c_args += cc.get_supported_arguments(libzstd_debug_cflags)
|
||||
|
||||
libzstd = library('zstd',
|
||||
libzstd_sources,
|
||||
include_directories: libzstd_includes,
|
||||
dependencies: libzstd_deps,
|
||||
install: true,
|
||||
soversion: zstd_version)
|
||||
libzstd_sources,
|
||||
include_directories: libzstd_includes,
|
||||
c_args: libzstd_c_args,
|
||||
dependencies: libzstd_deps,
|
||||
install: true,
|
||||
soversion: zstd_libversion)
|
||||
|
||||
libzstd_dep = declare_dependency(link_with: libzstd,
|
||||
include_directories: libzstd_includes)
|
||||
|
||||
pkgconfig.generate(name: 'libzstd',
|
||||
filebase: 'libzstd',
|
||||
libraries: [libzstd],
|
||||
description: 'fast lossless compression algorithm library',
|
||||
version: zstd_version,
|
||||
url: 'http://www.zstd.net/')
|
||||
filebase: 'libzstd',
|
||||
libraries: [libzstd],
|
||||
description: 'fast lossless compression algorithm library',
|
||||
version: zstd_libversion,
|
||||
url: 'http://www.zstd.net/')
|
||||
|
||||
install_headers(join_paths(library_dir, 'zstd.h'),
|
||||
join_paths(library_deprecated_dir, 'zbuff.h'),
|
||||
join_paths(library_dictbuilder_dir, 'zdict.h'),
|
||||
join_paths(library_common_dir, 'zstd_errors.h'))
|
||||
install_headers(join_paths(zstd_rootdir, 'lib/zstd.h'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff.h'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.h'),
|
||||
join_paths(zstd_rootdir, 'lib/common/zstd_errors.h'))
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
project('zstd',
|
||||
['c', 'cpp'],
|
||||
license: 'BSD',
|
||||
license: ['BSD', 'GPLv2'],
|
||||
default_options : ['c_std=c99',
|
||||
'cpp_std=c++11',
|
||||
'buildtype=release'],
|
||||
@ -22,36 +22,65 @@ cc = meson.get_compiler('c')
|
||||
cxx = meson.get_compiler('cpp')
|
||||
pkgconfig = import('pkgconfig')
|
||||
python3 = import('python').find_installation()
|
||||
windows_mod = import('windows')
|
||||
|
||||
host_machine_os = host_machine.system()
|
||||
os_windows = 'windows'
|
||||
os_linux = 'linux'
|
||||
os_darwin = 'darwin'
|
||||
os_freebsd = 'freebsd'
|
||||
os_sun = 'sunos'
|
||||
|
||||
cc_id = cc.get_id()
|
||||
compiler_gcc = 'gcc'
|
||||
compiler_clang = 'clang'
|
||||
compiler_msvc = 'msvc'
|
||||
|
||||
zstd_version = meson.project_version()
|
||||
zstd_libversion = ''
|
||||
|
||||
# =============================================================================
|
||||
# Project directories
|
||||
# =============================================================================
|
||||
|
||||
zstd_prefix = get_option('prefix')
|
||||
zstd_bindir = join_paths(zstd_prefix, get_option('bindir'))
|
||||
zstd_datadir = join_paths(zstd_prefix, get_option('datadir'))
|
||||
zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name())
|
||||
zstd_mandir = join_paths(zstd_prefix, get_option('mandir'))
|
||||
zstd_rootdir = '../..'
|
||||
|
||||
zstd_source_dir = join_paths('..', '..')
|
||||
library_dir = join_paths(zstd_source_dir, 'lib')
|
||||
contrib_meson_dir = join_paths(zstd_source_dir, 'contrib', 'meson')
|
||||
# =============================================================================
|
||||
# Installing directories
|
||||
# =============================================================================
|
||||
|
||||
if host_machine_os == os_windows
|
||||
zstd_prefix = '.'
|
||||
zstd_bindir = 'bin'
|
||||
zstd_datadir = 'share'
|
||||
zstd_mandir = join_paths(zstd_datadir, 'man')
|
||||
else
|
||||
zstd_prefix = get_option('prefix')
|
||||
zstd_bindir = join_paths(zstd_prefix, get_option('bindir'))
|
||||
zstd_datadir = join_paths(zstd_prefix, get_option('datadir'))
|
||||
zstd_mandir = join_paths(zstd_prefix, get_option('mandir'))
|
||||
endif
|
||||
|
||||
zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name())
|
||||
|
||||
# =============================================================================
|
||||
# Project options
|
||||
# =============================================================================
|
||||
|
||||
enable_debug = get_option('debug')
|
||||
default_library_type = get_option('default_library')
|
||||
meson_buildtype = get_option('buildtype')
|
||||
with_legacy_support = get_option('with-legacy-support')
|
||||
with_programs = get_option('with-programs')
|
||||
with_tests = get_option('with-tests')
|
||||
with_contrib = get_option('with-contrib')
|
||||
with_debug_level = get_option('with-debug-level')
|
||||
enable_multithread = get_option('enable-multithread')
|
||||
enable_static_runtime = get_option('enable-static-runtime')
|
||||
enable_zlib = get_option('enable-zlib')
|
||||
enable_lzma = get_option('enable-lzma')
|
||||
enable_lz4 = get_option('enable-lz4')
|
||||
enable_backtrace = get_option('enable-backtrace')
|
||||
|
||||
# =============================================================================
|
||||
# Helper scripts for Meson
|
||||
@ -63,7 +92,7 @@ GetZstdLibraryVersion_py = files('GetZstdLibraryVersion.py')
|
||||
# Getting project version from zstd.h
|
||||
# =============================================================================
|
||||
|
||||
zstd_h_file = join_paths(meson.current_source_dir(), library_dir, 'zstd.h')
|
||||
zstd_h_file = join_paths(meson.current_source_dir(), zstd_rootdir, 'lib/zstd.h')
|
||||
r = run_command(python3, GetZstdLibraryVersion_py, zstd_h_file)
|
||||
if r.returncode() == 0
|
||||
output = r.stdout().strip()
|
||||
@ -73,31 +102,42 @@ if r.returncode() == 0
|
||||
endif
|
||||
endif
|
||||
|
||||
if host_machine_os != os_windows
|
||||
zstd_libversion = zstd_version
|
||||
endif
|
||||
|
||||
# =============================================================================
|
||||
# Dependencies
|
||||
# =============================================================================
|
||||
|
||||
libm_dep = cc.find_library('m', required: true)
|
||||
thread_dep = dependency('threads', required: false)
|
||||
libm_dep = cc.find_library('m', required: with_tests)
|
||||
thread_dep = dependency('threads', required: enable_multithread)
|
||||
# Arguments in dependency should be equivalent to those passed to pkg-config
|
||||
zlib_dep = dependency('zlib', required: false)
|
||||
lzma_dep = dependency('liblzma', required: false)
|
||||
lz4_dep = dependency('liblz4', required: false)
|
||||
zlib_dep = dependency('zlib', required: enable_zlib)
|
||||
lzma_dep = dependency('liblzma', required: enable_lzma)
|
||||
lz4_dep = dependency('liblz4', required: enable_lz4)
|
||||
|
||||
# =============================================================================
|
||||
# Compiler flags
|
||||
# =============================================================================
|
||||
|
||||
if cxx.get_id() == 'gcc' or cxx.get_id() == 'clang'
|
||||
common_flags = [ '-DXXH_NAMESPACE=ZSTD_' ]
|
||||
add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: [ 'c' ])
|
||||
|
||||
if [compiler_gcc, compiler_clang].contains(cc_id)
|
||||
common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ]
|
||||
cc_compilation_flags = cc.get_supported_arguments(common_warning_flags)
|
||||
cc_compilation_flags += cc.get_supported_arguments(['-Wstrict-prototypes'])
|
||||
cc_compilation_flags += common_flags
|
||||
cxx_compilation_flags = cxx.get_supported_arguments(common_warning_flags)
|
||||
cxx_compilation_flags += common_flags
|
||||
add_project_arguments(cc_compilation_flags, language : 'c')
|
||||
add_project_arguments(cxx_compilation_flags, language : 'cpp')
|
||||
cc_compile_flags = cc.get_supported_arguments(common_warning_flags + [ '-Wstrict-prototypes' ])
|
||||
cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags)
|
||||
add_project_arguments(cc_compile_flags, language : 'c')
|
||||
add_project_arguments(cxx_compile_flags, language : 'cpp')
|
||||
elif cc_id == compiler_msvc
|
||||
msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
|
||||
if enable_multithread
|
||||
msvc_compile_flags += [ '/MP' ]
|
||||
endif
|
||||
if enable_static_runtime
|
||||
msvc_compile_flags += [ '/MT' ]
|
||||
endif
|
||||
add_project_arguments(msvc_compile_flags, language: ['c', 'cpp'])
|
||||
endif
|
||||
|
||||
# =============================================================================
|
||||
|
@ -8,21 +8,25 @@
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# #############################################################################
|
||||
|
||||
option('enable-multithread', type: 'boolean', value: true,
|
||||
description: 'Enable multi-threading when pthread is detected')
|
||||
option('with-legacy-support', type: 'string', value: '5',
|
||||
description: 'Support any legacy format: true or false, or 7 to 1 for v0.7+ to v0.1+')
|
||||
option('with-legacy-support', type: 'integer', min: 0, max: 7, value: '5',
|
||||
description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+')
|
||||
option('with-programs', type: 'boolean', value: true,
|
||||
description: 'Enable programs build')
|
||||
description: 'Enable programs build')
|
||||
option('with-contrib', type: 'boolean', value: false,
|
||||
description: 'Enable contrib build')
|
||||
description: 'Enable contrib build')
|
||||
option('with-tests', type: 'boolean', value: false,
|
||||
description: 'Enable tests build')
|
||||
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')
|
||||
option('enable-multithread', type: 'boolean', value: true,
|
||||
description: 'Enable multi-threading when pthread is detected')
|
||||
option('enable-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,
|
||||
description: 'Enable zlib support')
|
||||
description: 'Enable zlib support')
|
||||
option('enable-lzma', type: 'boolean', value: false,
|
||||
description: 'Enable lzma support')
|
||||
description: 'Enable lzma support')
|
||||
option('enable-lz4', type: 'boolean', value: false,
|
||||
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.')
|
||||
|
@ -8,74 +8,86 @@
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# #############################################################################
|
||||
|
||||
zstd_source_dir = join_paths('..', '..', '..')
|
||||
programs_dir = join_paths(zstd_source_dir, 'programs')
|
||||
zstd_rootdir = '../../..'
|
||||
|
||||
zstdcli_c_file = join_paths(programs_dir, 'zstdcli.c')
|
||||
util_c_file = join_paths(programs_dir, 'util.c')
|
||||
fileio_c_file = join_paths(programs_dir, 'fileio.c')
|
||||
zstd_programs_sources = [zstdcli_c_file,
|
||||
util_c_file,
|
||||
fileio_c_file,
|
||||
join_paths(programs_dir, 'benchfn.c'),
|
||||
join_paths(programs_dir, 'benchzstd.c'),
|
||||
join_paths(programs_dir, 'datagen.c'),
|
||||
join_paths(programs_dir, 'dibio.c')]
|
||||
zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
|
||||
join_paths(zstd_rootdir, 'programs/util.c'),
|
||||
join_paths(zstd_rootdir, 'programs/fileio.c'),
|
||||
join_paths(zstd_rootdir, 'programs/benchfn.c'),
|
||||
join_paths(zstd_rootdir, 'programs/benchzstd.c'),
|
||||
join_paths(zstd_rootdir, 'programs/datagen.c'),
|
||||
join_paths(zstd_rootdir, 'programs/dibio.c')]
|
||||
|
||||
zstd_c_args = []
|
||||
zstd_c_args = libzstd_debug_cflags
|
||||
if enable_multithread
|
||||
zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
|
||||
zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
|
||||
endif
|
||||
|
||||
zstd_deps = []
|
||||
zstd_deps = [ libzstd_dep ]
|
||||
if enable_zlib and zlib_dep.found()
|
||||
zstd_deps += [ zlib_dep ]
|
||||
zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
|
||||
zstd_deps += [ zlib_dep ]
|
||||
zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
|
||||
endif
|
||||
|
||||
if enable_lzma and lzma_dep.found()
|
||||
zstd_deps += [ lzma_dep ]
|
||||
zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
|
||||
zstd_deps += [ lzma_dep ]
|
||||
zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
|
||||
endif
|
||||
|
||||
if enable_lz4 and lz4_dep.found()
|
||||
zstd_deps += [ lz4_dep ]
|
||||
zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
|
||||
zstd_deps += [ lz4_dep ]
|
||||
zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
|
||||
endif
|
||||
|
||||
export_dynamic_on_windows = false
|
||||
# explicit backtrace enable/disable for Linux & Darwin
|
||||
if not enable_backtrace
|
||||
zstd_c_args += '-DBACKTRACE_ENABLE=0'
|
||||
elif enable_debug and host_machine_os == os_windows # MinGW target
|
||||
zstd_c_args += '-DBACKTRACE_ENABLE=1'
|
||||
export_dynamic_on_windows = true
|
||||
endif
|
||||
|
||||
if cc_id == compiler_msvc
|
||||
if default_library_type != 'static'
|
||||
zstd_programs_sources += [windows_mod.compile_resources(
|
||||
join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))]
|
||||
endif
|
||||
endif
|
||||
|
||||
zstd = executable('zstd',
|
||||
zstd_programs_sources,
|
||||
c_args: zstd_c_args,
|
||||
include_directories: libzstd_includes,
|
||||
link_with: libzstd,
|
||||
dependencies: zstd_deps,
|
||||
install: true)
|
||||
zstd_programs_sources,
|
||||
c_args: zstd_c_args,
|
||||
dependencies: zstd_deps,
|
||||
export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
|
||||
install: true)
|
||||
|
||||
zstd_frugal_sources = [join_paths(programs_dir, 'zstdcli.c'),
|
||||
util_c_file,
|
||||
fileio_c_file]
|
||||
zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
|
||||
join_paths(zstd_rootdir, 'programs/util.c'),
|
||||
join_paths(zstd_rootdir, 'programs/fileio.c')]
|
||||
|
||||
# Minimal target, with only zstd compression and decompression.
|
||||
# No bench. No legacy.
|
||||
executable('zstd-frugal',
|
||||
zstd_frugal_sources,
|
||||
include_directories: libzstd_includes,
|
||||
link_with: libzstd,
|
||||
c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ],
|
||||
install: true)
|
||||
zstd_frugal_sources,
|
||||
dependencies: libzstd_dep,
|
||||
c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ],
|
||||
install: true)
|
||||
|
||||
install_data(join_paths(programs_dir, 'zstdgrep'),
|
||||
join_paths(programs_dir, 'zstdless'),
|
||||
install_dir: zstd_bindir)
|
||||
install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'),
|
||||
join_paths(zstd_rootdir, 'programs/zstdless'),
|
||||
install_dir: zstd_bindir)
|
||||
|
||||
# =============================================================================
|
||||
# Program symlinks
|
||||
# =============================================================================
|
||||
|
||||
InstallSymlink_py = join_paths('..', 'InstallSymlink.py')
|
||||
InstallSymlink_py = '../InstallSymlink.py'
|
||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdcat', zstd_bindir)
|
||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'unzstd', zstd_bindir)
|
||||
|
||||
if enable_multithread
|
||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdmt', zstd_bindir)
|
||||
meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdmt', zstd_bindir)
|
||||
endif
|
||||
|
||||
# =============================================================================
|
||||
@ -84,9 +96,9 @@ endif
|
||||
|
||||
zstd_man1_dir = join_paths(zstd_mandir, 'man1')
|
||||
|
||||
install_man(join_paths(programs_dir, 'zstd.1'),
|
||||
join_paths(programs_dir, 'zstdgrep.1'),
|
||||
join_paths(programs_dir, 'zstdless.1'))
|
||||
install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
|
||||
join_paths(zstd_rootdir, 'programs/zstdgrep.1'),
|
||||
join_paths(zstd_rootdir, 'programs/zstdless.1'))
|
||||
|
||||
# Meson automatically compresses manpages to gz format
|
||||
# WARNING: This may fail on Windows. Test NEEDED.
|
||||
@ -94,5 +106,5 @@ meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'zstdcat.1.gz', zstd_ma
|
||||
meson.add_install_script(InstallSymlink_py, 'zstd.1.gz', 'unzstd.1.gz', zstd_man1_dir)
|
||||
|
||||
if enable_multithread
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user