Reorganize dbus interface builds
The previous structure is failing meson scan-build. Reorganize it to
follow the example in hothd and it will now build and pass the
scan-build.
Google-Bug-Id: 375055000
Change-Id: Icfdf023c78818f2499294642cf25c2be5cdb9378
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/gen/README b/gen/README
deleted file mode 100644
index 71182b5..0000000
--- a/gen/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory contains generated meson.build files from sdbus++-gen-meson.
-Do not edit them by hand.
diff --git a/gen/meson.build b/gen/meson.build
deleted file mode 100644
index b550c79..0000000
--- a/gen/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated file; do not modify.
-sdbuspp_gen_meson_ver = run_command(
- sdbuspp_gen_meson_prog,
- '--version',
- check: true,
-).stdout().strip().split('\n')[0]
-
-if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 7'
- warning('Generated meson files from wrong version of sdbus++-gen-meson.')
- warning(
- 'Expected "sdbus++-gen-meson version 7", got:',
- sdbuspp_gen_meson_ver
- )
-endif
-
diff --git a/gen/regenerate-meson b/gen/regenerate-meson
deleted file mode 100755
index a39ad64..0000000
--- a/gen/regenerate-meson
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-REPO_ROOT=$(git rev-parse --show-toplevel)
-
-# Find sdbus++-gen-meson
-# 1. Check $SDBUSPP_GEN_MESON
-# 2. Check in $PATH
-# 3. Check in subprojects/sdbusplus
-if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
- SDBUSPP_GEN_MESON="$(which sdbus++-gen-meson 2> /dev/null)"
-fi
-if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
- SDBUSPP_GEN_MESON="$REPO_ROOT/subprojects/sdbusplus/tools/sdbus++-gen-meson"
-fi
-if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
- echo "Cannot find sdbus++-gen-meson ($SDBUSPP_GEN_MESON)."
- exit 1
-fi
-
-$SDBUSPP_GEN_MESON \
- --command meson \
- --directory "$REPO_ROOT/yaml" \
- --output "$REPO_ROOT/gen"
diff --git a/gen/run-ci b/gen/run-ci
deleted file mode 100755
index dba8109..0000000
--- a/gen/run-ci
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-cd "$(dirname "$0")" || exit
-find . -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
-./regenerate-meson || exit
-rc=0
-git --no-pager diff --exit-code -- . || rc=$?
-untracked="$(git ls-files --others --exclude-standard -- .)" || rc=$?
-if [ -n "$untracked" ]; then
- echo "Untracked files:" >&2
- echo "$untracked" >&2
- rc=1
-fi
-if ((rc != 0)); then
- echo "Generated meson files differ from expected values" >&2
- exit 1
-fi
diff --git a/gen/xyz/meson.build b/gen/xyz/meson.build
deleted file mode 100644
index e4991ad..0000000
--- a/gen/xyz/meson.build
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated file; do not modify.
-subdir('openbmc_project')
diff --git a/gen/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build b/gen/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build
deleted file mode 100644
index 20a380c..0000000
--- a/gen/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated file; do not modify.
-generated_sources += custom_target(
- 'xyz/openbmc_project/Time/Boot/Checkpoint__cpp'.underscorify(),
- input: [ '../../../../../../yaml/xyz/openbmc_project/Time/Boot/Checkpoint.interface.yaml', ],
- output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.hpp', 'client.hpp', ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'cpp',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Checkpoint',
- ],
-)
-
diff --git a/gen/xyz/openbmc_project/Time/Boot/Duration/meson.build b/gen/xyz/openbmc_project/Time/Boot/Duration/meson.build
deleted file mode 100644
index a8809c4..0000000
--- a/gen/xyz/openbmc_project/Time/Boot/Duration/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated file; do not modify.
-generated_sources += custom_target(
- 'xyz/openbmc_project/Time/Boot/Duration__cpp'.underscorify(),
- input: [ '../../../../../../yaml/xyz/openbmc_project/Time/Boot/Duration.interface.yaml', ],
- output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.hpp', 'client.hpp', ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'cpp',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Duration',
- ],
-)
-
diff --git a/gen/xyz/openbmc_project/Time/Boot/Statistic/meson.build b/gen/xyz/openbmc_project/Time/Boot/Statistic/meson.build
deleted file mode 100644
index db7d927..0000000
--- a/gen/xyz/openbmc_project/Time/Boot/Statistic/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated file; do not modify.
-generated_sources += custom_target(
- 'xyz/openbmc_project/Time/Boot/Statistic__cpp'.underscorify(),
- input: [ '../../../../../../yaml/xyz/openbmc_project/Time/Boot/Statistic.interface.yaml', ],
- output: [ 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.hpp', 'client.hpp', ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'cpp',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Statistic',
- ],
-)
-
diff --git a/gen/xyz/openbmc_project/Time/Boot/meson.build b/gen/xyz/openbmc_project/Time/Boot/meson.build
deleted file mode 100644
index be9c07f..0000000
--- a/gen/xyz/openbmc_project/Time/Boot/meson.build
+++ /dev/null
@@ -1,46 +0,0 @@
-# Generated file; do not modify.
-subdir('Checkpoint')
-generated_others += custom_target(
- 'xyz/openbmc_project/Time/Boot/Checkpoint__markdown'.underscorify(),
- input: [ '../../../../../yaml/xyz/openbmc_project/Time/Boot/Checkpoint.interface.yaml', ],
- output: [ 'Checkpoint.md' ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'markdown',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Checkpoint',
- ],
-)
-
-subdir('Duration')
-generated_others += custom_target(
- 'xyz/openbmc_project/Time/Boot/Duration__markdown'.underscorify(),
- input: [ '../../../../../yaml/xyz/openbmc_project/Time/Boot/Duration.interface.yaml', ],
- output: [ 'Duration.md' ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'markdown',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Duration',
- ],
-)
-
-subdir('Statistic')
-generated_others += custom_target(
- 'xyz/openbmc_project/Time/Boot/Statistic__markdown'.underscorify(),
- input: [ '../../../../../yaml/xyz/openbmc_project/Time/Boot/Statistic.interface.yaml', ],
- output: [ 'Statistic.md' ],
- depend_files: sdbusplusplus_depfiles,
- command: [
- sdbuspp_gen_meson_prog, '--command', 'markdown',
- '--output', meson.current_build_dir(),
- '--tool', sdbusplusplus_prog,
- '--directory', meson.current_source_dir() / '../../../../../yaml',
- 'xyz/openbmc_project/Time/Boot/Statistic',
- ],
-)
-
diff --git a/gen/xyz/openbmc_project/Time/meson.build b/gen/xyz/openbmc_project/Time/meson.build
deleted file mode 100644
index 915b4bc..0000000
--- a/gen/xyz/openbmc_project/Time/meson.build
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated file; do not modify.
-subdir('Boot')
diff --git a/gen/xyz/openbmc_project/meson.build b/gen/xyz/openbmc_project/meson.build
deleted file mode 100644
index fe5aff0..0000000
--- a/gen/xyz/openbmc_project/meson.build
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated file; do not modify.
-subdir('Time')
diff --git a/meson.build b/meson.build
index 19fcbe6..3f03f92 100644
--- a/meson.build
+++ b/meson.build
@@ -18,8 +18,6 @@
subdir('config')
config_dependencies = conf_h_dep
-sdbusplus_dep = dependency('sdbusplus', required : false)
-
if get_option('npcm7xx-or-newer').enabled()
add_project_arguments('-DNPCM7XX_OR_NEWER', language:'cpp')
endif
@@ -32,19 +30,18 @@
generated_sources = []
generated_others = []
-if get_option('yocto').disabled()
- ### For local phosphor-dbus-interfaces only
- sdbusplusplus_prog = find_program('sdbus++', native: true)
- sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
- sdbusplusplus_depfiles = files()
- if sdbusplus_dep.type_name() == 'internal'
- sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
- endif
- subdir('gen')
- subdir('gen/xyz')
- boot_time_monitor_incs += include_directories('gen')
+sdbusplus_dep = dependency('sdbusplus')
+sdbusplusplus_prog = find_program('sdbus++', native: true)
+sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
+sdbusplusplus_depfiles = files()
+if sdbusplus_dep.type_name() == 'internal'
+ sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
endif
+sdeventplus_dep = dependency('sdeventplus')
+stdplus_dep = dependency('stdplus')
+subdir('xyz/openbmc_project/Time/Boot')
+
subdir('src')
subdir('boot-time-blob')
subdir('service_files')
diff --git a/src/meson.build b/src/meson.build
index 3926bb6..09fb8c7 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -20,6 +20,7 @@
fmt_dep,
phosphor_dbus_interfaces_dep,
config_dependencies,
+ boot_time_monitor_dbus_dep,
]
boot_time_monitor_lib = static_library(
@@ -29,7 +30,6 @@
'boot_manager.cpp',
'dbus_handler.cpp',
'bmc_monitor_app.cpp',
- generated_sources,
include_directories: boot_time_monitor_incs,
implicit_include_directories: false,
dependencies: boot_time_monitor_pre,
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
new file mode 100644
index 0000000..4caca14
--- /dev/null
+++ b/subprojects/sdbusplus.wrap
@@ -0,0 +1,7 @@
+[wrap-git]
+url = https://github.com/openbmc/sdbusplus.git
+revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
+program_names = sdbus++, sdbus++-gen-meson
\ No newline at end of file
diff --git a/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build b/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build
new file mode 100644
index 0000000..6fe1421
--- /dev/null
+++ b/xyz/openbmc_project/Time/Boot/Checkpoint/meson.build
@@ -0,0 +1,29 @@
+if_yaml_file = files('../../../../../yaml/xyz/openbmc_project/Time/Boot/Checkpoint.interface.yaml')
+
+generated_hpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Checkpoint__hpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'common.hpp', 'server.hpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Checkpoint',
+ ],
+ install: true,
+ install_dir: get_option('includedir') + '/xyz/openbmc_project/Time/Boot/Checkpoint',
+)
+
+generated_cpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Checkpoint__cpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'server.cpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Checkpoint',
+ ],
+)
\ No newline at end of file
diff --git a/xyz/openbmc_project/Time/Boot/Duration/meson.build b/xyz/openbmc_project/Time/Boot/Duration/meson.build
new file mode 100644
index 0000000..2358f7c
--- /dev/null
+++ b/xyz/openbmc_project/Time/Boot/Duration/meson.build
@@ -0,0 +1,29 @@
+if_yaml_file = files('../../../../../yaml/xyz/openbmc_project/Time/Boot/Duration.interface.yaml')
+
+generated_hpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Duration__hpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'common.hpp', 'server.hpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Duration',
+ ],
+ install: true,
+ install_dir: get_option('includedir') + '/xyz/openbmc_project/Time/Boot/Duration',
+)
+
+generated_cpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Duration__cpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'server.cpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Duration',
+ ],
+)
\ No newline at end of file
diff --git a/xyz/openbmc_project/Time/Boot/Statistic/meson.build b/xyz/openbmc_project/Time/Boot/Statistic/meson.build
new file mode 100644
index 0000000..28524e1
--- /dev/null
+++ b/xyz/openbmc_project/Time/Boot/Statistic/meson.build
@@ -0,0 +1,29 @@
+if_yaml_file = files('../../../../../yaml/xyz/openbmc_project/Time/Boot/Statistic.interface.yaml')
+
+generated_hpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Statistic__hpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'common.hpp', 'server.hpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Statistic',
+ ],
+ install: true,
+ install_dir: get_option('includedir') + '/xyz/openbmc_project/Time/Boot/Statistic',
+)
+
+generated_cpp += custom_target(
+ 'xyz/openbmc_project/Time/Boot/Statistic__cpp'.underscorify(),
+ input: [if_yaml_file],
+ output: [ 'server.cpp' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Time/Boot/Statistic',
+ ],
+)
\ No newline at end of file
diff --git a/xyz/openbmc_project/Time/Boot/meson.build b/xyz/openbmc_project/Time/Boot/meson.build
new file mode 100644
index 0000000..84ff850
--- /dev/null
+++ b/xyz/openbmc_project/Time/Boot/meson.build
@@ -0,0 +1,39 @@
+generated_hpp = []
+generated_cpp = []
+
+subdir('Checkpoint')
+subdir('Duration')
+subdir('Statistic')
+
+boot_time_monitor_dbus_deps = [
+ dependency('phosphor-dbus-interfaces'),
+ sdbusplus_dep
+]
+
+boot_time_monitor_dbus_lib = library(
+ 'boot_time_monitor-dbus',
+ generated_hpp,
+ generated_cpp,
+ implicit_include_directories: false,
+ include_directories: boot_time_monitor_incs,
+ version: meson.project_version(),
+ dependencies: boot_time_monitor_dbus_deps,
+ install: true)
+
+boot_time_monitor_dbus_dep = declare_dependency(
+ dependencies: boot_time_monitor_dbus_deps,
+ sources: [generated_hpp, generated_cpp],
+ link_with: boot_time_monitor_dbus_lib)
+
+boot_time_monitor_dbus_reqs = []
+foreach dep : boot_time_monitor_dbus_deps
+ if dep.type_name() == 'pkgconfig'
+ boot_time_monitor_dbus_reqs += dep
+ endif
+endforeach
+
+import('pkgconfig').generate(
+ boot_time_monitor_dbus_lib,
+ description: 'Boot Time Monitor DBus Bindings',
+ version: meson.project_version(),
+ requires: boot_time_monitor_dbus_reqs)
\ No newline at end of file