-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
97 lines (73 loc) · 2.61 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
project('libplatforms', 'cpp',
default_options : ['warning_level=3',
'cpp_std=c++17',
'buildtype=debugoptimized'])
## llvm dependencies
llvm_version = ['>=14', '<16']
llvm_dep = dependency('llvm', method: 'config-tool', version: llvm_version, include_type: 'system')
toolchains = subproject('toolchains')
arm_enabled = toolchains.get_variable('arm_enabled')
llc = toolchains.get_variable('llc')
# this variable is filled in the subdirs
# in contains all paths that needs to be included
libs_includes = []
# common flags for clang
clang_flags = [
'-ffunction-sections',
'-fdata-sections',
] + toolchains.get_variable('clang_flags')
llvm_opt_flags = [
# '-time-passes',
# '-Og',
'-O2',
]
llc_flags = ['--function-sections',
'--data-sections',
]
llc_cmd = [llc, '-filetype=obj', '-o', '@OUTPUT@', '@INPUT@', ] + llc_flags
ld_flags = ['-Wl,--gc-sections',
'-Wl,--warn-common',
# '-Wl,--warn-section-align',
'-Wl,--cref',
'-Wl,-Map,@OUTPUT0@.map'
]
ir_flags = toolchains.get_variable('ir_flags')
obj_flags = ['-c']
# standard invocations for clang with c and cpp
clang_c = toolchains.get_variable('clang_c_cmd')
clang_cpp = toolchains.get_variable('clang_cpp_cmd')
ar_args = ['qcs', '@OUTPUT@', '@INPUT@']
if arm_enabled
arm_triple = toolchains.get_variable('arm_triple')
arm_clang_flags = [
'--target=' + arm_triple,
'-mthumb',
]
lld = toolchains.get_variable('llvm_ld')
arm_include_path = toolchains.get_variable('arm_include_path')
arm_link_path = toolchains.get_variable('arm_link_path')
arm_libgcc_dir = toolchains.get_variable('arm_libgcc_dir')
arm_ld_flags = [
'-Wl,-Map,@OUTPUT0@.map',
'-Wl,--cref',
'-fuse-ld=' + lld.full_path(),
'-nostdlib',
'-nodefaultlibs',
]
arm_llc_flags = ['--frame-pointer=none']
arm_ar = toolchains.get_variable('arm_ar')
ar_cmd = [arm_ar, ar_args]
subdir('platform')
subdir('include')
# declare_dependency does not make sense here, see https://github.com/mesonbuild/meson/issues/12543
libplatform_link_with = libplatform_target
libplatform_include_directories = libs_includes
libplatform_linkerscript = default_linkerscript
summary({
'Link library (libplatform_link_with)': libplatform_link_with.full_path(),
'Includes (libplatform_include_directories)': libplatform_include_directories,
'Linkerscript (libplatform_linkerscript)': '@0@'.format(libplatform_linkerscript), # replace this with "full_path()" in Meson 1.4.0
})
endif
tftp_host = get_option('tftp_host')
tftp_deploy = files('deploy.py')