build: Make a src subdirectory
This will allow us to organize our c++ source separately from our
top-level metadata.
Change-Id: I3141fa63bf9be2ae1b1efee7a6f95ba53a569f5d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meson.build b/meson.build
index cf1ec16..6f9c3c5 100644
--- a/meson.build
+++ b/meson.build
@@ -8,41 +8,7 @@
'cpp_std=c++20',
])
-# CLI11 might not have a pkg-config. It is header only so just make
-# sure we can access the needed symbols from the header.
-cli11_dep = dependency('cli11', required: false)
-has_cli11 = meson.get_compiler('cpp').has_header_symbol(
- 'CLI/CLI.hpp',
- 'CLI::App',
- dependencies: cli11_dep,
- required: false)
-assert(has_cli11, 'CLI11 is required')
-
-executable(
- 'kcsbridged',
- 'kcsbridged.cpp',
- implicit_include_directories: false,
- dependencies: [
- dependency(
- 'boost',
- modules: [
- 'coroutine',
- 'context',
- ],
- ),
- cli11_dep,
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
- ],
- cpp_args: [
- '-DBOOST_ASIO_DISABLE_THREADS',
- '-DBOOST_ALL_NO_LIB',
- '-DBOOST_SYSTEM_NO_DEPRECATED',
- '-DBOOST_ERROR_CODE_HEADER_ONLY',
- '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
- ],
- install: true,
- install_dir: get_option('bindir'))
+subdir('src')
systemd = dependency('systemd')
if systemd.found()
diff --git a/kcsbridged.cpp b/src/kcsbridged.cpp
similarity index 100%
rename from kcsbridged.cpp
rename to src/kcsbridged.cpp
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..00394f0
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,35 @@
+# CLI11 might not have a pkg-config. It is header only so just make
+# sure we can access the needed symbols from the header.
+cli11_dep = dependency('cli11', required: false)
+has_cli11 = meson.get_compiler('cpp').has_header_symbol(
+ 'CLI/CLI.hpp',
+ 'CLI::App',
+ dependencies: cli11_dep,
+ required: false)
+assert(has_cli11, 'CLI11 is required')
+
+executable(
+ 'kcsbridged',
+ 'kcsbridged.cpp',
+ implicit_include_directories: false,
+ dependencies: [
+ dependency(
+ 'boost',
+ modules: [
+ 'coroutine',
+ 'context',
+ ],
+ ),
+ cli11_dep,
+ dependency('phosphor-logging'),
+ dependency('sdbusplus'),
+ ],
+ cpp_args: [
+ '-DBOOST_ASIO_DISABLE_THREADS',
+ '-DBOOST_ALL_NO_LIB',
+ '-DBOOST_SYSTEM_NO_DEPRECATED',
+ '-DBOOST_ERROR_CODE_HEADER_ONLY',
+ '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
+ ],
+ install: true,
+ install_dir: get_option('bindir'))