catkin: simplify and use catkin class

* Use configuration options instead of patches
* Use relative paths in CMake installation files
* Use catkin class

Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
This commit is contained in:
Stefan Herbrechtsmeier 2013-02-15 15:50:50 +01:00
parent c6837ecbf8
commit c0edb37b21
5 changed files with 109 additions and 58 deletions

View File

@ -0,0 +1,57 @@
From 812453c0fcd2db5b562b568c8e844a2b7764dc4e Mon Sep 17 00:00:00 2001
From: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Date: Thu, 14 Feb 2013 11:46:34 +0100
Subject: [PATCH 1/2] catkin_package: use relative paths in PKG_CFG_EXTRAS
---
cmake/catkin_package.cmake | 6 +++---
cmake/templates/pkgConfig.cmake.in | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake
index 73fc5bb..ee107c7 100644
--- a/cmake/catkin_package.cmake
+++ b/cmake/catkin_package.cmake
@@ -284,13 +284,13 @@ function(_catkin_package)
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${extra}.develspace.context.cmake.py
${em_template}
${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra})
- list(APPEND PKG_CFG_EXTRAS ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra})
+ list(APPEND PKG_CFG_EXTRAS ${extra})
elseif(EXISTS ${base}.in)
configure_file(${base}.in
${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra}
@ONLY
)
- list(APPEND PKG_CFG_EXTRAS ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra})
+ list(APPEND PKG_CFG_EXTRAS ${extra})
else()
message(FATAL_ERROR "catkin_package() could not find CFG_EXTRAS file. Either 'cmake/${extra}', 'cmake/${extra}.em', 'cmake/${extra}.develspace.em' or 'cmake/${extra}.in' must exist.")
endif()
@@ -376,7 +376,7 @@ function(_catkin_package)
else()
message(FATAL_ERROR "catkin_package() could not find CFG_EXTRAS file. Either 'cmake/${extra}', 'cmake/${extra}.em', 'cmake/${extra}.installspace.em' or 'cmake/${extra}.in' must exist.")
endif()
- list(APPEND PKG_CFG_EXTRAS ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/cmake/${extra})
+ list(APPEND PKG_CFG_EXTRAS ${extra})
endforeach()
install(FILES
${installable_cfg_extras}
diff --git a/cmake/templates/pkgConfig.cmake.in b/cmake/templates/pkgConfig.cmake.in
index 6ed4f96..8e451de 100644
--- a/cmake/templates/pkgConfig.cmake.in
+++ b/cmake/templates/pkgConfig.cmake.in
@@ -155,5 +155,9 @@ if(@PROJECT_NAME@_LIBRARIES)
endif()
foreach(extra @PKG_CFG_EXTRAS@)
- include(${extra})
+ if(IS_ABSOLUTE ${extra})
+ include(${extra})
+ else()
+ include(${CMAKE_CURRENT_LIST_DIR}/${extra})
+ endif()
endforeach()
--
1.7.0.4

View File

@ -0,0 +1,35 @@
From fcdeade11a2d2e882512fcbaa0ea32bc0d5fd6d0 Mon Sep 17 00:00:00 2001
From: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Date: Fri, 15 Feb 2013 13:06:36 +0100
Subject: [PATCH 2/2] catkinConfig: use curent path for catkin_EXTRA_DIR
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
---
cmake/catkin_package.cmake | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake
index ee107c7..8b2bf2c 100644
--- a/cmake/catkin_package.cmake
+++ b/cmake/catkin_package.cmake
@@ -255,7 +255,7 @@ function(_catkin_package)
# prepend library path of this workspace
set(PKG_CONFIG_LIB_PATHS ${lib_paths})
list(INSERT PKG_CONFIG_LIB_PATHS 0 ${PROJECT_SPACE_DIR}/lib)
- set(PKG_CMAKE_DIR ${PROJECT_SPACE_DIR}/share/${PROJECT_NAME}/cmake)
+ set(PKG_CMAKE_DIR "\${CMAKE_CURRENT_LIST_DIR}")
if("${PROJECT_NAME}" STREQUAL "catkin")
set(PKG_CMAKE_DIR "${catkin_EXTRAS_DIR}")
endif()
@@ -336,7 +336,7 @@ function(_catkin_package)
# prepend library path of this workspace
set(PKG_CONFIG_LIB_PATHS ${lib_paths})
list(INSERT PKG_CONFIG_LIB_PATHS 0 ${PROJECT_SPACE_DIR}/lib)
- set(PKG_CMAKE_DIR ${PROJECT_SPACE_DIR}/share/${PROJECT_NAME}/cmake)
+ set(PKG_CMAKE_DIR "\${CMAKE_CURRENT_LIST_DIR}")
# ensure that output folder exists
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace)
--
1.7.0.4

View File

@ -1,20 +0,0 @@
diff -cr a/cmake/python.cmake b/cmake/python.cmake
*** a/cmake/python.cmake 2012-12-22 03:30:48.000000000 +0100
--- b/cmake/python.cmake 2013-01-11 09:25:35.790346760 +0100
***************
*** 6,12 ****
set(PYTHON_VERSION_XDOTY ${PYTHON_VERSION_XDOTY} CACHE STRING "Python version")
#This should be resolved automatically one day...
! option(SETUPTOOLS_DEB_LAYOUT "ON for debian style python packages layout" ON)
if(APPLE OR MSVC)
set(SETUPTOOLS_DEB_LAYOUT OFF)
--- 6,12 ----
set(PYTHON_VERSION_XDOTY ${PYTHON_VERSION_XDOTY} CACHE STRING "Python version")
#This should be resolved automatically one day...
! option(SETUPTOOLS_DEB_LAYOUT "ON for debian style python packages layout" OFF)
if(APPLE OR MSVC)
set(SETUPTOOLS_DEB_LAYOUT OFF)

View File

@ -1,21 +0,0 @@
diff -crB a/cmake/tools/rt.cmake b/cmake/tools/rt.cmake
*** a/cmake/tools/rt.cmake 2012-12-22 03:30:48.000000000 +0100
--- b/cmake/tools/rt.cmake 2013-01-31 08:09:48.789321920 +0100
***************
*** 39,45 ****
set(RT_LIBRARY rt CACHE FILEPATH "Hacked find of rt for cmake < 2.8.4")
else()
find_library(RT_LIBRARY rt)
! assert_file_exists(${RT_LIBRARY} "RT Library")
endif()
#message(STATUS "RT_LIBRARY: ${RT_LIBRARY}")
endif()
--- 39,45 ----
set(RT_LIBRARY rt CACHE FILEPATH "Hacked find of rt for cmake < 2.8.4")
else()
find_library(RT_LIBRARY rt)
! #assert_file_exists(${RT_LIBRARY} "RT Library")
endif()
#message(STATUS "RT_LIBRARY: ${RT_LIBRARY}")
endif()
Only in b/cmake/tools: rt.cmake~

View File

@ -3,26 +3,26 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
SRC_URI = "https://github.com/ros/catkin/archive/0.5.58.tar.gz;downloadfile=catkin_0.5.58.tar.gz \
file://catkin-change_default_for_debsetuptools.patch \
file://catkin-remove_assertion_for_rt_library.patch \
"
DEPENDS = "cmake python-empy python-catkin-pkg"
SRC_URI = "https://github.com/ros/${BPN}/archive/${PV}.tar.gz;downloadfilename=${BP}.tar.gz \
file://0001-catkin_package-use-relative-paths-in-PKG_CFG_EXTRAS.patch \
file://0002-catkinConfig-use-curent-path-for-catkin_EXTRA_DIR.patch \
"
SRC_URI[md5sum] = "e4df85e60dc792af9324334547cc76aa"
SRC_URI[sha256sum] = "dd99cc04eeaf16a13185dd0a2f576939fa997dfb16a40ba45068c4d2ebbcb44b"
# DEPENDS = "python-setuptools"
DEPENDS = "python-empy-native python-catkin-pkg-native python"
inherit catkin
EXTRA_OECMAKE = "-DSETUPTOOLS_DEB_LAYOUT=OFF"
FILES_${PN}-dev += "\
${datadir}/eigen/cmake \
${datadir}/ros/cmake \
${prefix}/.catkin \
${prefix}/.rosinstall \
${prefix}/_setup_util.py \
${prefix}/env.sh \
${prefix}/setup.* \
"
BBCLASSEXTEND += "native"
inherit cmake pythonnative python-dir
FILES_${PN} += "${libdir}/${PYTHON_DIR}/* ${PYTHON_SITEPACKAGES_DIR}/*"
# FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/* ${PYTHON_SITEPACKAGES_DIR}/*"
export BUILD_SYS
export HOST_SYS
export STAGING_LIBDIR
export STAGING_INCDIR