forked from Seagate/openSeaChest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
104 lines (87 loc) · 3.58 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
project('openSeaChest', 'c', license: 'MPL-2.0', version: '22.6.24', default_options : ['warning_level=2'])
#note: project version is year.month.day
c = meson.get_compiler('c')
#TODO: Add -Wcast-align=strict and fix these issues to help ensure better portability
#NOTE: -Wsign-conversion can be useful while debugging, but there are numerous places this shows up
# and it is not useful, so only add it while debugging.
warning_flags = [
# '-Wcast-align=strict',
# '-Wsign-conversion',
'-Wshadow=compatible-local',
'-Wvla',
'-Wfloat-equal',
'-Wnull-dereference',
'-Wunused-const-variable',
'-Wduplicated-cond',
'-Wjump-misses-init',
'-Wstringop-overflow',
'-Wlogical-op',
'-Wshift-overflow=2',
'-Wdouble-promotion',
'-Wformat-security',
'-Wold-style-definition',
'-Wstrict-prototypes',
'-Wmissing-declarations',
'-Wmissing-prototypes'
]
add_project_arguments(c.get_supported_arguments(warning_flags), language : 'c')
if not (target_machine.system() == 'sunos') and (c.get_id() == 'gcc' or c.get_id() == 'clang')
add_global_arguments(
'-ffunction-sections',
'-fdata-sections',
language: 'c',
)
add_global_link_arguments(
'-Wl,--gc-sections',
language: 'c',
)
#if GCC less than 5, need to set -std=gnu99 at minimum. gnu11 became the default in 5, 17 default in 7 or 8.
#TODO: May be able to move to c11/gnu11 instead, but will need to do a lot of testing first
#skipping sunos since this was a compatibility issue that was reported earlier. May be able to find a better way to handle this in the future.
if not (target_machine.system() == 'sunos') and c.get_id().contains('gcc')
verStr = c.version().split('.')
if verStr.get(0).to_int() < 5
add_global_arguments('-std=gnu99', language: 'c',)
endif
endif
endif
if not get_option('tcg').enabled()
add_project_arguments('-DDISABLE_TCG_SUPPORT', language : 'c')
endif
if get_option('debug')
add_project_arguments('-D_DEBUG', language : 'c')
endif
if get_option('libc_musl')
add_project_arguments('-DUSING_MUSL_LIBC=1', language : 'c')
endif
exec_prefix = 'openSeaChest_'
common_sources = ['src/EULA.c', 'src/openseachest_util_options.c']
os_deps = []
if target_machine.system() == 'windows'
if not c.has_header('getopt.h')
wingetopt = subproject('wingetopt', default_options: 'default_library=static')
wingetopt_dep = wingetopt.get_variable('wingetopt_dep')
os_deps += [wingetopt_dep]
endif
windows = import('windows')
resources = windows.compile_resources('openSeaChest.rc')
common_sources += [resources]
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language : 'c')
endif
opensea_common = subproject('opensea-common')
opensea_common_dep = opensea_common.get_variable('opensea_common_dep')
opensea_transport = subproject('opensea-transport')
opensea_transport_dep = opensea_transport.get_variable('opensea_transport_dep')
opensea_operations = subproject('opensea-operations')
opensea_operations_dep = opensea_operations.get_variable('opensea_operations_dep')
incdir = include_directories('include')
exe_src_map = {
'FormatUnit': 'Format'
}
foreach p : get_option('tools')
executable('openSeaChest_' + p, common_sources, 'utils/C/openSeaChest/openSeaChest_' + exe_src_map.get(p, p) + '.c', dependencies : [opensea_common_dep, opensea_transport_dep, opensea_operations_dep, os_deps], include_directories : incdir, install : true)
if p not in ['NVMe', 'PassthroughTest', 'Security', 'ZBD'] # Blacklist tools without man pages
install_man('docs/man/man8/openSeaChest_' + exe_src_map.get(p, p) + '.8')
endif
endforeach
install_man('docs/man/man8/openSeaChest.8')