capnproto: remove binaries from target-build, add bbclass
PATCH v2 1/1 capnproto: remove binaries from target-build, add bbclass
When linking to capnproto from another project, cmake fails to find this package with the following error:
| CMake Error at ${RECIPE_SYSROOT}/usr/lib/cmake/CapnProto/CapnProtoTargets.cmake:176 (message):
| The imported target "CapnProto::capnp_tool" references the file
|
| "${RECIPE_SYSROOT}/usr/bin/capnp"
|
| but this file does not exist. Possible reasons include:To solve this, this change includes the following:
1. Add a patch that removes the files installed (and exported) in ${bindir} from the target build. The CMake file originally verified that these files exist when another recipe tried to use it, however the ${RECIPE_SYSROOT} does not contain the binaries in ${bindir}, so it failed quick in the do_configure step. (This alone is enough to link against the cross-compiled libraries of capnproto successfully, but code-generation from capnproto definition fails)
2. Add a new bbclass for capnproto. To cross-compile an application that uses capnproto, the application needs to be linked against the cross-compiled version of the libraries, however the native version of the binaries need to be used to generate C++ code from the capnproto definitions. This class sets the correct CMake arguments, to use the capnproto binaries from the native package, instead of looking for the non-existent cross-compiled binaries. (These variables can be found in ${libdir}/cmake/CapnProto/CapnProtoConfig.cmake file)
--- meta-oe/classes/capnproto.bbclass | 8 ++++ ...n-t-check-usr-bin-content-from-cmake.patch | 43 +++++++++++++++++++ .../capnproto/capnproto_1.0.2.bb | 3 +- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 meta-oe/classes/capnproto.bbclass create mode 100644 meta-oe/recipes-devtools/capnproto/capnproto/0001-Don-t-check-usr-bin-content-from-cmake.patch
meta-oe/classes/capnproto.bbclass new file +8 -0
@@ -0,0 +1,8 @@ +# Inherit this class in your recipe to compile against +# Cap'N Proto (capnproto) with CMake + +DEPENDS:append = " capnproto-native " +DEPENDS:append:class-target = " capnproto " + +EXTRA_OECMAKE:append:class-target = " -DCAPNP_EXECUTABLE=${RECIPE_SYSROOT_NATIVE}${bindir}/capnp \ + -DCAPNPC_CXX_EXECUTABLE=${RECIPE_SYSROOT_NATIVE}${bindir}/capnpc-c++ "
meta-oe/recipes-devtools/capnproto/capnproto/0001-Don-t-check-usr-bin-content-from-cmake.patch new file +43 -0
43 lines not on this page · raw message
meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb +2 -1
@@ -5,7 +5,8 @@ SECTION = "console/tools" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://../LICENSE;md5=a05663ae6cca874123bf667a60dca8c9" -SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-${PV};protocol=https" +SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-${PV};protocol=https \ + file://0001-Don-t-check-usr-bin-content-from-cmake.patch" SRCREV = "1a0e12c0a3ba1f0dbbad45ddfef555166e0a14fc" S = "${WORKDIR}/git/c++"