Add subproject wrap files
As a start on getting the repo to build standalone outside of a docker
or bitbake environment, add meson wrap files for most of its
dependencies.
A subproject is still needed for pdbg. It will take a bit more work as
a subprojects/packagefiles/pdbg/meson.build has to be created for it.
Tested:
Meson gets past these dependencies and then fails on pdbg.
Change-Id: I7379d1feafd00d42f3d38ba08aac6267f9eca76b
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meson.build b/meson.build
index be48e54..35aeae9 100644
--- a/meson.build
+++ b/meson.build
@@ -140,6 +140,33 @@
unit_subs.set('ENABLE_PHAL_TRUE', '')
endif
+libgpiodcxx_dep = dependency('libgpiodcxx', default_options: ['bindings=cxx'])
+sdbusplus_dep = dependency('sdbusplus')
+sdeventplus_dep = dependency('sdeventplus')
+pdi_dep = dependency('phosphor-dbus-interfaces')
+phosphor_logging_dep = dependency('phosphor-logging')
+
+gtest = dependency('gtest', main: true, disabler: true, required: false, include_type: 'system')
+if get_option('tests').allowed()
+ if not gtest.found()
+ gtest_proj = import('cmake').subproject('gtest', required: false)
+ if gtest_proj.found()
+ gtest = declare_dependency(
+ dependencies: [
+ dependency('threads'),
+ gtest_proj.dependency('gtest'),
+ gtest_proj.dependency('gtest_main'),
+ ]
+ )
+ else
+ assert(
+ not get_option('tests').enabled(),
+ 'Googletest is required if tests are enabled'
+ )
+ endif
+ endif
+endif
+
executable(
'openpower-proc-control',
[
@@ -154,11 +181,11 @@
'util.cpp',
] + extra_sources,
dependencies: [
- dependency('libgpiodcxx'),
+ libgpiodcxx_dep,
cxx.find_library('pdbg'),
- dependency('phosphor-dbus-interfaces'),
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
+ pdi_dep,
+ phosphor_logging_dep,
+ sdbusplus_dep,
dependency('threads'),
dependency('fmt'),
] + extra_dependencies,
@@ -173,9 +200,9 @@
],
dependencies: [
cxx.find_library('pdbg'),
- dependency('phosphor-dbus-interfaces'),
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
+ pdi_dep,
+ phosphor_logging_dep,
+ sdbusplus_dep,
],
install: true
)
@@ -191,11 +218,10 @@
'util.cpp',
],
dependencies: [
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
- dependency('sdeventplus'),
- dependency('fmt'),
- dependency('phosphor-dbus-interfaces'),
+ phosphor_logging_dep,
+ sdbusplus_dep,
+ sdeventplus_dep,
+ pdi_dep,
cxx.find_library('pdbg'),
cxx.find_library('phal'),
],
@@ -215,9 +241,9 @@
cxx.find_library('pdbg'),
cxx.find_library('phal'),
dependency('libdt-api'),
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
- dependency('sdeventplus'),
+ phosphor_logging_dep,
+ sdbusplus_dep,
+ sdeventplus_dep,
],
install: true
)
@@ -254,7 +280,7 @@
'targeting.cpp',
'filedescriptor.cpp',
dependencies: [
- dependency('gtest', main: true),
+ gtest,
dependency('phosphor-logging'),
],
implicit_include_directories: false,