1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# #############################################################################
# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
# 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).
# #############################################################################
cc = meson.get_compiler('c')
fs = import('fs')
pkgconfig = import('pkgconfig')
lz4_source_root = '../../..'
add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c')
if get_option('debug')
add_project_arguments(cc.get_supported_arguments(
'-Wcast-qual',
'-Wcast-align',
'-Wshadow',
'-Wswitch-enum',
'-Wdeclaration-after-statement',
'-Wstrict-prototypes',
'-Wundef',
'-Wpointer-arith',
'-Wstrict-aliasing=1',
'-DLZ4_DEBUG=@0@'.format(get_option('debug-level'))
),
language: 'c'
)
endif
compile_args = []
if not get_option('align-test')
add_project_arguments('-DLZ4_ALIGN_TEST=0', language: 'c')
endif
if get_option('disable-memory-allocation')
if get_option('default_library') != 'static'
error('Memory allocation can only be disabled in static builds')
endif
add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION')
compile_args += '-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION'
endif
add_project_arguments(
'-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')),
language: 'c'
)
compile_args += '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max'))
if not get_option('fast-dec-loop').auto()
add_project_arguments(
'-DLZ4_FAST_DEC_LOOP=@0@'.format(
get_option('fast-dec-loop').enabled() ? 1 : 0
),
language: 'c'
)
endif
if get_option('force-sw-bitcount')
add_project_arguments('-DLZ4_FORCE_SW_BITCOUNT', language: 'c')
endif
if get_option('freestanding')
add_project_arguments('-DLZ4_FREESTANDING=1', language: 'c')
compile_args += '-DLZ4_FREESTANDING=1'
endif
if get_option('memory-usage') > 0
add_project_arguments(
'-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')),
language: 'c'
)
compile_args += '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage'))
endif
if get_option('unstable')
add_project_arguments('-DLZ4_STATIC_LINKING_ONLY', language: 'c')
compile_args += '-DLZ4_STATIC_LINKING_ONLY'
if get_option('default_library') != 'static'
add_project_arguments('-DLZ4_PUBLISH_STATIC_FUNCTIONS', language: 'c')
compile_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS'
add_project_arguments('-DLZ4F_PUBLISH_STATIC_FUNCTIONS', language: 'c')
compile_args += '-DLZ4F_PUBLISH_STATIC_FUNCTIONS'
endif
endif
if get_option('user-memory-functions')
add_project_arguments('-DLZ4_USER_MEMORY_FUNCTIONS', language: 'c')
endif
run_env = environment()
subdir('lib')
if get_option('programs')
subdir('programs')
else
lz4 = disabler()
lz4cat = disabler()
unlz4 = disabler()
endif
if get_option('tests')
subdir('tests')
endif
if get_option('contrib')
subdir('contrib')
endif
if get_option('examples')
subdir('examples')
endif
if get_option('ossfuzz')
subdir('ossfuzz')
endif
|