-
Notifications
You must be signed in to change notification settings - Fork 3
/
meson.build
142 lines (125 loc) · 3.81 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
138
139
140
141
142
project('flightlog2kml', version : '1.0.25')
meson.add_install_script('meson/post_install.py')
version = get_option('version')
commit = get_option('commit')
golang = find_program('go')
env = environment()
env.set('CGO_ENABLED', '0')
ldflags = '-extldflags -static -s -w'
if commit != ''
ldflags += ' -X main.GitCommit=' + commit
endif
if version == ''
version = meson.project_version()
endif
if version != ''
ldflags += ' -X main.GitTag='+ version
endif
# This is beyond stupid ....
pymodule = import('python3')
python3 = pymodule.find_python()
exe=''
res = run_command(python3, '-c', 'import os; print(os.environ["EXE"])', check: false)
if res.returncode() == 0
exe = res.stdout().strip()
endif
# This is for old distros like Debain 10, in which case the '-v' is harmles
r = run_command('go', 'env', 'GOVERSION', check: false)
res = r.stdout().strip()
trimpath = '-trimpath'
if res == ''
trimpath = '-v'
endif
subdir('cmd/flightlog2kml')
subdir('cmd/fl2mqtt')
subdir('cmd/log2mission')
subdir('cmd/mission2kml')
subdir('cmd/fl2sitl')
#fl2mqtt_path = join_paths(meson.current_source_dir(), 'cmd', 'fl2mqtt')
#log2mission_path = join_paths(meson.current_source_dir(), 'cmd', 'log2mission')
#mission2kml_path = join_paths(meson.current_source_dir(), 'cmd', 'mission2kml')
#fl2sitl_path = join_paths(meson.current_source_dir(), 'cmd', 'fl2sitl')
common_files = []
subdir('pkg/geo')
subdir('pkg/types')
subdir('pkg/mission')
subdir('pkg/options')
# bbl_files
subdir('pkg/bbl')
# otx_files
subdir('pkg/otx')
# inav_files
subdir('pkg/inav')
# kml_files
subdir('pkg/kmlgen')
# blt_files
subdir('pkg/bltmqtt')
# ltm_files
subdir('pkg/ltmgen')
# bltr_files
subdir('pkg/bltreader')
# l2m_files
subdir('pkg/log2mission')
# aplog_files
subdir('pkg/aplog')
# sitl_files
subdir('pkg/sitlgen')
# inav_files
subdir('pkg/cli')
# inav_files
subdir('pkg/styles')
fl2kml_deps = [common_files, bbl_files, otx_files, inav_files, cli_files, style_files, kml_files, bltr_files, aplog_files]
fl2mqtt_deps = [common_files, bbl_files, otx_files, inav_files, blt_files, bltr_files, ltm_files, aplog_files ]
log2mission_deps = [common_files, bbl_files, otx_files, inav_files, blt_files, bltr_files, ltm_files, aplog_files ]
mission2kml_deps = [common_files, cli_files, style_files, kml_files ]
fl2sitl_deps = [common_files, bbl_files, sitl_files]
flightlog2kml = custom_target(
'flightlog2kml',
output: 'flightlog2kml'+exe,
env : env,
input: [flightlog2kml_files, fl2kml_deps],
command: [ golang, 'build', trimpath, '-o', '@OUTPUT@', '-ldflags' , ldflags, flightlog2kml_path ],
build_by_default: true,
install: true,
install_dir: 'bin',
)
fl2mqtt = custom_target(
'fl2mqtt',
output: 'fl2mqtt'+exe,
input: [fl2mqtt_files, fl2mqtt_deps ],
env : env,
command: [ golang, 'build', trimpath, '-o', '@OUTPUT@', '-ldflags', ldflags, fl2mqtt_path],
build_by_default: true,
install: true,
install_dir: 'bin',
)
fl2sitl = custom_target(
'fl2sitl',
output: 'fl2sitl'+exe,
input: [fl2sitl_files, fl2sitl_deps ],
env : env,
command: [ golang, 'build', trimpath, '-o', '@OUTPUT@', '-ldflags', ldflags, fl2sitl_path ],
build_by_default: true,
install: true,
install_dir: 'bin',
)
log2mission = custom_target(
'log2mission',
output: 'log2mission'+exe,
input: [ log2mission_files, log2mission_deps ],
env : env,
command: [ golang, 'build', trimpath, '-o', '@OUTPUT@', '-ldflags', ldflags, log2mission_path ],
build_by_default: true,
install: true,
install_dir: 'bin',
)
mission2kml = custom_target(
'mission2kml',
output: 'mission2kml'+exe,
input: [ mission2kml_files, mission2kml_deps ],
env : env,
command: [ golang, 'build', trimpath, '-o', '@OUTPUT@', '-ldflags', ldflags, mission2kml_path ],
build_by_default: true,
install: true,
install_dir: 'bin',
)