build-unit-test-docker: switch json to use cmake
nlohmann/json supports CMake and we use it in the bitbake
recipe, so use it here as well. The bitbake recipe has a
'install_append' to symlink the final header directly into
'{includedir}/json.hpp' so we need to continue to do the
same here.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ibf61a7a471216c43427109907a54e81dde1ae8fc
diff --git a/scripts/build-unit-test-docker b/scripts/build-unit-test-docker
index 97ddfe7..23541f1 100755
--- a/scripts/build-unit-test-docker
+++ b/scripts/build-unit-test-docker
@@ -66,6 +66,8 @@
# custom_post_dl [optional]: List of steps to run after download, but
# before config / build / install.
custom_post_dl: Iterable[str]
+ # custom_post_install [optional]: List of steps to run after install.
+ custom_post_install: Iterable[str]
# __tag [private]: Generated Docker tag name for package stage.
__tag: str
@@ -132,10 +134,9 @@
# Release 2020-08-06
"nlohmann/json": PackageDef(
rev="v3.9.1",
- build_type="custom",
- build_steps=[
- f"mkdir {prefix}/include/nlohmann",
- f"cp single_include/nlohmann/json.hpp {prefix}/include/nlohmann",
+ build_type="cmake",
+ config_flags=["-DJSON_BuildTests=OFF"],
+ custom_post_install=[
f"ln -s {prefix}/include/nlohmann/json.hpp {prefix}/include/json.hpp",
],
),
@@ -529,6 +530,11 @@
f"Unhandled build type for {self.package}: {build_type}"
)
+ # Handle 'custom_post_install' commands.
+ custom_post_install = self.pkg_def.get("custom_post_install")
+ if custom_post_install:
+ result += " && " + " && ".join(custom_post_install)
+
return result
def _cmd_build_autoconf(self) -> str: