-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeson.build
48 lines (40 loc) · 1.23 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
project('example', 'c', 'cpp')
project_name = 'example'
# Compiler and linker flags
cflags = ['-Wall']
# Dependencies
proto_c_dep = meson.get_compiler('c').find_library('protobuf-c', required : false)
# Source files
sources = [
'src/module_template.c', # module file (REMEMBER TO CHANGE!)
'src/utils/memory_util.c',
'src/utils/config_util.c',
'src/utils/batch_util.c',
'src/utils/error_util.c',
'src/utils/metadata_util.c',
'src/utils/metadata.pb-c.c',
]
dirs = include_directories(
'src/include',
'src/include/utils',
)
# Shared library (SO)
shared_library(project_name, sources,
include_directories: dirs,
c_args: cflags + ['-DSHARED_MEMORY=1'],
dependencies: [proto_c_dep]
)
# Check for cross-compiling
if not get_option('cross-compile')
# If not cross-compiling, include the executable target
sources += 'src/test.c'
sources += 'src/utils/yaml_parser.c'
libyaml_dep = dependency('yaml-0.1')
m_dep = meson.get_compiler('c').find_library('m', required : false)
# Executable
executable(project_name + '-exec', sources,
include_directories: dirs,
c_args: cflags + ['-g', '-DSHARED_MEMORY=0'],
dependencies: [libyaml_dep, m_dep, proto_c_dep]
)
endif