git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.6 / build / meson / programs / meson.build
CommitLineData
648db22b 1# #############################################################################
2# Copyright (c) 2018-present Dima Krasner <dima@dimakrasner.com>
3# lzutao <taolzu(at)gmail.com>
4# All rights reserved.
5#
6# This source code is licensed under both the BSD-style license (found in the
7# LICENSE file in the root directory of this source tree) and the GPLv2 (found
8# in the COPYING file in the root directory of this source tree).
9# #############################################################################
10
11zstd_rootdir = '../../..'
12
13zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
14 join_paths(zstd_rootdir, 'programs/util.c'),
15 join_paths(zstd_rootdir, 'programs/timefn.c'),
16 join_paths(zstd_rootdir, 'programs/fileio.c'),
17 join_paths(zstd_rootdir, 'programs/fileio_asyncio.c'),
18 join_paths(zstd_rootdir, 'programs/benchfn.c'),
19 join_paths(zstd_rootdir, 'programs/benchzstd.c'),
20 join_paths(zstd_rootdir, 'programs/datagen.c'),
f535537f 21 join_paths(zstd_rootdir, 'programs/lorem.c'),
648db22b 22 join_paths(zstd_rootdir, 'programs/dibio.c'),
23 join_paths(zstd_rootdir, 'programs/zstdcli_trace.c')]
24
25zstd_deps = [ libzstd_internal_dep ]
26zstd_c_args = libzstd_debug_cflags
27
28zstd_frugal_deps = [ libzstd_internal_dep ]
29zstd_frugal_c_args = [ '-DZSTD_NOBENCH', '-DZSTD_NODICT', '-DZSTD_NOTRACE' ]
30
31if use_multi_thread
32 zstd_deps += [ thread_dep ]
33 zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
34 zstd_frugal_deps += [ thread_dep ]
35 zstd_frugal_c_args += [ '-DZSTD_MULTITHREAD' ]
36endif
37
38if use_zlib
39 zstd_deps += [ zlib_dep ]
40 zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
41endif
42
43if use_lzma
44 zstd_deps += [ lzma_dep ]
45 zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
46endif
47
48if use_lz4
49 zstd_deps += [ lz4_dep ]
50 zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
51endif
52
53export_dynamic_on_windows = false
54# explicit backtrace enable/disable for Linux & Darwin
55have_execinfo = cc.has_header('execinfo.h', required: use_backtrace)
56if not have_execinfo
57 zstd_c_args += '-DBACKTRACE_ENABLE=0'
58elif use_debug and host_machine_os == os_windows # MinGW target
59 zstd_c_args += '-DBACKTRACE_ENABLE=1'
60 export_dynamic_on_windows = true
61endif
62
63if cc_id == compiler_msvc
64 if default_library_type != 'static'
65 zstd_programs_sources += [windows_mod.compile_resources(
66 join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'),
67 include_directories: libzstd_includes)]
68 endif
69endif
70
71zstd = executable('zstd',
72 zstd_programs_sources,
73 c_args: zstd_c_args,
74 dependencies: zstd_deps,
75 export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
76 build_by_default: bin_programs,
77 install: bin_programs)
78
79if not bin_programs
80 # we generate rules to build the programs, but don't install anything
81 # so do not continue to installing scripts and manpages
82 subdir_done()
83endif
84
85zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
86 join_paths(zstd_rootdir, 'programs/timefn.c'),
87 join_paths(zstd_rootdir, 'programs/util.c'),
88 join_paths(zstd_rootdir, 'programs/fileio.c'),
89 join_paths(zstd_rootdir, 'programs/fileio_asyncio.c')]
90
91# Minimal target, with only zstd compression and decompression.
92# No bench. No legacy.
93executable('zstd-frugal',
94 zstd_frugal_sources,
95 dependencies: zstd_frugal_deps,
96 c_args: zstd_frugal_c_args,
97 install: true)
98
99install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'),
100 join_paths(zstd_rootdir, 'programs/zstdless'),
101 install_dir: zstd_bindir)
102
103# =============================================================================
104# Programs and manpages installing
105# =============================================================================
106
107install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
108 join_paths(zstd_rootdir, 'programs/zstdgrep.1'),
109 join_paths(zstd_rootdir, 'programs/zstdless.1'))
110
111InstallSymlink_py = '../InstallSymlink.py'
112zstd_man1_dir = join_paths(zstd_mandir, 'man1')
113bin_EXT = host_machine_os == os_windows ? '.exe' : ''
114man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz'
115
116foreach f : ['zstdcat', 'unzstd']
117 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir)
118 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir)
119endforeach
120
121if use_multi_thread
122 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir)
123 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir)
124endif