From 9f6f30d174ebbe668e077ff4162066d6c67d3eb2 Mon Sep 17 00:00:00 2001 From: Dominique Hunziker Date: Sat, 3 Jun 2017 08:17:33 +0200 Subject: [PATCH] catkin: add support for SDK --- recipes-devtools/python/python-catkin-pkg.inc | 2 +- recipes-devtools/python/python-empy.inc | 2 +- recipes-ros/catkin/catkin-runtime_0.6.19.bb | 16 +++++++++++++++- recipes-ros/catkin/catkin_0.6.19.bb | 12 +++++++++++- recipes-ros/catkin/files/environment.d-catkin.sh | 10 ++++++++++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 recipes-ros/catkin/files/environment.d-catkin.sh diff --git a/recipes-devtools/python/python-catkin-pkg.inc b/recipes-devtools/python/python-catkin-pkg.inc index 72260e6..206185d 100644 --- a/recipes-devtools/python/python-catkin-pkg.inc +++ b/recipes-devtools/python/python-catkin-pkg.inc @@ -12,4 +12,4 @@ inherit pypi RDEPENDS_${PN} = "${PYTHON_PN}-unixadmin" RDEPENDS_${PN}_class-native = "" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/python/python-empy.inc b/recipes-devtools/python/python-empy.inc index 3a94a95..97bb8e1 100644 --- a/recipes-devtools/python/python-empy.inc +++ b/recipes-devtools/python/python-empy.inc @@ -10,4 +10,4 @@ SRC_URI[sha256sum] = "99f016af2770c48ab57a65df7aae251360dc69a1514c15851458a71d4d S = "${WORKDIR}/${SRCNAME}-${PV}" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-ros/catkin/catkin-runtime_0.6.19.bb b/recipes-ros/catkin/catkin-runtime_0.6.19.bb index 634a203..28815f6 100644 --- a/recipes-ros/catkin/catkin-runtime_0.6.19.bb +++ b/recipes-ros/catkin/catkin-runtime_0.6.19.bb @@ -32,8 +32,22 @@ do_install_append() { touch ${D}${ros_prefix}/.catkin } +# Append environment hook for SDK +do_install_append_class-nativesdk() { + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + + script=${D}${SDKPATHNATIVE}/environment-setup.d/catkin-runtime.sh + echo "export ROSDISTRO=${ROSDISTRO}" >> $script + echo "export PATH=\$PATH:\${OECORE_NATIVE_SYSROOT}/opt/ros/\${ROSDISTRO}/bin" >> $script + echo "export PYTHONPATH=\${OECORE_NATIVE_SYSROOT}/opt/ros/\${ROSDISTRO}/lib/python2.7/site-packages" >> $script + echo "export ROS_ROOT=\${OECORE_TARGET_SYSROOT}/opt/ros/\${ROSDISTRO}/share/ros" >> $script + echo "export CMAKE_PREFIX_PATH=\${OECORE_TARGET_SYSROOT}/opt/ros/\${ROSDISTRO}:\${OECORE_NATIVE_SYSROOT}/opt/ros/${ROSDISTRO}" >> $script +} + +FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}" + catkin_sysroot_preprocess_append() { install -m 644 -t ${SYSROOT_DESTDIR}${ros_prefix} ${D}${ros_prefix}/.catkin } -BBCLASSEXTEND += "native" +BBCLASSEXTEND += "native nativesdk" diff --git a/recipes-ros/catkin/catkin_0.6.19.bb b/recipes-ros/catkin/catkin_0.6.19.bb index ecb5785..e4a4ba2 100644 --- a/recipes-ros/catkin/catkin_0.6.19.bb +++ b/recipes-ros/catkin/catkin_0.6.19.bb @@ -1,5 +1,7 @@ require catkin.inc +SRC_URI += "file://environment.d-catkin.sh" + DEPENDS_class-native += "catkin-runtime" # The files in ${PYTHON_SITEPACKAGES_DIR} and catkin_find are @@ -27,4 +29,12 @@ do_install_append() { rmdir ${D}${ros_libdir}/${PYTHON_DIR} } -BBCLASSEXTEND += "native" +# Append environment hook for SDK +do_install_append_class-nativesdk() { + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-catkin.sh ${D}${SDKPATHNATIVE}/environment-setup.d/catkin.sh +} + +FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}" + +BBCLASSEXTEND += "native nativesdk" diff --git a/recipes-ros/catkin/files/environment.d-catkin.sh b/recipes-ros/catkin/files/environment.d-catkin.sh new file mode 100644 index 0000000..5c31049 --- /dev/null +++ b/recipes-ros/catkin/files/environment.d-catkin.sh @@ -0,0 +1,10 @@ +alias catkin_make=" \ + catkin_make \ + -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake \ + -DSETUPTOOLS_DEB_LAYOUT=OFF \ +" +alias catkin_make_isolated=" \ + catkin_make_isolated \ + -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake \ + -DSETUPTOOLS_DEB_LAYOUT=OFF \ +"