Meson edits

Change-Id: I37260c32d3b43e42ac2d6aa4f86e5a8d9446b61b
This commit is contained in:
Thulinma 2023-01-03 20:18:12 +01:00
parent f5dd8581fe
commit fbade20111
11 changed files with 65 additions and 78 deletions

View file

@ -125,11 +125,18 @@ libmist = library('mist',
'websocket.cpp', 'websocket.cpp',
extra_code, extra_code,
include_directories: incroot, include_directories: incroot,
dependencies: ssl_deps, dependencies: mist_deps,
install: true, install: true,
) )
libmist_dep = declare_dependency(
link_with: [libmist],
dependencies: mist_deps,
include_directories: incroot
)
if have_srt if have_srt
libmist_srt = library('mist_srt', 'socket_srt.cpp', include_directories: incroot, link_with: libmist, dependencies: libsrt, install: true) libmist_srt = library('mist_srt', 'socket_srt.cpp', dependencies: [libsrt, libmist_dep], install: true)
libmist_srt_dep = declare_dependency(link_with: [libmist_srt])
endif endif

View file

@ -13,9 +13,19 @@ release = release.strip()
# Grab version number from git, if available # Grab version number from git, if available
# Falls back to a file called "VERSION" or the string "Unknown" otherwise # Falls back to a file called "VERSION" or the string "Unknown" otherwise
rv = run_command('git', 'describe', '--tags', check: false) git = find_program('git', required: false)
version = rv.stdout().strip() if git.found()
if rv.returncode() != 0 rv = run_command(git, 'describe', '--tags', check: false)
version = rv.stdout().strip()
if rv.returncode() != 0
fs = import('fs')
if fs.is_file('VERSION')
version = fs.read('VERSION').strip()
else
version = 'Unknown'
endif
endif
else
fs = import('fs') fs = import('fs')
if fs.is_file('VERSION') if fs.is_file('VERSION')
version = fs.read('VERSION').strip() version = fs.read('VERSION').strip()
@ -90,7 +100,7 @@ message('Building release @0@ for version @1@ @ debug level @2@'.format(release,
# Set dependencies # Set dependencies
ssl_deps = [] mist_deps = []
if usessl if usessl
ccpp = meson.get_compiler('cpp') ccpp = meson.get_compiler('cpp')
@ -119,8 +129,8 @@ if usessl
mbedcrypto = mbedtls_proj.get_variable('mbedcrypto_dep') mbedcrypto = mbedtls_proj.get_variable('mbedcrypto_dep')
endif endif
srtp2 = dependency('libsrtp2', fallback : ['libsrtp2', 'libsrtp2_dep']) mist_deps += [mbedtls, mbedx509, mbedcrypto]
ssl_deps = [mbedtls, mbedx509, mbedcrypto] mist_deps += dependency('libsrtp2', default_options: ['tests=disabled'], fallback: ['libsrtp2', 'libsrtp2_dep'])
endif endif
libsrt = false libsrt = false
@ -135,6 +145,13 @@ if not get_option('NORIST')
endif endif
have_librist = not get_option('NORIST') and librist.found() have_librist = not get_option('NORIST') and librist.found()
# Add thread dependency since we always have thread code in libmist
mist_deps += dependency('threads')
# Add rt dependency when using shared memory
if not get_option('NOSHM')
mist_deps += ccpp.find_library('rt', required : true)
endif
# Set build targets # Set build targets
@ -160,7 +177,6 @@ foreach exec : executables
exec_tgts += executable( exec_tgts += executable(
exec.get('name'), exec.get('name'),
exec.get('sources'), exec.get('sources'),
link_with: exec.get('link'),
dependencies: exec.get('deps'), dependencies: exec.get('deps'),
cpp_args: exec.get('defines'), cpp_args: exec.get('defines'),
install: true, install: true,

View file

@ -21,20 +21,18 @@ foreach analyser : analysers
'analyser_'+analyser.get('format')+'.cpp'), 'analyser_'+analyser.get('format')+'.cpp'),
header_tgts, header_tgts,
], ],
'link': libmist,
'defines': [ 'defines': [
string_opt.format('ANALYSERHEADER', 'analyser_'+analyser.get('format')+'.h'), string_opt.format('ANALYSERHEADER', 'analyser_'+analyser.get('format')+'.h'),
'-DANALYSERTYPE=Analyser'+analyser.get('name') '-DANALYSERTYPE=Analyser'+analyser.get('name')
], ],
'deps': [] 'deps': [libmist_dep]
} }
endforeach endforeach
executables += { executables += {
'name': 'MistTranslateH264', 'name': 'MistTranslateH264',
'sources' : [files('h264_translate.cpp'), header_tgts], 'sources' : [files('h264_translate.cpp'), header_tgts],
'link': libmist,
'defines': [], 'defines': [],
'deps' : [] 'deps' : [libmist_dep]
} }

View file

@ -15,8 +15,7 @@ executables += {
'controller_push.cpp'), 'controller_push.cpp'),
header_tgts, header_tgts,
server_html], server_html],
'link': libmist,
'defines': [], 'defines': [],
'deps' : [] 'deps' : [libmist_dep]
} }

View file

@ -45,24 +45,20 @@ endif
inputs_tgts = [] inputs_tgts = []
foreach input : inputs foreach input : inputs
link_libs = [libmist] deps = [libmist_dep]
deps = []
if input.has_key('extra') if input.has_key('extra')
if input.get('extra').contains('with_rist') if input.get('extra').contains('with_rist')
deps += librist deps += librist
endif endif
if input.get('extra').contains('with_srt') if input.get('extra').contains('with_srt')
link_libs += libmist_srt deps += libmist_srt_dep
deps += libsrt deps += libsrt
endif endif
endif endif
if input.get('name').contains('AV') if input.get('name').contains('AV')
deps += av_libs deps += av_libs
endif endif
if input.get('name').contains('HLS')
deps += ssl_deps
endif
executables += { executables += {
'name' : 'MistIn'+input.get('name'), 'name' : 'MistIn'+input.get('name'),
@ -75,9 +71,7 @@ foreach input : inputs
io_cpp, io_cpp,
header_tgts header_tgts
], ],
'link' : link_libs,
'deps' : deps, 'deps' : deps,
'inc': [],
'defines': [ 'defines': [
string_opt.format('INPUTTYPE', 'input_'+input.get('format')+'.h') string_opt.format('INPUTTYPE', 'input_'+input.get('format')+'.h')
] ]

View file

@ -10,8 +10,7 @@ subdir('controller')
executables += { executables += {
'name': 'MistSession', 'name': 'MistSession',
'sources' : [files('session.cpp'), header_tgts], 'sources' : [files('session.cpp'), header_tgts],
'link': libmist,
'defines': [], 'defines': [],
'deps' : [] 'deps' : [libmist_dep]
} }

View file

@ -19,6 +19,7 @@ outputs = [
{'name' : 'RTSP', 'format' : 'rtsp'}, {'name' : 'RTSP', 'format' : 'rtsp'},
{'name' : 'WAV', 'format' : 'wav', 'extra': ['http']}, {'name' : 'WAV', 'format' : 'wav', 'extra': ['http']},
{'name' : 'SDP', 'format' : 'sdp', 'extra': ['http']}, {'name' : 'SDP', 'format' : 'sdp', 'extra': ['http']},
{'name' : 'HTTP', 'format' : 'http_internal', 'extra': ['http','embed']},
] ]
if usessl if usessl
@ -37,7 +38,7 @@ if have_srt
endif endif
if get_option('WITH_JPG') if get_option('WITH_JPG')
outputs += {'name' : 'JPG', 'format' : 'jpg', 'extra': ['http','jpg']} outputs += {'name' : 'JPG', 'format' : 'jpg', 'extra': ['http','embed']}
endif endif
if get_option('WITH_SANITY') if get_option('WITH_SANITY')
@ -53,11 +54,9 @@ output_cpp = files('output.cpp')
outputs_tgts = [] outputs_tgts = []
foreach output : outputs foreach output : outputs
link_libs = [libmist] deps = [libmist_dep]
deps = []
base = files('mist_out.cpp') base = files('mist_out.cpp')
tsBaseClass = 'Output' tsBaseClass = 'Output'
extra_tgt_dep = []
sources = [ sources = [
files('output.cpp', files('output.cpp',
@ -77,7 +76,6 @@ foreach output : outputs
endif endif
endif endif
if extra.contains('jpg') if extra.contains('jpg')
extra_tgt_dep = embed_tgts
endif endif
if extra.contains('ts') if extra.contains('ts')
sources += files('output_ts_base.cpp') sources += files('output_ts_base.cpp')
@ -86,28 +84,25 @@ foreach output : outputs
deps += librist deps += librist
endif endif
if extra.contains('with_srt') if extra.contains('with_srt')
link_libs += libmist_srt deps += libmist_srt_dep
deps += libsrt deps += libsrt
endif endif
if extra.contains('srtp') if extra.contains('srtp')
deps += srtp2
sources += files('output_webrtc_srtp.cpp', 'output_webrtc_srtp.h') sources += files('output_webrtc_srtp.cpp', 'output_webrtc_srtp.h')
endif endif
if extra.contains('embed')
sources += embed_tgts
endif
else else
sources += base sources += base
endif endif
if output.get('name').contains('HTTPS')
deps += ssl_deps
endif
executables += { executables += {
'name': 'MistOut'+output.get('name'), 'name': 'MistOut'+output.get('name'),
'sources' : [ 'sources' : [
sources, sources,
extra_tgt_dep,
header_tgts header_tgts
], ],
'link' : link_libs,
'deps' : deps, 'deps' : deps,
'defines' : [ 'defines' : [
string_opt.format('OUTPUTTYPE', 'output_'+output.get('format')+'.h'), string_opt.format('OUTPUTTYPE', 'output_'+output.get('format')+'.h'),
@ -116,22 +111,3 @@ foreach output : outputs
} }
endforeach endforeach
executables += {
'name' : 'MistOutHTTP',
'sources' : [
files(
'mist_out.cpp',
'output.cpp',
'output_http.cpp',
'output_http_internal.cpp',
),
io_cpp,
header_tgts,
embed_tgts,
],
'link' : libmist,
'defines' :[
string_opt.format('OUTPUTTYPE', 'output_http_internal.h')
],
'deps' : []
}

View file

@ -6,9 +6,10 @@ process_common = static_library('mist_process_common',
output_cpp, output_cpp,
io_cpp, io_cpp,
header_tgts, header_tgts,
include_directories: incroot, dependencies: libmist_dep,
install: false, install: false,
) )
process_common_dep = declare_dependency(link_with: process_common)
executables += { executables += {
'name' : 'MistProcFFMPEG', 'name' : 'MistProcFFMPEG',
@ -16,8 +17,7 @@ executables += {
files('process_ffmpeg.cpp'), files('process_ffmpeg.cpp'),
header_tgts header_tgts
], ],
'link' : [libmist, process_common], 'deps' :[libmist_dep, process_common_dep],
'deps' :[],
'defines': [], 'defines': [],
} }
@ -27,8 +27,7 @@ executables += {
files('process_exec.cpp'), files('process_exec.cpp'),
header_tgts header_tgts
], ],
'link' : [libmist, process_common], 'deps' :[libmist_dep, process_common_dep],
'deps' :[],
'defines': [], 'defines': [],
} }
@ -43,8 +42,7 @@ executables += {
io_cpp, io_cpp,
header_tgts header_tgts
], ],
'link' : [libmist], 'deps' :[libmist_dep],
'deps' :[],
'defines': [], 'defines': [],
} }

View file

@ -21,8 +21,7 @@ foreach util : utils
files('util_'+util.get('file')+'.cpp'), files('util_'+util.get('file')+'.cpp'),
header_tgts header_tgts
], ],
'link' : libmist, 'deps' : [libmist_dep],
'deps' : [],
'defines' :[], 'defines' :[],
} }
endforeach endforeach

View file

@ -11,6 +11,7 @@ if not mbedtls_lib.found()
mbedx509_lib = ccpp.find_library('mbedx509') mbedx509_lib = ccpp.find_library('mbedx509')
mbedcrypto_lib = ccpp.find_library('mbedcrypto') mbedcrypto_lib = ccpp.find_library('mbedcrypto')
endif endif
thread_dep = dependency('threads')
header_tgts = [] header_tgts = []
@ -64,13 +65,13 @@ srt_src = files(
libsrt = library( libsrt = library(
'srt', 'srt',
sources: [srt_src, versionfile], sources: [srt_src, versionfile],
dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib], dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib, thread_dep],
include_directories: ['srt', 'haicrypt', 'srtcore'] include_directories: ['srt', 'haicrypt', 'srtcore']
) )
srt_dep = declare_dependency( srt_dep = declare_dependency(
link_with : [libsrt], link_with : [libsrt],
dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib], dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib, thread_dep],
sources: [header_tgts], sources: [header_tgts],
include_directories: include_directories('.'), include_directories: include_directories('.'),
) )

View file

@ -1,23 +1,23 @@
# Testing binaries that are not unit tests, but intended for manual use # Testing binaries that are not unit tests, but intended for manual use
urltest = executable('urltest', 'url.cpp', include_directories: incroot, link_with: libmist) urltest = executable('urltest', 'url.cpp', dependencies: libmist_dep)
logtest = executable('logtest', 'log.cpp', include_directories: incroot, link_with: libmist) logtest = executable('logtest', 'log.cpp', dependencies: libmist_dep)
downloadertest = executable('downloadertest', 'downloader.cpp', include_directories: incroot, link_with: libmist) downloadertest = executable('downloadertest', 'downloader.cpp', dependencies: libmist_dep)
urireadertest = executable('urireadertest', 'urireader.cpp', include_directories: incroot, link_with: libmist, dependencies: ssl_deps) urireadertest = executable('urireadertest', 'urireader.cpp', dependencies: libmist_dep)
jsontest = executable('jsontest', 'json.cpp', include_directories: incroot, link_with: libmist) jsontest = executable('jsontest', 'json.cpp', dependencies: libmist_dep)
resolvetest = executable('resolvetest', 'resolve.cpp', include_directories: incroot, link_with: libmist, dependencies: ssl_deps) resolvetest = executable('resolvetest', 'resolve.cpp', dependencies: libmist_dep)
streamstatustest = executable('streamstatustest', 'status.cpp', include_directories: incroot, link_with: libmist) streamstatustest = executable('streamstatustest', 'status.cpp', dependencies: libmist_dep)
websockettest = executable('websockettest', 'websocket.cpp', include_directories: incroot, link_with: libmist) websockettest = executable('websockettest', 'websocket.cpp', dependencies: libmist_dep)
# Actual unit tests # Actual unit tests
dtsc_sizing_test = executable('dtsc_sizing_test', 'dtsc_sizing.cpp', include_directories: incroot, link_with: libmist) dtsc_sizing_test = executable('dtsc_sizing_test', 'dtsc_sizing.cpp', dependencies: libmist_dep)
test('DTSC Sizing Test', dtsc_sizing_test) test('DTSC Sizing Test', dtsc_sizing_test)
bitwritertest = executable('bitwritertest', 'bitwriter.cpp', include_directories: incroot, link_with: libmist) bitwritertest = executable('bitwritertest', 'bitwriter.cpp', dependencies: libmist_dep)
test('bitWriter Test', bitwritertest) test('bitWriter Test', bitwritertest)
#abst_test = executable('abst_test', 'abst_test.cpp', include_directories: incroot, link_with: libmist) #abst_test = executable('abst_test', 'abst_test.cpp', dependencies: libmist_dep)
#test('MP4::ABST Test', abst_test) #test('MP4::ABST Test', abst_test)