git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.5 / 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'),
21 join_paths(zstd_rootdir, 'programs/dibio.c'),
22 join_paths(zstd_rootdir, 'programs/zstdcli_trace.c')]
23
24zstd_deps = [ libzstd_internal_dep ]
25zstd_c_args = libzstd_debug_cflags
26
27zstd_frugal_deps = [ libzstd_internal_dep ]
28zstd_frugal_c_args = [ '-DZSTD_NOBENCH', '-DZSTD_NODICT', '-DZSTD_NOTRACE' ]
29
30if use_multi_thread
31 zstd_deps += [ thread_dep ]
32 zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
33 zstd_frugal_deps += [ thread_dep ]
34 zstd_frugal_c_args += [ '-DZSTD_MULTITHREAD' ]
35endif
36
37if use_zlib
38 zstd_deps += [ zlib_dep ]
39 zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
40endif
41
42if use_lzma
43 zstd_deps += [ lzma_dep ]
44 zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
45endif
46
47if use_lz4
48 zstd_deps += [ lz4_dep ]
49 zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
50endif
51
52export_dynamic_on_windows = false
53# explicit backtrace enable/disable for Linux & Darwin
54have_execinfo = cc.has_header('execinfo.h', required: use_backtrace)
55if not have_execinfo
56 zstd_c_args += '-DBACKTRACE_ENABLE=0'
57elif use_debug and host_machine_os == os_windows # MinGW target
58 zstd_c_args += '-DBACKTRACE_ENABLE=1'
59 export_dynamic_on_windows = true
60endif
61
62if cc_id == compiler_msvc
63 if default_library_type != 'static'
64 zstd_programs_sources += [windows_mod.compile_resources(
65 join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'),
66 include_directories: libzstd_includes)]
67 endif
68endif
69
70zstd = executable('zstd',
71 zstd_programs_sources,
72 c_args: zstd_c_args,
73 dependencies: zstd_deps,
74 export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
75 build_by_default: bin_programs,
76 install: bin_programs)
77
78if not bin_programs
79 # we generate rules to build the programs, but don't install anything
80 # so do not continue to installing scripts and manpages
81 subdir_done()
82endif
83
84zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
85 join_paths(zstd_rootdir, 'programs/timefn.c'),
86 join_paths(zstd_rootdir, 'programs/util.c'),
87 join_paths(zstd_rootdir, 'programs/fileio.c'),
88 join_paths(zstd_rootdir, 'programs/fileio_asyncio.c')]
89
90# Minimal target, with only zstd compression and decompression.
91# No bench. No legacy.
92executable('zstd-frugal',
93 zstd_frugal_sources,
94 dependencies: zstd_frugal_deps,
95 c_args: zstd_frugal_c_args,
96 install: true)
97
98install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'),
99 join_paths(zstd_rootdir, 'programs/zstdless'),
100 install_dir: zstd_bindir)
101
102# =============================================================================
103# Programs and manpages installing
104# =============================================================================
105
106install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
107 join_paths(zstd_rootdir, 'programs/zstdgrep.1'),
108 join_paths(zstd_rootdir, 'programs/zstdless.1'))
109
110InstallSymlink_py = '../InstallSymlink.py'
111zstd_man1_dir = join_paths(zstd_mandir, 'man1')
112bin_EXT = host_machine_os == os_windows ? '.exe' : ''
113man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz'
114
115foreach f : ['zstdcat', 'unzstd']
116 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir)
117 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir)
118endforeach
119
120if use_multi_thread
121 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir)
122 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir)
123endif