From 75518672498504872322ad8b6a4abb564e298dd8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 18 Jan 2020 19:45:56 +0100 Subject: [PATCH] meson.build: move Log.cxx and LogBackend.cxx into a static library Prevents compiling those sources many times, once for each debug program using it. --- meson.build | 13 ++++++-- src/config/meson.build | 3 ++ src/db/meson.build | 1 + src/decoder/meson.build | 3 ++ src/event/meson.build | 1 + src/fs/meson.build | 1 + src/input/plugins/meson.build | 1 + src/lib/curl/meson.build | 1 + src/output/plugins/meson.build | 1 + src/zeroconf/meson.build | 2 ++ test/meson.build | 60 +--------------------------------- 11 files changed, 26 insertions(+), 61 deletions(-) diff --git a/meson.build b/meson.build index 4c2959c66..fef7c308c 100644 --- a/meson.build +++ b/meson.build @@ -190,6 +190,17 @@ if boost_dep.version() == '1.67' warning('Your Boost version 1.67 is known to be buggy, and the MPD build will fail. Please upgrade to Boost 1.68 or later.') endif +log = static_library( + 'log', + 'src/Log.cxx', + 'src/LogBackend.cxx', + include_directories: inc, +) + +log_dep = declare_dependency( + link_with: log, +) + sources = [ version_cxx, 'src/Main.cxx', @@ -235,8 +246,6 @@ sources = [ 'src/client/ThreadBackgroundCommand.cxx', 'src/Listen.cxx', 'src/LogInit.cxx', - 'src/LogBackend.cxx', - 'src/Log.cxx', 'src/ls.cxx', 'src/Instance.cxx', 'src/win32/Win32Main.cxx', diff --git a/src/config/meson.build b/src/config/meson.build index 21a2068b2..a07d98663 100644 --- a/src/config/meson.build +++ b/src/config/meson.build @@ -12,6 +12,9 @@ config = static_library( 'Domain.cxx', 'Net.cxx', include_directories: inc, + dependencies: [ + log_dep, + ], ) config_dep = declare_dependency( diff --git a/src/db/meson.build b/src/db/meson.build index 73f8bdc57..2a0c8a5bd 100644 --- a/src/db/meson.build +++ b/src/db/meson.build @@ -54,6 +54,7 @@ db_glue = static_library( include_directories: inc, dependencies: [ boost_dep, + log_dep, ], ) diff --git a/src/decoder/meson.build b/src/decoder/meson.build index 39aecbb91..072240cd0 100644 --- a/src/decoder/meson.build +++ b/src/decoder/meson.build @@ -5,6 +5,9 @@ decoder_api = static_library( 'DecoderBuffer.cxx', 'DecoderPlugin.cxx', include_directories: inc, + dependencies: [ + log_dep, + ], ) decoder_api_dep = declare_dependency( diff --git a/src/event/meson.build b/src/event/meson.build index bc13bbcd2..268734f5a 100644 --- a/src/event/meson.build +++ b/src/event/meson.build @@ -18,6 +18,7 @@ event = static_library( include_directories: inc, dependencies: [ boost_dep, + log_dep, ], ) diff --git a/src/fs/meson.build b/src/fs/meson.build index 8e49728cd..daf14a201 100644 --- a/src/fs/meson.build +++ b/src/fs/meson.build @@ -40,6 +40,7 @@ fs = static_library( include_directories: inc, dependencies: [ zlib_dep, + log_dep, ], ) diff --git a/src/input/plugins/meson.build b/src/input/plugins/meson.build index 77db192e3..95b9c6af5 100644 --- a/src/input/plugins/meson.build +++ b/src/input/plugins/meson.build @@ -85,6 +85,7 @@ input_plugins = static_library( input_plugins_sources, include_directories: inc, dependencies: [ + log_dep, alsa_dep, curl_dep, ffmpeg_dep, diff --git a/src/lib/curl/meson.build b/src/lib/curl/meson.build index 2b38957b4..08afd659b 100644 --- a/src/lib/curl/meson.build +++ b/src/lib/curl/meson.build @@ -15,6 +15,7 @@ curl = static_library( 'Form.cxx', include_directories: inc, dependencies: [ + log_dep, curl_dep, ], ) diff --git a/src/output/plugins/meson.build b/src/output/plugins/meson.build index bdfd47130..bb45576e3 100644 --- a/src/output/plugins/meson.build +++ b/src/output/plugins/meson.build @@ -6,6 +6,7 @@ output_plugins_deps = [ output_api_dep, config_dep, tag_dep, + log_dep, ] need_encoder = false diff --git a/src/zeroconf/meson.build b/src/zeroconf/meson.build index c2853b344..e1ca38e24 100644 --- a/src/zeroconf/meson.build +++ b/src/zeroconf/meson.build @@ -49,6 +49,7 @@ if zeroconf_option == 'bonjour' link_with: zeroconf, dependencies: [ bonjour_dep, + log_dep, ], ) else @@ -68,6 +69,7 @@ else libavahi_client_dep, dbus_dep, time_dep, + log_dep, ], ) diff --git a/test/meson.build b/test/meson.build index db78ada48..a13d7ca4a 100644 --- a/test/meson.build +++ b/test/meson.build @@ -23,8 +23,6 @@ subdir('net') executable( 'read_conf', 'read_conf.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ config_dep, @@ -65,8 +63,6 @@ test( test('TestRewindInputStream', executable( 'TestRewindInputStream', 'TestRewindInputStream.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ input_glue_dep, @@ -77,10 +73,9 @@ test('TestRewindInputStream', executable( test('test_mixramp', executable( 'test_mixramp', 'test_mixramp.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ + log_dep, util_dep, gtest_dep, ], @@ -111,8 +106,6 @@ test('TestFs', executable( 'TestFs', 'TestFs.cxx', 'TestLookupFile.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ fs_dep, @@ -136,8 +129,6 @@ if libavahi_client_dep.found() 'run_avahi', 'run_avahi.cxx', 'ShutdownHandler.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ zeroconf_dep, @@ -153,8 +144,6 @@ if enable_inotify 'ShutdownHandler.cxx', '../src/db/update/InotifyDomain.cxx', '../src/db/update/InotifySource.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ event_dep, @@ -180,8 +169,6 @@ executable( executable( 'WriteFile', 'WriteFile.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ fs_dep, @@ -191,8 +178,6 @@ executable( executable( 'dump_text_file', 'dump_text_file.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ input_glue_dep, @@ -213,8 +198,6 @@ if zlib_dep.found() executable( 'run_gunzip', 'run_gunzip.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ fs_dep, @@ -258,8 +241,6 @@ if neighbor_glue_dep.found() 'run_neighbor_explorer', 'run_neighbor_explorer.cxx', 'ShutdownHandler.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ neighbor_glue_dep, @@ -275,8 +256,6 @@ if enable_database executable( 'run_storage', 'run_storage.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ event_dep, @@ -288,8 +267,6 @@ if enable_database 'DumpDatabase', 'DumpDatabase.cxx', '../src/protocol/Ack.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', '../src/db/Registry.cxx', '../src/db/Selection.cxx', '../src/db/PlaylistVector.cxx', @@ -314,7 +291,6 @@ if enable_database '../src/playlist/PlaylistSong.cxx', '../src/SongLoader.cxx', '../src/LocateUri.cxx', - '../src/Log.cxx', include_directories: inc, dependencies: [ tag_dep, @@ -332,8 +308,6 @@ executable( 'run_input', 'run_input.cxx', '../src/TagSave.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ input_glue_dep, @@ -346,8 +320,6 @@ if curl_dep.found() 'RunCurl', 'RunCurl.cxx', 'ShutdownHandler.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ curl_dep, @@ -357,8 +329,6 @@ if curl_dep.found() test('test_icy_parser', executable( 'test_icy_parser', 'test_icy_parser.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ icu_dep, @@ -376,8 +346,6 @@ if archive_glue_dep.found() executable( 'visit_archive', 'visit_archive.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ archive_glue_dep, @@ -412,8 +380,6 @@ executable( 'dump_playlist.cxx', '../src/TagSave.cxx', '../src/TagFile.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ playlist_glue_dep, @@ -432,8 +398,6 @@ if chromaprint_dep.found() 'RunChromaprint', 'RunChromaprint.cxx', '../src/lib/chromaprint/DecoderClient.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ decoder_glue_dep, @@ -452,8 +416,6 @@ executable( 'run_decoder', 'run_decoder.cxx', 'DumpDecoderClient.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ decoder_glue_dep, @@ -465,8 +427,6 @@ executable( executable( 'read_tags', 'read_tags.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ decoder_glue_dep, @@ -480,8 +440,6 @@ executable( 'ContainerScan.cxx', '../src/SongSave.cxx', '../src/TagSave.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ decoder_glue_dep, @@ -493,8 +451,6 @@ executable( executable( 'ReadApeTags', 'ReadApeTags.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ tag_dep, @@ -507,8 +463,6 @@ if libid3tag_dep.found() executable( 'dump_rva2', 'dump_rva2.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ tag_dep, @@ -543,8 +497,6 @@ test('test_pcm', executable( executable( 'run_filter', 'run_filter.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ filter_glue_dep, @@ -573,8 +525,6 @@ executable( executable( 'run_convert', 'run_convert.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ pcm_dep, @@ -591,8 +541,6 @@ if encoder_glue_dep.found() 'run_encoder', 'run_encoder.cxx', '../src/AudioParser.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ encoder_glue_dep, @@ -602,8 +550,6 @@ if encoder_glue_dep.found() executable( 'test_vorbis_encoder', 'test_vorbis_encoder.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ encoder_glue_dep, @@ -618,8 +564,6 @@ endif executable( 'run_output', 'run_output.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ output_glue_dep, @@ -637,8 +581,6 @@ if alsa_dep.found() executable( 'read_mixer', 'read_mixer.cxx', - '../src/Log.cxx', - '../src/LogBackend.cxx', include_directories: inc, dependencies: [ mixer_glue_dep,