-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathmeson.build
76 lines (69 loc) · 2.69 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
project('rellume', ['c', 'cpp'], meson_version: '>=0.52',
default_options: [
'buildtype=debugoptimized',
'warning_level=3',
'cpp_std=c++17',
])
if get_option('warning_level').to_int() >= 3
cpp = meson.get_compiler('cpp')
if cpp.has_argument('-Wshadow=local')
add_project_arguments('-Wshadow=local', language: 'cpp')
endif
if cpp.has_argument('-Wno-unused-parameter')
add_project_arguments('-Wno-unused-parameter', language: 'cpp')
endif
endif
llvm_version = ['>=16', '<19']
# First, attempt to use the shared library.
libllvm = dependency('llvm', version: llvm_version, static: false,
method: 'config-tool', include_type: 'system',
required: false)
if not libllvm.found()
# Try static libraries.
libllvm = dependency('llvm', version: llvm_version, static: true,
method: 'config-tool', include_type: 'system',
modules: ['x86', 'aarch64', 'riscv', 'executionengine'])
endif
add_project_arguments(['-DLL_LLVM_MAJOR='+libllvm.version().split('.')[0]], language: 'cpp')
architectures = []
archdeps = []
if get_option('with_x86_64')
archdeps += dependency('fadec', static: true,
fallback: ['fadec', 'fadec'],
default_options: ['archmode=only64'])
architectures += 'x86_64'
endif
if get_option('with_rv64')
archdeps += dependency('frvdec', static: true,
fallback: ['frvdec', 'frvdec'])
architectures += 'rv64'
endif
if get_option('with_aarch64')
# Disable all warnings for farmdec. This is mostly about non-standard
# extensions (forward declarations of enums, binary literals, anon structs).
archdeps += dependency('farmdec', static: true,
fallback: ['farmdec', 'farmdec'],
default_options: ['warning_level=0'],
include_type: 'system')
architectures += 'aarch64'
endif
foreach arch : architectures
add_project_arguments(['-DRELLUME_WITH_@0@'.format(arch.to_upper())], language: 'cpp')
endforeach
rellume_inc = include_directories('include', 'data')
subdir('data/rellume')
subdir('src')
subdir('include/rellume')
librellume = declare_dependency(include_directories: rellume_inc,
link_with: librellume_lib,
dependencies: [libllvm],
sources: [cpustruct_pub])
subdir('tests')
subdir('examples')
pkg = import('pkgconfig')
pkg.generate(librellume_lib,
subdirs: ['rellume'],
version: '0.1',
name: 'rellume',
filebase: 'rellume',
description: 'Lift machine code to LLVM-IR')