From bf1305bfc28da216b2a54995bda2041262f92759 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 8 Nov 2018 00:11:37 +0100 Subject: [PATCH] Switch build systems to Meson. --- .gitignore | 27 +--- Makefile | 196 ----------------------- README | 21 ++- meson.build | 243 +++++++++++++++++++++++++++++ meson_options.txt | 7 + scripts/compile_cef_dll_wrapper.sh | 14 ++ scripts/setup_nageru_symlink.sh | 3 + 7 files changed, 283 insertions(+), 228 deletions(-) delete mode 100644 Makefile create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100755 scripts/compile_cef_dll_wrapper.sh create mode 100755 scripts/setup_nageru_symlink.sh diff --git a/.gitignore b/.gitignore index 2c78fd3..2416a67 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1 @@ -*.d -*.o -*.pb.h -*.pb.cc -*.moc.cpp -ui_aboutdialog.h -ui_analyzer.h -ui_audio_expanded_view.h -ui_audio_miniview.h -ui_display.h -ui_input_mapping.h -ui_mainwindow.h -ui_midi_mapping.h -nageru -benchmark_audio_mixer -kaeru - -# CEF -*.bin -*.pak -icudtl.dat -libcef.so -libEGL.so -libGLESv2.so -swiftshader/ -locales/ +obj/ diff --git a/Makefile b/Makefile deleted file mode 100644 index d1cb650..0000000 --- a/Makefile +++ /dev/null @@ -1,196 +0,0 @@ -CXX=g++ -PROTOC=protoc -INSTALL=install -EMBEDDED_BMUSB=no -PKG_MODULES := Qt5Core Qt5Gui Qt5Widgets Qt5OpenGLExtensions Qt5OpenGL Qt5PrintSupport libusb-1.0 movit luajit libmicrohttpd epoxy x264 protobuf -CXXFLAGS ?= -O2 -g -Wall # Will be overridden by environment. -CXXFLAGS += -std=gnu++11 -fPIC $(shell pkg-config --cflags $(PKG_MODULES)) -pthread -DMOVIT_SHADER_DIR=\"$(shell pkg-config --variable=shaderdir movit)\" -Idecklink/ - -# Override CEF_DIR on the command line to build with CEF. -# E.g.: make CEF_DIR=/home/sesse/cef_binary_3.3282.1734.g8f26fe0_linux64 -CEF_DIR= - -# Release or Debug, depending on what CEF version you want to link to. -# Optionally, the special value CEF_BUILD_TYPE=system assumes you can build and link -# to CEF without any special flags, get the remaining libraries (libEGL.so, -# natives_blob.bin, etc.) from $(CEF_LIB), get resources from $(CEF_RESOURCE_DIR), -# and symlink resources instead of copying them in. -CEF_BUILD_TYPE=Release -ifneq ($(CEF_DIR),) - CPPFLAGS += -DHAVE_CEF=1 - ifeq ($(CEF_BUILD_TYPE),system) - EXTRA_CEF_LDFLAGS = - CEF_LIB_DIR = $(CEF_DIR) - CEF_RESOURCE_DIR = /usr/share/cef/Resources - CEF_CP = ln -s - else - CEF_LIBS = $(CEF_DIR)/libcef_dll_wrapper/libcef_dll_wrapper.a - CPPFLAGS += -I$(CEF_DIR) -I$(CEF_DIR)/include - EXTRA_CEF_LDFLAGS = -L$(CEF_DIR)/$(CEF_BUILD_TYPE) -Wl,-rpath,\$$ORIGIN - CEF_LIB_DIR = $(CEF_DIR)/$(CEF_BUILD_TYPE) - CEF_RESOURCE_DIR = $(CEF_DIR)/Resources - CEF_CP = cp -a - endif -endif - -ifeq ($(EMBEDDED_BMUSB),yes) - CPPFLAGS += -Ibmusb/ -else - PKG_MODULES += bmusb -endif -LDLIBS=$(shell pkg-config --libs $(PKG_MODULES)) -pthread -lva -lva-drm -lva-x11 -lX11 -lavformat -lavcodec -lavutil -lswscale -lavresample -lzita-resampler -lasound -ldl -lqcustomplot -ifneq ($(CEF_DIR),) - EXTRA_CEF_LDLIBS = -lcef - ifeq ($(CEF_BUILD_TYPE),system) - # Don't build this ourselves; just link to the system version. - EXTRA_CEF_LDLIBS += -lcef_dll_wrapper - endif -endif - -# Qt objects -OBJS_WITH_MOC = glwidget.o mainwindow.o vumeter.o lrameter.o compression_reduction_meter.o correlation_meter.o aboutdialog.o analyzer.o input_mapping_dialog.o midi_mapping_dialog.o nonlinear_fader.o -OBJS += $(OBJS_WITH_MOC) -OBJS += $(OBJS_WITH_MOC:.o=.moc.o) ellipsis_label.moc.o clickable_label.moc.o -OBJS += context_menus.o vu_common.o piecewise_interpolator.o main.o -OBJS += midi_mapper.o midi_mapping.pb.o - -# Mixer objects -AUDIO_MIXER_OBJS = audio_mixer.o alsa_input.o alsa_pool.o ebu_r128_proc.o stereocompressor.o resampling_queue.o flags.o correlation_measurer.o filter.o input_mapping.o state.pb.o -OBJS += chroma_subsampler.o v210_converter.o mixer.o basic_stats.o metrics.o pbo_frame_allocator.o context.o ref_counted_frame.o theme.o httpd.o flags.o image_input.o alsa_output.o disk_space_estimator.o print_latency.o timecode_renderer.o tweaked_inputs.o $(AUDIO_MIXER_OBJS) - -# Streaming and encoding objects -OBJS += quicksync_encoder.o x264_encoder.o x264_dynamic.o x264_speed_control.o video_encoder.o metacube2.o mux.o audio_encoder.o ffmpeg_raii.o ffmpeg_util.o json.pb.o - -# DeckLink -OBJS += decklink_capture.o decklink_util.o decklink_output.o memcpy_interleaved.o decklink/DeckLinkAPIDispatch.o - -KAERU_OBJS = kaeru.o x264_encoder.o mux.o basic_stats.o metrics.o flags.o audio_encoder.o x264_speed_control.o print_latency.o x264_dynamic.o ffmpeg_raii.o ref_counted_frame.o ffmpeg_capture.o ffmpeg_util.o httpd.o json.pb.o metacube2.o - -# bmusb -ifeq ($(EMBEDDED_BMUSB),yes) - OBJS += bmusb/bmusb.o bmusb/fake_capture.o - KAERU_OBJS += bmusb/bmusb.o -endif - -# FFmpeg input -OBJS += ffmpeg_capture.o - -ifneq ($(CEF_DIR),) - # CEF input - OBJS += nageru_cef_app.o cef_capture.o -endif - -# Benchmark program. -BM_OBJS = benchmark_audio_mixer.o $(AUDIO_MIXER_OBJS) flags.o metrics.o - -%.o: %.cpp - $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< -%.o: %.cc - $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< -%.pb.cc %.pb.h : %.proto - $(PROTOC) --cpp_out=. $< - -ui_%.h: %.ui - uic $< -o $@ - -%.moc.cpp: %.h - moc $< -o $@ - -ifneq ($(CEF_DIR),) -CEF_RESOURCES = natives_blob.bin snapshot_blob.bin v8_context_snapshot.bin -CEF_RESOURCES += cef.pak cef_100_percent.pak cef_200_percent.pak cef_extensions.pak devtools_resources.pak -CEF_RESOURCES += libEGL.so libGLESv2.so -CEF_RESOURCES += locales/en-US.pak -ifneq ($(CEF_NO_ICUDTL),yes) -CEF_RESOURCES += icudtl.dat -endif -ifneq ($(CEF_BUILD_TYPE),system) -CEF_RESOURCES += libcef.so -endif -endif - -all: nageru kaeru benchmark_audio_mixer $(CEF_RESOURCES) - -nageru: $(OBJS) $(CEF_LIBS) - $(CXX) -o $@ $^ $(LDFLAGS) $(EXTRA_CEF_LDFLAGS) $(LDLIBS) $(EXTRA_CEF_LDLIBS) $(CEF_LIBS) -kaeru: $(KAERU_OBJS) - $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) -benchmark_audio_mixer: $(BM_OBJS) - $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) - -ifneq ($(CEF_DIR),) -# A lot of these unfortunately have to be in the same directory as the binary; -# some can be given paths, but not all. -libcef.so: $(CEF_LIB_DIR)/libcef.so - $(CEF_CP) $< $@ -libEGL.so: $(CEF_LIB_DIR)/libEGL.so - $(CEF_CP) $< $@ -libGLESv2.so: $(CEF_LIB_DIR)/libGLESv2.so - $(CEF_CP) $< $@ -locales/: - mkdir locales/ -locales/en-US.pak: | locales/ $(CEF_RESOURCE_DIR)/locales/en-US.pak - $(CEF_CP) $(CEF_RESOURCE_DIR)/locales/en-US.pak $@ -icudtl.dat: $(CEF_RESOURCE_DIR)/icudtl.dat - $(CEF_CP) $< $@ -%.bin: $(CEF_LIB_DIR)/%.bin - $(CEF_CP) $< $@ -%.pak: $(CEF_RESOURCE_DIR)/%.pak - $(CEF_CP) $< $@ -endif - -# Extra dependencies that need to be generated. -aboutdialog.o: ui_aboutdialog.h -analyzer.o: ui_analyzer.h -alsa_pool.o: state.pb.h -audio_mixer.o: state.pb.h -input_mapping.o: state.pb.h -input_mapping_dialog.o: ui_input_mapping.h -mainwindow.o: ui_mainwindow.h ui_display.h ui_audio_miniview.h ui_audio_expanded_view.h ui_midi_mapping.h -mainwindow.o: midi_mapping.pb.h -midi_mapper.o: midi_mapping.pb.h -midi_mapping_dialog.o: ui_midi_mapping.h midi_mapping.pb.h -mixer.o: json.pb.h - -# CEF wrapper library; typically not built as part of the binary distribution. -$(CEF_DIR)/libcef_dll_wrapper/libcef_dll_wrapper.a: $(CEF_DIR)/Makefile - cd $(CEF_DIR) && $(MAKE) libcef_dll_wrapper - -$(CEF_DIR)/Makefile: - cd $(CEF_DIR) && cmake . - -DEPS=$(OBJS:.o=.d) $(BM_OBJS:.o=.d) $(KAERU_OBJS:.o=.d) --include $(DEPS) - -clean: - $(RM) $(OBJS) $(BM_OBJS) $(KAERU_OBJS) $(DEPS) nageru kaeru benchmark_audio_mixer ui_aboutdialog.h ui_analyzer.h ui_mainwindow.h ui_display.h ui_about.h ui_audio_miniview.h ui_audio_expanded_view.h ui_input_mapping.h ui_midi_mapping.h chain-*.frag *.dot *.pb.cc *.pb.h $(OBJS_WITH_MOC:.o=.moc.cpp) ellipsis_label.moc.cpp clickable_label.moc.cpp $(CEF_LIBS) $(CEF_RESOURCES) - -PREFIX=/usr/local -install: install-cef - $(INSTALL) -m 755 -o root -g root -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/nageru $(DESTDIR)$(PREFIX)/lib/nageru - $(INSTALL) -m 755 -o root -g root nageru $(DESTDIR)$(PREFIX)/lib/nageru/nageru - ln -s $(PREFIX)/lib/nageru/nageru $(DESTDIR)$(PREFIX)/bin/nageru - $(INSTALL) -m 755 -o root -g root kaeru $(DESTDIR)$(PREFIX)/bin/kaeru - $(INSTALL) -m 644 -o root -g root theme.lua $(DESTDIR)$(PREFIX)/share/nageru/theme.lua - $(INSTALL) -m 644 -o root -g root simple.lua $(DESTDIR)$(PREFIX)/share/nageru/simple.lua - $(INSTALL) -m 644 -o root -g root bg.jpeg $(DESTDIR)$(PREFIX)/share/nageru/bg.jpeg - $(INSTALL) -m 644 -o root -g root akai_midimix.midimapping $(DESTDIR)$(PREFIX)/share/nageru/akai_midimix.midimapping - -ifneq ($(CEF_DIR),) - ifeq ($(CEF_BUILD_TYPE),system) -install-cef: - for FILE in $(CEF_RESOURCES); do \ - mkdir -p `dirname $(DESTDIR)$(PREFIX)/lib/nageru/$$FILE`; \ - cp -a $$FILE $(DESTDIR)$(PREFIX)/lib/nageru/$$FILE; \ - done - - else -install-cef: - for FILE in $(CEF_LIBS) $(CEF_RESOURCES); do \ - $(INSTALL) -D -m 644 -o root -g root $$FILE $(DESTDIR)$(PREFIX)/lib/nageru/$$FILE; \ - done - - endif -else -install-cef: -endif diff --git a/README b/README index 70885a2..e02ea23 100644 --- a/README +++ b/README @@ -71,6 +71,8 @@ Nageru currently needs: - LuaJIT, for driving the theme engine. + - Meson, for building. + - Optional: CEF (Chromium Embedded Framework), for HTML graphics. If you build without CEF, the HTMLInput class will not be available from the theme. You can get binary downloads of CEF from @@ -78,8 +80,8 @@ Nageru currently needs: http://opensource.spotify.com/cefbuilds/index.html Simply download the right build for your platform (the “minimal” build - is fine) and add CEF_DIR=/cef_binary_X.XXXX.XXXX.XXXXXXXX_linux64 - on the make command line (substituting X with the real version as required). + is fine) and add -Dcef_dir=/cef_binary_X.XXXX.XXXX.XXXXXXXX_linux64 + on the meson command line (substituting X with the real version as required). If on Debian stretch or something similar, you can install everything you need @@ -92,24 +94,31 @@ with: libasound2-dev libx264-dev libbmusb-dev protobuf-compiler \ libprotobuf-dev -Exceptions as of April 2018: +Exceptions as of November 2018: - You will need Movit from testing or unstable; stretch only has 1.4.0. - You will need bmusb from testing or unstable; stretch only has 0.5.4. + - You will need a Meson backport; the version in stretch is too old. + - Debian does not carry CEF (but it is optional). You can get experimental (and not security-supported) CEF Debian packages built for unstable at - http://storage.sesse.net/cef/, and then build Nageru with + http://storage.sesse.net/cef/, and then configure Nageru with - make CEF_DIR=/usr/lib/x86_64-linux-gnu/cef CEF_BUILD_TYPE=system CEF_NO_ICUDTL=yes + meson obj -Dcef_dir=/usr/lib/x86_64-linux-gnu/cef -Dcef_build_type=system -Dcef_no_icudtl=true The patches/ directory contains a patch that helps zita-resampler performance. It is meant for upstream, but was not in at the time Nageru was released. It is taken to be by Steinar H. Gunderson (ie., my ex-work email), and under the same license as zita-resampler itself. -To start it, just hook up your equipment, type “make” and then “./nageru”. +Nageru uses Meson to build. For a default build, type + + meson obj && cd obj && ninja + +To start it, just hook up your equipment, and then type “./nageru”. + It is strongly recommended to have the rights to run at real-time priority; it will make the USB3 threads do so, which will make them a lot more stable. (A reasonable hack for testing is probably just to run it as root using sudo, diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..3f4935b --- /dev/null +++ b/meson.build @@ -0,0 +1,243 @@ +project('nageru', 'cpp', default_options: ['buildtype=debugoptimized']) +qt5 = import('qt5') +protoc = find_program('protoc') +cxx = meson.get_compiler('cpp') + +embedded_bmusb = get_option('embedded_bmusb') + +alsadep = dependency('alsa') +bmusbdep = dependency('bmusb', required: not embedded_bmusb) +dldep = cxx.find_library('dl') +epoxydep = dependency('epoxy') +libavcodecdep = dependency('libavcodec') +libavformatdep = dependency('libavformat') +libavresampledep = dependency('libavresample') +libavutildep = dependency('libavutil') +libjpegdep = dependency('libjpeg') +libmicrohttpddep = dependency('libmicrohttpd') +libswscaledep = dependency('libswscale') +libusbdep = dependency('libusb-1.0') +luajitdep = dependency('luajit') +movitdep = dependency('movit') +protobufdep = dependency('protobuf') +qcustomplotdep = cxx.find_library('qcustomplot') +qt5deps = dependency('qt5', modules: ['Core', 'Gui', 'Widgets', 'OpenGLExtensions', 'OpenGL', 'PrintSupport']) +threaddep = dependency('threads') +vadrmdep = dependency('libva-drm') +vax11dep = dependency('libva-x11') +x11dep = dependency('x11') +x264dep = dependency('x264') +zitaresamplerdep = cxx.find_library('zita-resampler') + +srcs = [] +nageru_deps = [qt5deps, libjpegdep, movitdep, libmicrohttpddep, protobufdep, + vax11dep, vadrmdep, x11dep, libavformatdep, libavresampledep, libavcodecdep, libavutildep, + libswscaledep, libusbdep, luajitdep, dldep, x264dep, alsadep, zitaresamplerdep, + qcustomplotdep, threaddep] +nageru_include_dirs = [] +nageru_link_with = [] +nageru_link_args = [] +nageru_build_rpath = '' +nageru_install_rpath = '' + +kaeru_link_with = [] +kaeru_extra_deps = [] + +# DeckLink has these issues, and we include it from various places. +if cxx.has_argument('-Wno-non-virtual-dtor') + add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp') +endif + +# FFmpeg has a lot of deprecated APIs whose replacements are not available +# in Debian stable, so we suppress these warnings. +if cxx.has_argument('-Wno-deprecated-declarations') + add_project_arguments('-Wno-deprecated-declarations', language: 'cpp') +endif + +# Add the right MOVIT_SHADER_DIR definition. +r = run_command('pkg-config', '--variable=shaderdir', 'movit') +if r.returncode() != 0 + error('Movit pkg-config installation is broken.') +endif +add_project_arguments('-DMOVIT_SHADER_DIR="' + r.stdout().strip() + '"', language: 'cpp') + +# CEF. +exe_dir = join_paths(get_option('prefix'), 'lib/nageru') +cef_dir = get_option('cef_dir') +cef_build_type = get_option('cef_build_type') +have_cef = (cef_dir != '') +if have_cef + add_project_arguments('-DHAVE_CEF=1', language: 'cpp') + + system_cef = (cef_build_type == 'system') + if system_cef + cef_lib_dir = cef_dir + cef_resource_dir = '/usr/share/cef/Resources' + else + cef_lib_dir = join_paths(cef_dir, cef_build_type) + cef_resource_dir = join_paths(cef_dir, 'Resources') + + nageru_include_dirs += include_directories(cef_dir) + nageru_include_dirs += include_directories(join_paths(cef_dir, 'include')) + nageru_build_rpath = cef_lib_dir + nageru_install_rpath = '$ORIGIN/' + endif + + cefdep = cxx.find_library('cef') + nageru_deps += cefdep + + # CEF wrapper library; not built as part of the CEF binary distribution, + # but should be if CEF is installed as a system library. + if system_cef + cefdlldep = cxx.find_library('cef_dll_wrapper') + nageru_deps += cefdlldep + else + cmake = find_program('cmake') + cef_compile_script = find_program('scripts/compile_cef_dll_wrapper.sh') + + cef_dll_target = custom_target('libcef_dll_wrapper', + input: join_paths(cef_dir, 'libcef_dll/CMakeLists.txt'), + output: ['libcef_dll_wrapper.a', 'cef-stamp'], + command: [cef_compile_script, '@BUILD_DIR@', cef_dir, cmake, '@OUTPUT@']) + + # Putting the .a in sources seemingly hits a bug where the .a files get sorted + # in the wrong order. This is a workaround; see + # https://github.com/mesonbuild/meson/issues/3613#issuecomment-408276296 . + cefdlldep = declare_dependency(sources: cef_dll_target[1], link_args: cef_dll_target.full_path()) + nageru_deps += cefdlldep + endif + + cef_libs = ['libEGL.so', 'libGLESv2.so', 'natives_blob.bin', 'snapshot_blob.bin', 'v8_context_snapshot.bin'] + cef_resources = ['cef.pak', 'cef_100_percent.pak', 'cef_200_percent.pak', 'cef_extensions.pak', 'devtools_resources.pak'] + if not get_option('cef_no_icudtl') + cef_resources += ['icudtl.dat'] + endif + if cef_build_type != 'system' + cef_libs += ['libcef.so'] + endif + + # Symlink the files into the build directory, so that running nageru without ninja install works. + run_command('mkdir', join_paths(meson.current_build_dir(), 'locales/')) + foreach file : cef_libs + run_command('ln', '-s', join_paths(cef_lib_dir, file), meson.current_build_dir()) + install_data(join_paths(cef_lib_dir, file), install_dir: exe_dir) + endforeach + foreach file : cef_resources + run_command('ln', '-s', join_paths(cef_resource_dir, file), meson.current_build_dir()) + install_data(join_paths(cef_resource_dir, file), install_dir: exe_dir) + endforeach + run_command('ln', '-s', join_paths(cef_resource_dir, 'locales/en-US.pak'), join_paths(meson.current_build_dir(), 'locales/')) + install_data(join_paths(cef_resource_dir, 'locales/en-US.pak'), install_dir: join_paths(exe_dir, 'locales')) +endif + +# bmusb. +if embedded_bmusb + bmusb_dir = include_directories('bmusb') + nageru_include_dirs += bmusb_dir + + bmusb = static_library('bmusb', 'bmusb/bmusb.cpp', 'bmusb/fake_capture.cpp', + dependencies: [libusbdep], + include_directories: [bmusb_dir]) + nageru_link_with += bmusb + kaeru_link_with += bmusb +else + nageru_deps += bmusbdep + kaeru_extra_deps += bmusbdep +endif + +# Protobuf compilation. +gen = generator(protoc, \ + output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'], + arguments : ['--proto_path=@CURRENT_SOURCE_DIR@', '--cpp_out=@BUILD_DIR@', '@INPUT@']) +proto_generated = gen.process(['state.proto', 'midi_mapping.proto', 'json.proto']) +protobuf_lib = static_library('protobufs', proto_generated, dependencies: nageru_deps, include_directories: nageru_include_dirs) +protobuf_hdrs = declare_dependency(sources: proto_generated) +nageru_link_with += protobuf_lib + +# Preprocess Qt as needed. +qt_files = qt5.preprocess( + moc_headers: ['aboutdialog.h', 'analyzer.h', 'clickable_label.h', 'compression_reduction_meter.h', 'correlation_meter.h', + 'ellipsis_label.h', 'glwidget.h', 'input_mapping_dialog.h', 'lrameter.h', 'mainwindow.h', 'midi_mapping_dialog.h', + 'nonlinear_fader.h', 'vumeter.h'], + ui_files: ['aboutdialog.ui', 'analyzer.ui', 'audio_expanded_view.ui', 'audio_miniview.ui', 'display.ui', + 'input_mapping.ui', 'mainwindow.ui', 'midi_mapping.ui'], + dependencies: qt5deps) + +# Qt objects. +srcs += ['glwidget.cpp', 'mainwindow.cpp', 'vumeter.cpp', 'lrameter.cpp', 'compression_reduction_meter.cpp', + 'correlation_meter.cpp', 'aboutdialog.cpp', 'analyzer.cpp', 'input_mapping_dialog.cpp', 'midi_mapping_dialog.cpp', + 'nonlinear_fader.cpp', 'context_menus.cpp', 'vu_common.cpp', 'piecewise_interpolator.cpp', 'midi_mapper.cpp'] + +# Auxiliary objects used for nearly everything. +aux_srcs = ['metrics.cpp', 'flags.cpp'] +aux = static_library('aux', aux_srcs, dependencies: nageru_deps, include_directories: nageru_include_dirs) +nageru_link_with += aux + +# Audio objects. +audio_mixer_srcs = ['audio_mixer.cpp', 'alsa_input.cpp', 'alsa_pool.cpp', 'ebu_r128_proc.cc', 'stereocompressor.cpp', + 'resampling_queue.cpp', 'flags.cpp', 'correlation_measurer.cpp', 'filter.cpp', 'input_mapping.cpp'] +audio = static_library('audio', audio_mixer_srcs, dependencies: [nageru_deps, protobuf_hdrs], include_directories: nageru_include_dirs) +nageru_link_with += audio + +# Mixer objects. +srcs += ['chroma_subsampler.cpp', 'v210_converter.cpp', 'mixer.cpp', 'pbo_frame_allocator.cpp', + 'context.cpp', 'theme.cpp', 'image_input.cpp', 'alsa_output.cpp', + 'disk_space_estimator.cpp', 'timecode_renderer.cpp', 'tweaked_inputs.cpp'] + +# Streaming and encoding objects (largely the set that is shared between Nageru and Kaeru). +stream_srcs = ['quicksync_encoder.cpp', 'x264_encoder.cpp', 'x264_dynamic.cpp', 'x264_speed_control.cpp', 'video_encoder.cpp', + 'metacube2.cpp', 'mux.cpp', 'audio_encoder.cpp', 'ffmpeg_raii.cpp', 'ffmpeg_util.cpp', 'httpd.cpp', 'ffmpeg_capture.cpp', + 'print_latency.cpp', 'basic_stats.cpp', 'ref_counted_frame.cpp'] +stream = static_library('stream', stream_srcs, dependencies: nageru_deps, include_directories: nageru_include_dirs) +nageru_link_with += stream + +# DeckLink. +srcs += ['decklink_capture.cpp', 'decklink_util.cpp', 'decklink_output.cpp', 'memcpy_interleaved.cpp', + 'decklink/DeckLinkAPIDispatch.cpp'] +decklink_dir = include_directories('decklink') +nageru_include_dirs += decklink_dir + +# CEF input. +if have_cef + srcs += ['nageru_cef_app.cpp', 'cef_capture.cpp'] +endif + +srcs += qt_files +srcs += proto_generated + +# Everything except main.cpp. (We do this because if you specify a .cpp file in +# both Nageru and Kaeru, it gets compiled twice. In the older Makefiles, Kaeru +# depended on a smaller set of objects.) +core = static_library('core', srcs, dependencies: nageru_deps, include_directories: nageru_include_dirs) +nageru_link_with += core + +# Nageru executable; it goes into /usr/lib/nageru since CEF files go there, too +# (we can't put them straight into /usr/bin). +executable('nageru', 'main.cpp', + dependencies: nageru_deps, + include_directories: nageru_include_dirs, + link_with: nageru_link_with, + link_args: nageru_link_args, + build_rpath: nageru_build_rpath, + install_rpath: nageru_install_rpath, + install: true, + install_dir: exe_dir +) +meson.add_install_script('scripts/setup_nageru_symlink.sh') + +# Kaeru executable. +executable('kaeru', 'kaeru.cpp', + dependencies: [nageru_deps, kaeru_extra_deps], + include_directories: nageru_include_dirs, + link_with: [stream, aux, kaeru_link_with], + install: true) + +# Audio mixer microbenchmark. +executable('benchmark_audio_mixer', 'benchmark_audio_mixer.cpp', dependencies: nageru_deps, include_directories: nageru_include_dirs, link_with: [audio, aux]) + +# These are needed for a default run. +data_files = ['theme.lua', 'simple.lua', 'bg.jpeg', 'akai_midimix.midimapping'] +install_data(data_files, install_dir: join_paths(get_option('prefix'), 'share/nageru')) +foreach file : data_files + run_command('ln', '-s', join_paths(meson.current_source_dir(), file), meson.current_build_dir()) +endforeach diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..115ba46 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,7 @@ +option('embedded_bmusb', type: 'boolean', value: false, description: 'Use bmusb from the bmusb/ git submodule instead of from the system') + +# Set this to build with CEF. +# E.g.: meson configure -Dcef_dir=/home/sesse/cef_binary_3.3282.1734.g8f26fe0_linux64 +option('cef_dir', type: 'string', description: 'If not empty, build against CEF in this directory') +option('cef_build_type', type: 'string', value: 'Release', description: 'CEF version to build against (Release or Debug, or “system” for a system-installed)') +option('cef_no_icudtl', type: 'boolean', value: false, description: 'Set to true if the CEF installation has no icudtl.dat.') diff --git a/scripts/compile_cef_dll_wrapper.sh b/scripts/compile_cef_dll_wrapper.sh new file mode 100755 index 0000000..ee8dbb2 --- /dev/null +++ b/scripts/compile_cef_dll_wrapper.sh @@ -0,0 +1,14 @@ +#! /bin/sh +set -e + +BUILD_DIR="$1" +CEF_DIR="$2" +CMAKE="$3" +OUTPUT="$4" +STAMP="$5" + +! [ -d "$BUILD_DIR" ] || rm -r "$BUILD_DIR" +mkdir "$BUILD_DIR" +( cd "$BUILD_DIR" && $CMAKE -G Ninja "$CEF_DIR" && ninja libcef_dll_wrapper ) +cp "$BUILD_DIR"/libcef_dll_wrapper/libcef_dll_wrapper.a "$OUTPUT" +touch "$STAMP" diff --git a/scripts/setup_nageru_symlink.sh b/scripts/setup_nageru_symlink.sh new file mode 100755 index 0000000..296f5cf --- /dev/null +++ b/scripts/setup_nageru_symlink.sh @@ -0,0 +1,3 @@ +#! /bin/sh +set -e +ln -sf ${MESON_INSTALL_PREFIX}/lib/nageru/nageru ${MESON_INSTALL_DESTDIR_PREFIX}/bin/nageru -- 2.39.2