zstd/build/meson/programs/meson.build

105 lines
3.7 KiB
Meson
Raw Normal View History

# #############################################################################
# Copyright (c) 2018-present Dima Krasner <dima@dimakrasner.com>
# lzutao <taolzu(at)gmail.com>
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree).
# #############################################################################
2018-11-30 08:30:45 +00:00
zstd_rootdir = '../../..'
zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
join_paths(zstd_rootdir, 'programs/util.c'),
2019-04-12 14:28:36 +00:00
join_paths(zstd_rootdir, 'programs/timefn.c'),
2018-11-30 08:30:45 +00:00
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 = libzstd_debug_cflags
2018-11-30 14:05:03 +00:00
if use_multi_thread
2018-11-30 08:30:45 +00:00
zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
endif
2018-11-30 08:30:45 +00:00
zstd_deps = [ libzstd_dep ]
2018-11-30 14:05:03 +00:00
if use_zlib
2018-11-30 08:30:45 +00:00
zstd_deps += [ zlib_dep ]
zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
endif
2018-11-30 14:05:03 +00:00
if use_lzma
2018-11-30 08:30:45 +00:00
zstd_deps += [ lzma_dep ]
zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
endif
2018-11-30 14:05:03 +00:00
if use_lz4
2018-11-30 08:30:45 +00:00
zstd_deps += [ lz4_dep ]
zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
endif
2018-11-30 08:30:45 +00:00
export_dynamic_on_windows = false
# explicit backtrace enable/disable for Linux & Darwin
2018-11-30 14:05:03 +00:00
if not use_backtrace
2018-11-30 08:30:45 +00:00
zstd_c_args += '-DBACKTRACE_ENABLE=0'
2018-11-30 14:05:03 +00:00
elif use_debug and host_machine_os == os_windows # MinGW target
2018-11-30 08:30:45 +00:00
zstd_c_args += '-DBACKTRACE_ENABLE=1'
export_dynamic_on_windows = true
endif
2018-11-30 08:30:45 +00:00
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
2018-11-30 08:30:45 +00:00
zstd = executable('zstd',
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(zstd_rootdir, 'programs/zstdcli.c'),
2019-04-12 14:28:36 +00:00
join_paths(zstd_rootdir, 'programs/timefn.c'),
2018-11-30 08:30:45 +00:00
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',
2018-11-30 08:30:45 +00:00
zstd_frugal_sources,
dependencies: libzstd_dep,
c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ],
install: true)
2018-11-30 08:30:45 +00:00
install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'),
join_paths(zstd_rootdir, 'programs/zstdless'),
install_dir: zstd_bindir)
2018-11-28 18:50:24 +00:00
# =============================================================================
2018-12-01 06:07:08 +00:00
# Programs and manpages installing
# =============================================================================
2018-11-30 08:30:45 +00:00
install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
join_paths(zstd_rootdir, 'programs/zstdgrep.1'),
join_paths(zstd_rootdir, 'programs/zstdless.1'))
2018-11-28 15:32:37 +00:00
2018-12-01 06:07:08 +00:00
InstallSymlink_py = '../InstallSymlink.py'
zstd_man1_dir = join_paths(zstd_mandir, 'man1')
bin_EXT = host_machine_os == os_windows ? '.exe' : ''
man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz'
2018-12-01 06:07:08 +00:00
foreach f : ['zstdcat', 'unzstd']
meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir)
2018-12-01 06:07:08 +00:00
meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir)
endforeach
2018-11-28 18:27:20 +00:00
2018-11-30 14:05:03 +00:00
if use_multi_thread
meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir)
2018-12-01 06:07:08 +00:00
meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir)
2018-11-28 18:27:20 +00:00
endif