X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=meson.build;h=2efead5c8d85f48979a0a68eaa9bed50feb2f54d;hb=147a2d38463d983ec7c66ef5c4c9c6cce7d52787;hp=18f9272619bfcaa2bf77faa95e69c196db581648;hpb=92cca212dad5e4b968c052d8200a534473929674;p=nageru diff --git a/meson.build b/meson.build index 18f9272..2efead5 100644 --- a/meson.build +++ b/meson.build @@ -1,71 +1,40 @@ -project('futatabi', 'cpp') -qt5 = import('qt5') -protoc = find_program('protoc') +project('nageru', 'cpp', default_options: ['buildtype=debugoptimized']) -epoxydep = dependency('epoxy') -libavcodecdep = dependency('libavcodec') -libavformatdep = dependency('libavformat') -libavutildep = dependency('libavutil') -libjpegdep = dependency('libjpeg') -libmicrohttpddep = dependency('libmicrohttpd') -libswscaledep = dependency('libswscale') -movitdep = dependency('movit') -protobufdep = dependency('protobuf') -qt5deps = dependency('qt5', modules: ['Core', 'Gui', 'Widgets', 'OpenGLExtensions', 'OpenGL', 'PrintSupport']) -sdl2_imagedep = dependency('SDL2_image') -sdl2dep = dependency('sdl2') -sqlite3dep = dependency('sqlite3') -vadrmdep = dependency('libva-drm') -vax11dep = dependency('libva-x11') -x11dep = dependency('x11') +cxx = meson.get_compiler('cpp') + +# Use lld if we can; it links a lot faster than ld.bfd or gold. +code = '''#include +int main() { printf("Hello, world!\n"); return 0; } +''' +if cxx.links(code, args: '-fuse-ld=lld', name: 'check for LLD') + add_project_link_arguments('-fuse-ld=lld', 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.') + error('Movit pkg-config installation is broken.') endif -add_global_arguments('-DMOVIT_SHADER_DIR="' + r.stdout().strip() + '"', language: 'cpp') - -# 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') - -# Preprocess Qt as needed. -moc_files = qt5.preprocess( - moc_headers: ['mainwindow.h', 'jpeg_frame_view.h', 'clip_list.h'], - ui_files: ['mainwindow.ui'], - dependencies: qt5deps) +add_project_arguments('-DMOVIT_SHADER_DIR="' + r.stdout().strip() + '"', language: 'cpp') -# Flow objects. -srcs = ['flow.cpp', 'gpu_timers.cpp'] - -# All the other files. -srcs += ['ffmpeg_raii.cpp', 'main.cpp', 'player.cpp', 'httpd.cpp', 'mux.cpp', 'metacube2.cpp', 'video_stream.cpp', 'context.cpp', 'chroma_subsampler.cpp'] -srcs += ['vaapi_jpeg_decoder.cpp', 'memcpy_interleaved.cpp', 'db.cpp', 'disk_space_estimator.cpp', 'ycbcr_converter.cpp', 'flags.cpp'] -srcs += ['mainwindow.cpp', 'jpeg_frame_view.cpp', 'clip_list.cpp'] -srcs += moc_files -srcs += proto_generated +# 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 -# Shaders needed at runtime. -shaders = ['chroma_subsample.vert', 'densify.vert', 'equations.vert', 'hole_fill.vert', 'motion_search.vert', 'sor.vert', 'splat.vert', 'vs.vert'] -shaders += ['add_base_flow.frag', 'blend.frag', 'chroma_subsample.frag', 'densify.frag', 'derivatives.frag', 'diffusivity.frag', - 'equations.frag', 'gray.frag', 'hole_blend.frag', 'hole_fill.frag', 'motion_search.frag', 'prewarp.frag', 'resize_flow.frag', - 'sobel.frag', 'sor.frag', 'splat.frag'] +# 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 -foreach shader : shaders - run_command('ln', '-s', join_paths(meson.current_source_dir(), shader), meson.current_build_dir()) -endforeach +# This needs to be done before declaring any build targets. +if get_option('cef_dir') != '' + add_project_arguments('-DHAVE_CEF=1', language: 'cpp') +endif -bin2h = executable('bin2h', 'bin2h.cpp') -bin2h_gen = generator(bin2h, \ - output : ['@PLAINNAME@.cpp'], - arguments : ['@INPUT@', '@PLAINNAME@', '@OUTPUT@']) -shader_srcs = bin2h_gen.process(shaders) -srcs += shader_srcs +top_include = include_directories('.') -executable('futatabi', srcs, dependencies: [qt5deps, libjpegdep, movitdep, libmicrohttpddep, protobufdep, sqlite3dep, vax11dep, vadrmdep, x11dep, libavformatdep, libavcodecdep, libavutildep, libswscaledep]) -executable('flow', 'flow_main.cpp', 'flow.cpp', 'gpu_timers.cpp', shader_srcs, dependencies: [epoxydep, sdl2dep, sdl2_imagedep]) -executable('eval', 'eval.cpp', 'util.cpp') -executable('vis', 'vis.cpp', 'util.cpp') +subdir('shared') +subdir('nageru') +subdir('futatabi')