Revert "meson: nlohmann/json has a meson build"
and Revert "meson: Rework valijson subproject dependency"
This reverts commit 9fedd141288d36d41345305532251e4659535751.
and e7948f447eaeb3afaa78d5d298dc12b0730b8a84.
As they break the yocto build.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8034a362f0866342a1527f468dc84a6ff1c67bd7
diff --git a/meson.build b/meson.build
index c4303fe..4fb8877 100644
--- a/meson.build
+++ b/meson.build
@@ -9,9 +9,6 @@
license: 'Apache-2.0',
version: '0.1',
)
-
-cmake = import('cmake')
-
add_project_arguments('-Wno-psabi', language: 'cpp')
boost_args = [
@@ -35,10 +32,18 @@
if get_option('fru-device')
i2c = cpp.find_library('i2c')
endif
-
-nlohmann_json_dep = dependency('nlohmann_json',
- fallback: [ 'nlohmann_json', 'nlohmann_json_dep'])
-
+if cpp.has_header('nlohmann/json.hpp')
+ nlohmann_json = declare_dependency()
+else
+ subproject('nlohmann', required: false)
+ nlohmann_json = declare_dependency(
+ include_directories: [
+ 'subprojects/nlohmann/single_include',
+ 'subprojects/nlohmann/single_include/nlohmann',
+ ]
+ )
+ nlohmann_json = nlohmann_json.as_system('system')
+endif
sdbusplus = dependency('sdbusplus', required: false)
if not sdbusplus.found()
sdbusplus_proj = subproject('sdbusplus', required: true)
@@ -55,17 +60,15 @@
meson.project_name(),
)
threads = dependency('threads')
-
-valijson_dep = dependency('valijson', required: false)
-if not valijson_dep.found()
- valijson_opt = cmake.subproject_options()
- valijson_opt.add_cmake_defines({'valijson_BUILD_TESTS': false,
- 'valijson_BUILD_EXAMPLES': false})
- valijson_proj = cmake.subproject('valijson', options: valijson_opt)
- valijson_dep = valijson_proj.dependency('valijson')
- valijson = valijson_dep.partial_dependency(includes: true).as_system()
+if cpp.has_header('valijson/validator.hpp')
+ valijson = declare_dependency()
+else
+ subproject('valijson', required: false)
+ valijson = declare_dependency(
+ include_directories: 'subprojects/valijson/include'
+ )
+ valijson = valijson.as_system('system')
endif
-valijson = valijson.partial_dependency(includes: true).as_system()
install_data('blacklist.json')
@@ -163,6 +166,7 @@
test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
gtest = dependency('gtest', main: true, disabler: true, required: false)
if not gtest.found() and build_tests.enabled()
+ cmake = import('cmake')
gtest_subproject = cmake.subproject('gtest')
cm_gtest = gtest_subproject.dependency('gtest')
cm_gtest_main = gtest_subproject.dependency('gtest_main')
@@ -179,7 +183,7 @@
dependencies: [
boost,
gtest,
- nlohmann_json_dep,
+ nlohmann_json,
sdbusplus,
valijson,
],
diff --git a/src/meson.build b/src/meson.build
index 1a445b3..8a9811b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -8,7 +8,7 @@
cpp_args: cpp_args + ['-DBOOST_ASIO_DISABLE_THREADS'],
dependencies: [
boost,
- nlohmann_json_dep,
+ nlohmann_json,
sdbusplus,
valijson,
],
@@ -31,7 +31,7 @@
dependencies: [
boost,
i2c,
- nlohmann_json_dep,
+ nlohmann_json,
sdbusplus,
threads,
valijson,
diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann.wrap
similarity index 100%
rename from subprojects/nlohmann_json.wrap
rename to subprojects/nlohmann.wrap
diff --git a/subprojects/valijson.wrap b/subprojects/valijson.wrap
index 707c227..736d202 100644
--- a/subprojects/valijson.wrap
+++ b/subprojects/valijson.wrap
@@ -1,3 +1,3 @@
[wrap-git]
-revision = 66262bafb82c946ba583ba33e96d35e633d5898a
+revision = c2f22fddf599d04dc33fcd7ed257c698a05345d9
url = https://github.com/tristanpenman/valijson.git