diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-02-03 13:10:23 +0100 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-02-03 11:25:22 -0800 |
| commit | 6b1ba4543a2576ef3d83306190a188b6083e6c9e (patch) | |
| tree | 16c1301906159002417a94e92c9d1e8d1596e035 /meta-oe/classes | |
| parent | 7edd553fbc959e200428d4f58f7d69e336988c88 (diff) | |
| download | meta-openembedded-6b1ba4543a2576ef3d83306190a188b6083e6c9e.tar.gz | |
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)
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/classes')
| -rw-r--r-- | meta-oe/classes/capnproto.bbclass | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/meta-oe/classes/capnproto.bbclass b/meta-oe/classes/capnproto.bbclass new file mode 100644 index 0000000000..a698f41c95 --- /dev/null +++ b/meta-oe/classes/capnproto.bbclass | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # Inherit this class in your recipe to compile against | ||
| 2 | # Cap'N Proto (capnproto) with CMake | ||
| 3 | |||
| 4 | DEPENDS:append = " capnproto-native " | ||
| 5 | DEPENDS:append:class-target = " capnproto " | ||
| 6 | |||
| 7 | EXTRA_OECMAKE:append:class-target = " -DCAPNP_EXECUTABLE=${RECIPE_SYSROOT_NATIVE}${bindir}/capnp \ | ||
| 8 | -DCAPNPC_CXX_EXECUTABLE=${RECIPE_SYSROOT_NATIVE}${bindir}/capnpc-c++ " | ||
