-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
137 lines (128 loc) · 4 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
project('batsim', 'cpp',
version: '4.1.1.1',
license: 'LGPL-3.0',
default_options: ['cpp_std=c++17'],
meson_version: '>=0.40.0'
)
batversion = meson.project_version()
# Override version name from git information if possible
git = find_program('git', required: false)
if git.found()
git_describe_cmd = run_command(git, 'describe', '--dirty')
if git_describe_cmd.returncode() == 0
batversion = git_describe_cmd.stdout().strip()
endif
endif
message('batsim version set to: ' + batversion)
# Dependencies
simgrid_dep = dependency('simgrid')
boost_dep = dependency('boost',modules:['regex'])
rapidjson_dep = dependency('RapidJSON')
redox_dep = dependency('redox')
libzmq_dep = dependency('libzmq')
docopt_dep = dependency('docopt')
pugixml_dep = dependency('pugixml')
intervalset_dep = dependency('intervalset')
if get_option('buildtype') == 'debug'
add_project_arguments(['-g'],language:'cpp')
add_project_link_arguments(['-g'],language:'cpp')
#add_project_arguments(['-pg','-g'],language: 'cpp')
#add_project_link_arguments(['-pg'],language: 'cpp')
#env=environment()
#env.set('GMON_OUT_PREFIX','batsim4_gmon')
endif
add_project_arguments(['-Wno-error'],language: 'cpp')
# old gcc/llvm c++ std libraries have implemented the filesystem lib in a separate lib
# - https://releases.llvm.org/11.0.1/projects/libcxx/docs/UsingLibcxx.html#using-filesystem
# - https://gcc.gnu.org/gcc-9/changes.html
if meson.get_compiler('cpp').get_id() == 'clang' and meson.get_compiler('cpp').version().version_compare('<9.0')
add_project_link_arguments(['-lstdc++fs'], language : 'cpp')
elif meson.get_compiler('cpp').get_id() == 'gcc' and meson.get_compiler('cpp').version().version_compare('<9.0')
add_project_link_arguments(['-lstdc++fs'], language : 'cpp')
endif
batsim_deps = [
simgrid_dep,
boost_dep,
rapidjson_dep,
redox_dep,
libzmq_dep,
docopt_dep,
pugixml_dep,
intervalset_dep
]
# Source files
src_without_main = [
'src/batsim_tools.cpp',
'src/batsim_tools.hpp',
'src/batsim.hpp',
'src/context.cpp',
'src/context.hpp',
'src/events.cpp',
'src/events.hpp',
'src/event_submitter.cpp',
'src/event_submitter.hpp',
'src/export.cpp',
'src/export.hpp',
'src/ipp.cpp',
'src/ipp.hpp',
'src/jobs.cpp',
'src/jobs_execution.cpp',
'src/jobs_execution.hpp',
'src/jobs.hpp',
'src/job_submitter.cpp',
'src/job_submitter.hpp',
'src/machines.cpp',
'src/machines.hpp',
'src/network.cpp',
'src/network.hpp',
'src/permissions.cpp',
'src/permissions.hpp',
'src/pointers.hpp',
'src/profiles.cpp',
'src/profiles.hpp',
'src/protocol.cpp',
'src/protocol.hpp',
'src/pstate.cpp',
'src/pstate.hpp',
'src/server.cpp',
'src/server.hpp',
'src/storage.cpp',
'src/storage.hpp',
'src/task_execution.cpp',
'src/task_execution.hpp',
'src/workflow.cpp',
'src/workflow.hpp',
'src/workload.cpp',
'src/workload.hpp'
]
include_dir = include_directories('src')
batlib = static_library('batlib', src_without_main,
include_directories: include_dir,
dependencies: batsim_deps,
cpp_args: '-DBATSIM_VERSION=@0@'.format(batversion),
install: false)
batlib_dep = declare_dependency(
link_with: batlib,
include_directories: include_dir
)
batsim = executable('batsim', ['src/batsim.cpp'],
include_directories: include_dir,
dependencies: batsim_deps + [batlib_dep],
cpp_args: '-DBATSIM_VERSION=@0@'.format(batversion),
install: true
)
# Unit tests.
if get_option('do_unit_tests')
gtest_dep = dependency('gtest_main', version: '>=1.8.0', required: true)
test_incdir = include_directories('src/unittest', 'src')
test_src = [
'src/unittest/test_buffered_outputting.cpp',
'src/unittest/test_numeric_strcmp.cpp',
]
unittest = executable('batunittest',
test_src,
dependencies: batsim_deps + [batlib_dep, gtest_dep],
include_directories: [test_incdir]
)
test('unittest', unittest)
endif