-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
112 lines (94 loc) · 2.83 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
project('sve-cache-simulator', 'cpp', version: '0.0.1',
default_options: ['cpp_std=c++17', 'buildtype=release', 'b_lto=true', 'warning_level=3'])
# ------- Build Options -------
cxx = meson.get_compiler('cpp')
cpp_args = []
link_args = []
rpath = ''
m_dep = cxx.find_library('m', required: false)
if get_option('parallel')
cpp_args += ['-fopenmp']
link_args += ['-fopenmp']
endif
# Fix Homebew LLVM build on Mac
if build_machine.system() == 'darwin'
cpp_args += ['-I/usr/local/opt/llvm/include']
link_args += ['-L/usr/local/opt/llvm/lib']
rpath = '/usr/local/opt/llvm/lib'
endif
build_type = get_option('buildtype')
if build_type == 'release'
cpp_args += ['-ffast-math']
arch = get_option('arch')
if target_machine.cpu_family() == 'aarch64'
cpp_args += ['-mcpu=' + arch]
else
cpp_args += ['-march=' + arch]
endif
compiler = cxx.get_id()
if compiler == 'armclang'
cpp_args += ['-ffp-contract=fast', '-fsimdmath']
elif compiler == 'clang'
cpp_args += ['-ffp-contract=fast']
endif
elif build_type == 'debug' and cxx.get_id() == 'gcc'
cpp_args += ['-g3']
link_args += ['-g3']
endif
# ------- Main Binary -------
src_common = files([
'Clock.cc',
'cache.cc',
'CacheConfig.cc',
'CacheHierarchy.cc',
'DirectMappedCache.cc',
'InfiniteCache.cc',
'MemoryTrace.cc',
'SetAssociativeCache.cc'
])
src_main = files('main.cc')
main_exe = executable('scs', src_common, src_main,
cpp_args: cpp_args,
link_args: link_args,
build_rpath: rpath,
dependencies: m_dep)
# ------- Trace Converter -------
src_converter_common = files('TraceConverter.cc')
src_converter_main = files([
'MemoryTrace.cc',
'TraceConverterMain.cc'])
converter_exe = executable('convert-trace', src_converter_common, src_converter_main,
cpp_args: cpp_args,
link_args: link_args,
build_rpath: rpath,
dependencies: m_dep)
# ------- Bundle Stats -------
src_bundle_stats = files('BundleStatsMain.cc', 'MemoryTrace.cc')
bundle_stats_exe = executable('bundle-stats', src_bundle_stats,
cpp_args: cpp_args,
link_args: link_args,
build_rpath: rpath,
dependencies: m_dep)
# ------- Tests -------
src_test = files([
'test/CacheConfigTest.cc',
'test/CacheTest.cc',
'test/CacheHierarchyTest.cc',
'test/DirectMappedCacheTest.cc',
'test/InfiniteCacheTest.cc',
'test/MemoryTraceTest.cc',
'test/SetAssociativeCacheTest.cc',
'test/RandomAddressGenerator.cc',
'test/TraceConverterTest.cc',
'test/test.cc',
'test/utils.cc'
])
test_exe = executable('scs-test', src_test,
objects: [main_exe.extract_objects(src_common), converter_exe.extract_objects(src_converter_common)],
cpp_args: cpp_args,
link_args: link_args,
build_rpath: rpath,
dependencies: m_dep)
test('Cacth2 tests', test_exe)
# We cannot reliably copy test trace files at build time
# See https://github.com/mesonbuild/meson/issues/860