Update meson build system
NOTE: This commit only tested on Linux (Ubuntu 18.04). Windows build may not work as expected. * Use meson >= 0.47.0 cause we use install_man function * Add three helper Python script: * CopyFile.py: To copy file * CreateSymlink.py: To make symlink (both Windows and Unix) * GetZstdLibraryVersion.py: Parse lib/zstd.h to get zstd version These help emulating equivalent functions in CMake and Makefile. * Use subdir from meson to split meson.build * Add contrib build * Fix other build * Add new build options * build_programs: Enable programs build * build_contrib: Enable contrib build * build_tests: Enable tests build * use_static_runtime: Link to static run-time libraries on MSVC * zlib_support: Enable zlib support * lzma_support: Enable lzma support
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# #############################################################################
|
||||
# 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).
|
||||
# #############################################################################
|
||||
|
||||
zstd_source_dir = join_paths('..', '..', '..')
|
||||
programs_dir = join_paths(zstd_source_dir, 'programs')
|
||||
tests_dir = join_paths(zstd_source_dir, 'tests')
|
||||
|
||||
datagen_c_file = join_paths(programs_dir, 'datagen.c')
|
||||
util_c_file = join_paths(programs_dir, 'util.c')
|
||||
benchfn_c_file = join_paths(programs_dir, 'benchfn.c')
|
||||
|
||||
datagen_sources = [datagen_c_file,
|
||||
join_paths(tests_dir, 'datagencli.c')]
|
||||
test_includes = libzstd_includes + [include_directories(programs_dir)]
|
||||
|
||||
datagen = executable('datagen',
|
||||
datagen_sources,
|
||||
include_directories: test_includes,
|
||||
link_with: libzstd,
|
||||
install: false)
|
||||
test('datagen', datagen)
|
||||
|
||||
fullbench_sources = [datagen_c_file,
|
||||
util_c_file,
|
||||
benchfn_c_file,
|
||||
join_paths(programs_dir, 'benchzstd.c'),
|
||||
join_paths(programs_dir, 'fullbench.c')]
|
||||
fullbench = executable('fullbench',
|
||||
fullbench_sources,
|
||||
include_directories: test_includes,
|
||||
link_with: libzstd,
|
||||
install: false)
|
||||
test('fullbench', fullbench)
|
||||
|
||||
fuzzer_sources = [datagen_c_file,
|
||||
util_c_file,
|
||||
join_paths(tests_dir, 'fuzzer.c')]
|
||||
fuzzer = executable('fuzzer',
|
||||
fuzzer_sources,
|
||||
include_directories: test_includes,
|
||||
link_with: libzstd,
|
||||
install: false)
|
||||
test('fuzzer', fuzzer)
|
||||
|
||||
paramgrill_sources = [benchfn_c_file
|
||||
join_paths(programs_dir, 'benchzstd.c'),
|
||||
datagen_c_file
|
||||
util_c_file
|
||||
join_paths(tests_dir, 'paramgrill.c')]
|
||||
if host_machine.system() != 'windows'
|
||||
paramgrill = executable('paramgrill',
|
||||
paramgrill_sources,
|
||||
include_directories: test_includes,
|
||||
link_with: libzstd,
|
||||
dependencies: libm_dep,
|
||||
install: false )
|
||||
test('paramgrill', paramgrill)
|
||||
endif
|
||||
Reference in New Issue
Block a user