-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmeson.build
More file actions
95 lines (78 loc) · 2.93 KB
/
meson.build
File metadata and controls
95 lines (78 loc) · 2.93 KB
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
project('seldon', 'cpp',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20', 'optimization=3'])
cppc = meson.get_compiler('cpp')
# Add C++ compiler options
_incdir = [] # Include directories
_deps = [] # Dependencies
_args = [] # Extra arguments
_incdir += include_directories('include')
fmt_subproj = subproject('fmt', default_options: ['default_library=static'])
_deps += fmt_subproj.get_variable('fmt_dep')
tomlplusplus_subproj = subproject('tomlplusplus', default_options: ['default_library=static'])
_deps += tomlplusplus_subproj.get_variable('tomlplusplus_dep')
_args += cppc.get_supported_arguments(['-Wno-unused-local-typedefs', '-Wno-array-bounds'])
sources_seldon = [
'src/config_parser.cpp',
'src/models/DeGroot.cpp',
'src/models/ActivityDrivenModel.cpp',
'src/models/DeffuantModel.cpp',
'src/models/DeffuantModelVector.cpp',
'src/models/InertialModel.cpp',
'src/util/tomlplusplus.cpp',
]
# both static and shared library for bindings
# -----------------------------------
symbol_visibility = 'default'
if get_option('default_library') == 'static'
# from https://github.com/ERGO-Code/HiGHS/pull/1737/files
symbol_visibility = 'inlineshidden'
endif
seldon_lib = both_libraries('seldon',
sources_seldon,
install:true,
dependencies: _deps,
include_directories:_incdir,
gnu_symbol_visibility: symbol_visibility,
pic: true,
cpp_args : _args,
)
seldon_static_dep = declare_dependency(include_directories:_incdir,
link_with : seldon_lib.get_static_lib(), dependencies: _deps)
seldon_shared_dep = declare_dependency(include_directories : _incdir,
link_with : seldon_lib.get_shared_lib(), dependencies: _deps)
# ------------------------------------
if get_option('build_exe')
_deps += subproject('argparse').get_variable('argparse_dep')
exe = executable('seldon', sources_seldon + 'src/main.cpp',
install : true,
dependencies : _deps,
include_directories : _incdir,
cpp_args : _args
)
endif
if get_option('build_tests')
tests = [
['Test_Tarjan', 'test/test_tarjan.cpp'],
['Test_DeGroot', 'test/test_deGroot.cpp'],
['Test_Activity_Driven', 'test/test_activity.cpp'],
['Test_Activity_Driven_Inertial', 'test/test_activity_inertial.cpp'],
['Test_Deffuant', 'test/test_deffuant.cpp'],
['Test_Network', 'test/test_network.cpp'],
['Test_Network_Generation', 'test/test_network_generation.cpp'],
['Test_Sampling', 'test/test_sampling.cpp'],
['Test_IO', 'test/test_io.cpp'],
['Test_Util', 'test/test_util.cpp'],
['Test_Prob', 'test/test_probability_distributions.cpp'],
]
Catch2 = dependency('Catch2', method : 'cmake', modules : ['Catch2::Catch2WithMain', 'Catch2::Catch2'])
_deps+= Catch2
foreach t : tests
exe = executable(t.get(0), sources_seldon + t.get(1),
dependencies : _deps,
include_directories : _incdir,
cpp_args : _args
)
test(t.get(0), exe, workdir : meson.project_source_root())
endforeach
endif