-
Notifications
You must be signed in to change notification settings - Fork 63
/
meson.build
158 lines (141 loc) · 3.55 KB
/
meson.build
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
project('sdb', 'c', meson_version : '>=0.60.0', version : '2.0.2')
pkgconfig_mod = import('pkgconfig')
sdb_version = meson.project_version()
is_windows = host_machine.system() == 'windows' ? true: false
if is_windows
libsdb_name = 'libsdb'
sdb_libversion = ''
else
sdb_libversion = sdb_version
libsdb_name = 'sdb'
endif
libsdb_sources = [
'src/array.c',
'src/set.c',
'src/base64.c',
'src/cdb.c',
'src/cdb_make.c',
'src/dict.c',
'src/diff.c',
'src/disk.c',
'src/fmt.c',
'src/heap.c',
'src/main.c',
'src/ht_uu.c',
'src/ht_up.c',
'src/ht_pp.c',
'src/ht_pu.c',
'src/ht_su.c',
'src/journal.c',
'src/json.c',
'src/lock.c',
'src/ls.c',
'src/match.c',
'src/ns.c',
'src/num.c',
'src/query.c',
'src/sdb.c',
'src/ht.c',
'src/util.c',
'src/text.c'
]
sdb_inc = include_directories(['include'])
rpath_lib = ''
rpath_exe = ''
if get_option('local') and get_option('default_library') == 'shared'
rpath_lib = '$ORIGIN'
rpath_exe = '$ORIGIN/../' + get_option('libdir')
endif
libsdb = both_libraries(libsdb_name, libsdb_sources,
include_directories: sdb_inc,
implicit_include_directories: false,
soversion: sdb_libversion,
install: not meson.is_subproject(),
install_rpath: rpath_lib
)
libsdb_static = static_library('libsdb_static', libsdb_sources,
include_directories: sdb_inc,
implicit_include_directories: false,
install: not meson.is_subproject(),
install_rpath: rpath_lib
)
#if is_windows
# link_with = libsdb.get_static_lib()
#else
# link_with = libsdb.get_shared_lib()
#endif
default_library_type = get_option('default_library')
if default_library_type == 'shared'
link_with = libsdb.get_shared_lib()
else
link_with = libsdb.get_static_lib()
endif
sdb_dep = declare_dependency(
link_with: [link_with],
include_directories: sdb_inc
)
sdb_exe = executable('sdb', join_paths('src','entry.c'),
include_directories: sdb_inc,
link_with: [link_with],
install: not meson.is_subproject(),
install_rpath: rpath_exe,
implicit_include_directories: false
)
if meson.is_subproject()
install_man([join_paths('src','sdb.1')])
else
include_files = [
'include/sdb/buffer.h',
'include/sdb/cdb.h',
'include/sdb/cdb_make.h',
'include/sdb/config.h',
'include/sdb/dict.h',
'include/sdb/heap.h',
'include/sdb/ht_inc.h',
'include/sdb/ht_pp.h',
'include/sdb/ht_up.h',
'include/sdb/ht_uu.h',
'include/sdb/ht_pu.h',
'include/sdb/ht_su.h',
'include/sdb/ls.h',
'include/sdb/sdb.h',
'include/sdb/ht.h',
'include/sdb/set.h',
'include/sdb/types.h',
'include/sdb/asserts.h',
'include/sdb/cwisstable.h',
'include/sdb/gcc_stdatomic.h',
'include/sdb/msvc_stdatomic.h',
]
install_headers(include_files, subdir: 'sdb')
make_exe = find_program('make', required: false)
if make_exe.found()
test('run tests', make_exe,
args: 'test',
env: ['BASEDIR=' + meson.current_build_dir()],
workdir: join_paths(meson.current_build_dir(), '..'),
depends: [sdb_exe, libsdb]
)
endif
subdir(join_paths('test','bench'))
subdir(join_paths('test','unit'))
endif
if meson.is_cross_build()
sdb_native_exe = executable('sdb_native', join_paths('src','entry.c'),
include_directories: sdb_inc,
link_with: [link_with],
install: false,
implicit_include_directories: false
)
else
sdb_native_exe = sdb_exe
endif
pkgconfig_mod.generate(
name: 'sdb',
filebase: 'sdb',
libraries: [libsdb.get_shared_lib()],
description: 'Simple DataBase',
subdirs: ['sdb'],
version: sdb_version,
url: 'https://github.com/radareorg/sdb'
)