From 45b13fc2a601982c9186b969dbe10f087366c698 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Nov 2022 11:27:59 +0100 Subject: [PATCH] util/OptionParser: move to cmdline/ This library will depend on libfmt, and libutil shouldn't depend on any library. --- meson.build | 2 ++ src/CommandLine.cxx | 4 ++-- src/{util => cmdline}/OptionDef.hxx | 0 src/{util => cmdline}/OptionParser.cxx | 0 src/{util => cmdline}/OptionParser.hxx | 0 src/cmdline/meson.build | 9 +++++++++ src/util/meson.build | 1 - test/RunChromaprint.cxx | 4 ++-- test/meson.build | 5 +++++ test/run_convert.cxx | 4 ++-- test/run_decoder.cxx | 4 ++-- test/run_input.cxx | 4 ++-- test/run_output.cxx | 6 ++---- 13 files changed, 28 insertions(+), 15 deletions(-) rename src/{util => cmdline}/OptionDef.hxx (100%) rename src/{util => cmdline}/OptionParser.cxx (100%) rename src/{util => cmdline}/OptionParser.hxx (100%) create mode 100644 src/cmdline/meson.build diff --git a/meson.build b/meson.build index 7dc263c87..91bfaf075 100644 --- a/meson.build +++ b/meson.build @@ -392,6 +392,7 @@ if enable_database endif subdir('src/util') +subdir('src/cmdline') subdir('src/time') subdir('src/io') subdir('src/io/uring') @@ -529,6 +530,7 @@ mpd = build_target( target_type: target_type, include_directories: inc, dependencies: [ + cmdline_dep, basic_dep, config_dep, dbus_dep, diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 130b01556..10f901bb0 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -39,9 +39,9 @@ #include "fs/StandardDirectory.hxx" #include "event/Features.h" #include "io/uring/Features.h" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/Domain.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" #include "Version.h" #ifdef _WIN32 diff --git a/src/util/OptionDef.hxx b/src/cmdline/OptionDef.hxx similarity index 100% rename from src/util/OptionDef.hxx rename to src/cmdline/OptionDef.hxx diff --git a/src/util/OptionParser.cxx b/src/cmdline/OptionParser.cxx similarity index 100% rename from src/util/OptionParser.cxx rename to src/cmdline/OptionParser.cxx diff --git a/src/util/OptionParser.hxx b/src/cmdline/OptionParser.hxx similarity index 100% rename from src/util/OptionParser.hxx rename to src/cmdline/OptionParser.hxx diff --git a/src/cmdline/meson.build b/src/cmdline/meson.build new file mode 100644 index 000000000..1a160a1a2 --- /dev/null +++ b/src/cmdline/meson.build @@ -0,0 +1,9 @@ +cmdline = static_library( + 'cmdline', + 'OptionParser.cxx', + include_directories: inc, +) + +cmdline_dep = declare_dependency( + link_with: cmdline, +) diff --git a/src/util/meson.build b/src/util/meson.build index 760656e98..6fc6b89c0 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -22,7 +22,6 @@ util = static_library( 'PeakBuffer.cxx', 'PrintException.cxx', 'SparseBuffer.cxx', - 'OptionParser.cxx', 'ByteReverse.cxx', 'format.c', 'BitReverse.cxx', diff --git a/test/RunChromaprint.cxx b/test/RunChromaprint.cxx index 9e25ef6e8..bae4e12e7 100644 --- a/test/RunChromaprint.cxx +++ b/test/RunChromaprint.cxx @@ -28,8 +28,8 @@ #include "input/InputStream.hxx" #include "fs/Path.hxx" #include "pcm/AudioFormat.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/PrintException.hxx" #include "Log.hxx" #include "LogBackend.hxx" diff --git a/test/meson.build b/test/meson.build index 8970d2e7f..a19cdc3bc 100644 --- a/test/meson.build +++ b/test/meson.build @@ -294,6 +294,7 @@ run_input = executable( log_dep, input_glue_dep, archive_glue_dep, + cmdline_dep, ], ) @@ -402,6 +403,7 @@ if chromaprint_dep.found() input_glue_dep, archive_glue_dep, chromaprint_dep, + cmdline_dep, ], ) endif @@ -420,6 +422,7 @@ executable( decoder_glue_dep, input_glue_dep, archive_glue_dep, + cmdline_dep, ], ) @@ -546,6 +549,7 @@ executable( log_dep, pcm_dep, config_dep, + cmdline_dep, ], ) @@ -607,6 +611,7 @@ executable( output_glue_dep, encoder_glue_dep, event_dep, + cmdline_dep, ], ) diff --git a/test/run_convert.cxx b/test/run_convert.cxx index 297381f9a..b4f6941dc 100644 --- a/test/run_convert.cxx +++ b/test/run_convert.cxx @@ -31,8 +31,8 @@ #include "fs/NarrowPath.hxx" #include "io/FileDescriptor.hxx" #include "util/StaticFifoBuffer.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/PrintException.hxx" #include "Log.hxx" #include "LogBackend.hxx" diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index 0f8fcee7c..3f7fc4ef6 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -28,8 +28,8 @@ #include "fs/Path.hxx" #include "fs/NarrowPath.hxx" #include "pcm/AudioFormat.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/PrintException.hxx" #include "Log.hxx" #include "LogBackend.hxx" diff --git a/test/run_input.cxx b/test/run_input.cxx index 7b027357a..97cc81d27 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -35,8 +35,8 @@ #include "fs/NarrowPath.hxx" #include "io/BufferedOutputStream.hxx" #include "io/StdioOutputStream.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/PrintException.hxx" #ifdef ENABLE_ARCHIVE diff --git a/test/run_output.cxx b/test/run_output.cxx index bcb7b1402..39a134135 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -26,8 +26,8 @@ #include "fs/NarrowPath.hxx" #include "pcm/AudioParser.hxx" #include "pcm/AudioFormat.hxx" -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" +#include "cmdline/OptionDef.hxx" +#include "cmdline/OptionParser.hxx" #include "util/StringBuffer.hxx" #include "util/RuntimeError.hxx" #include "util/ScopeExit.hxx" @@ -106,8 +106,6 @@ LoadAudioOutput(const ConfigData &config, EventLoop &event_loop, if (plugin == nullptr) throw FormatRuntimeError("No such audio output plugin: %s", plugin_name); -#include "util/OptionDef.hxx" -#include "util/OptionParser.hxx" return std::unique_ptr(ao_plugin_init(event_loop, *plugin, *block));