Skip to content

Commit cbaefaa

Browse files
committed
onebinary: entrypoint dynamically gets headers too
1 parent 9836dd6 commit cbaefaa

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ onebinary_stuff += 'MistOutHTTP'
212212
# onebinary_stuff += 'MistInBuffer'
213213

214214
onebinary_tgts = []
215-
onebinary_sources = []
215+
onebinary_headers = []
216216

217217
## This makes sure all (installable) executables are build in top level directory
218218
## Done because MistController expects its binaries to all be in the same directory
@@ -233,14 +233,15 @@ foreach exec : executables
233233
)
234234
if onebinary_stuff.contains(exec.get('name'))
235235
onebinary_tgts += gen_src
236+
onebinary_headers += exec.get('headers')
236237
endif
237238
endforeach
238239

239240
prog_python = find_program('python3')
240241
script = files('scripts/onebinary_gen.py')
241242

242243
onebinary_header = custom_target('onebinary',
243-
input: [onebinary_tgts],
244+
input: [onebinary_tgts, onebinary_headers],
244245
output: ['controller_static_capabilities.cpp', 'mistserver.cpp'],
245246
command: [prog_python, script, '--cap-header', '@OUTPUT0@', '--entrypoint', '@OUTPUT1@', '@INPUT@'],
246247
depends: [onebinary_tgts]
@@ -272,7 +273,6 @@ onebinary = executable(
272273
'src/controller/controller_push.cpp',
273274
'src/controller/controller_variables.cpp',
274275
),
275-
onebinary_sources,
276276
io_cpp,
277277
header_tgts,
278278
embed_tgts,

scripts/onebinary_gen.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,28 @@
1818

1919
args = parser.parse_args()
2020

21+
json_files = []
22+
header_files = []
23+
for file in args.files:
24+
if file.endswith('.json'):
25+
json_files.append(file)
26+
elif file.endswith('h'):
27+
header_files.append(file)
28+
else:
29+
raise Exception("unknown file type: " + file)
30+
31+
# print('json')
32+
# print(json_files)
33+
# print('h')
34+
# print(header_files)
35+
2136
MIST_IN = "MistIn"
2237
MIST_OUT = "MistOut"
2338
CAP_LINE = ' capabilities["{category}"]["{connector}"] = JSON::fromString({json_str});'
2439

2540
capabilities = []
2641

27-
for name in args.files:
42+
for name in json_files:
2843
path = Path(name)
2944
stem = path.stem
3045
text = path.read_text().strip("\n")
@@ -76,12 +91,14 @@
7691
'#include <mist/socket.h>',
7792
'#include <mist/util.h>',
7893
'#include <mist/stream.h>',
94+
])
95+
96+
for header_file in header_files:
97+
entrypoint_lines.append('#include "' + header_file + '"')
98+
99+
entrypoint_lines.extend([
79100
'#include "src/output/mist_out.cpp"',
80-
'#include "src/output/output_rtmp.h"',
81-
'#include "src/output/output_hls.h"',
82-
'#include "src/output/output_http_internal.h"',
83101
'#include "src/input/mist_in.cpp"',
84-
'#include "src/input/input_buffer.h"',
85102
'#include "src/session.cpp"',
86103
'#include "src/controller/controller.cpp"',
87104
'int main(int argc, char *argv[]){',

src/input/meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ foreach input : inputs
6161
deps += av_libs
6262
endif
6363

64+
inputtype_header = 'input_'+input.get('format')+'.h'
65+
6466
executables += {
6567
'name' : 'MistIn'+input.get('name'),
6668
'sources' : [
@@ -74,7 +76,10 @@ foreach input : inputs
7476
],
7577
'deps' : deps,
7678
'defines': [
77-
string_opt.format('INPUTTYPE', 'input_'+input.get('format')+'.h')
79+
string_opt.format('INPUTTYPE', inputtype_header)
80+
],
81+
'headers': [
82+
inputtype_header
7883
]
7984
}
8085
endforeach

src/output/meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ foreach output : outputs
102102
sources += base
103103
endif
104104

105+
outputtype_header = 'output_'+output.get('format')+'.h'
106+
105107
executables += {
106108
'name': 'MistOut'+output.get('name'),
107109
'sources' : [
@@ -110,8 +112,11 @@ foreach output : outputs
110112
],
111113
'deps' : deps,
112114
'defines' : [
113-
string_opt.format('OUTPUTTYPE', 'output_'+output.get('format')+'.h'),
115+
string_opt.format('OUTPUTTYPE', outputtype_header),
114116
'-DTS_BASECLASS='+tsBaseClass
117+
],
118+
'headers' : [
119+
files(outputtype_header)
115120
]
116121
}
117122
endforeach

0 commit comments

Comments
 (0)