Merge pull request #604 from bulwahn/recent-fixes

Some recent improvements
This commit is contained in:
Lukas Bulwahn 2018-07-11 20:26:04 +02:00 committed by GitHub
commit 2c1b132928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 135 additions and 15 deletions

View File

@ -0,0 +1,118 @@
From 2acc9cce82c2634d3b75f1e50f4eb84b4e6f27b6 Mon Sep 17 00:00:00 2001
From: Francois Budin <francois.budin@kitware.com>
Date: Thu, 7 Jun 2018 17:52:00 -0400
Subject: [PATCH] Use object libraries instead of empty file list in CMake
add_library
This modification is required to be able to configure this project with CMake
3.11.
To avoid compiling the source code once for the static libraries and once
for the corresponding shared libraries, a trick was used to pass an empty
list of files to the CMake command `add_library()`. This trick does not
work anymore with CMake 3.11 and above. Instead, the CMake code has been
adapted to first create object libraries, and then use the object
libraries to build both the static and the shared libraries.
Upstream-Status: Submitted [https://github.com/mariusmuja/flann/pull/378]
[Backport submitted patch to version 1.9.1]
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
src/cpp/CMakeLists.txt | 57 ++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 32 deletions(-)
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
index 49c53f0..d1f54d6 100644
--- a/src/cpp/CMakeLists.txt
+++ b/src/cpp/CMakeLists.txt
@@ -8,10 +8,13 @@ file(GLOB_RECURSE C_SOURCES flann.cpp lz4.c lz4hc.c)
file(GLOB_RECURSE CPP_SOURCES flann_cpp.cpp lz4.c lz4hc.c)
file(GLOB_RECURSE CU_SOURCES *.cu)
-add_library(flann_cpp_s STATIC ${CPP_SOURCES})
+add_library(flann_cpp_o OBJECT ${CPP_SOURCES})
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
- set_target_properties(flann_cpp_s PROPERTIES COMPILE_FLAGS -fPIC)
+ set_target_properties(flann_cpp_o PROPERTIES COMPILE_FLAGS -fPIC)
endif()
+
+add_library(flann_cpp_s STATIC $<TARGET_OBJECTS:flann_cpp_o>)
+
set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC FLANN_USE_CUDA)
if (BUILD_CUDA_LIB)
@@ -24,28 +27,22 @@ if (BUILD_CUDA_LIB)
else()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};" )
endif()
- cuda_add_library(flann_cuda_s STATIC ${CU_SOURCES})
+ cuda_add_library(flann_cuda_o OBJECT ${CU_SOURCES})
+ cuda_add_library(flann_cuda_s STATIC $<TARGET_OBJECTS:flann_cuda_o>)
set_property(TARGET flann_cuda_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
endif()
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
- add_library(flann_cpp SHARED "")
- set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
- target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
-
- if (BUILD_CUDA_LIB)
- cuda_add_library(flann_cuda SHARED "")
- set_target_properties(flann_cuda PROPERTIES LINKER_LANGUAGE CXX)
- target_link_libraries(flann_cuda -Wl,-whole-archive flann_cuda_s -Wl,-no-whole-archive)
- set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
- # target_link_libraries(flann_cuda cudpp_x86_64)
- endif()
-else()
- add_library(flann_cpp SHARED ${CPP_SOURCES})
- if (BUILD_CUDA_LIB)
- cuda_add_library(flann_cuda SHARED ${CPP_SOURCES})
- set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
- endif()
+add_library(flann_cpp SHARED $<TARGET_OBJECTS:flann_cpp_o>)
+
+if (BUILD_CUDA_LIB)
+ cuda_add_library(flann_cuda SHARED $<TARGET_OBJECTS:flann_cuda_o>)
+ set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
+# target_link_libraries(flann_cuda cudpp_x86_64)
+endif()
+
+if(MSVC)
+ # export lz4 headers, so that MSVC to creates flann_cpp.lib
+ set_target_properties(flann_cpp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
endif()
set_target_properties(flann_cpp PROPERTIES
@@ -76,22 +73,18 @@ endif()
if (BUILD_C_BINDINGS)
- add_library(flann_s STATIC ${C_SOURCES})
+ add_library(flann_o OBJECT ${C_SOURCES})
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
- set_target_properties(flann_s PROPERTIES COMPILE_FLAGS -fPIC)
+ set_target_properties(flann_o PROPERTIES COMPILE_FLAGS -fPIC)
endif()
+ add_library(flann_s STATIC $<TARGET_OBJECTS:flann_o>)
+
set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
- if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
- add_library(flann SHARED "")
- set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX)
- target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive)
- else()
- add_library(flann SHARED ${C_SOURCES})
+ add_library(flann SHARED $<TARGET_OBJECTS:flann_o>)
- if(MINGW AND OPENMP_FOUND)
- target_link_libraries(flann gomp)
- endif()
+ if(MINGW AND OPENMP_FOUND)
+ target_link_libraries(flann gomp)
endif()
set_target_properties(flann PROPERTIES
--
2.7.4

View File

@ -11,3 +11,5 @@ SRC_URI[sha256sum] = "b23b5f4e71139faa3bcb39e6bbcc76967fbaf308c4ee9d4f5bfbeceaa7
S = "${WORKDIR}/flann-${PV}" S = "${WORKDIR}/flann-${PV}"
inherit cmake inherit cmake
SRC_URI += "file://0001-Use-object-libraries-instead-of-empty-file-list-in-C.patch"

View File

@ -4,7 +4,7 @@ LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "rosconsole tf roscpp angles message-generation dynamic-reconfigure libtinyxml \ DEPENDS = "rosconsole tf roscpp angles message-generation dynamic-reconfigure libtinyxml \
realtime-tools message-filters ${PYTHON_PN}-rospkg" realtime-tools message-filters"
SRC_URI = "https://github.com/ros-controls/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" SRC_URI = "https://github.com/ros-controls/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "3df0a768373bdf0b6297a4246ef4885b" SRC_URI[md5sum] = "3df0a768373bdf0b6297a4246ef4885b"

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp sensor-msgs nodelet image-transport image-geometry dynamic-reconfigure ${PYTHON_PN}-rospkg" DEPENDS = "roscpp sensor-msgs nodelet image-transport image-geometry dynamic-reconfigure"
SRC_URI = "https://github.com/ros-perception/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz \ SRC_URI = "https://github.com/ros-perception/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz \
file://0001-Add-missing-std-namespace-prefixes.patch \ file://0001-Add-missing-std-namespace-prefixes.patch \

View File

@ -4,7 +4,7 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=11;endline=11;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=11;endline=11;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp std-msgs roslib" DEPENDS = "roscpp std-msgs roslib ${PYTHON_PN}-rospkg"
SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "c8205d14f3084e1dae677bc0812bb769" SRC_URI[md5sum] = "c8205d14f3084e1dae677bc0812bb769"

View File

@ -5,6 +5,6 @@ LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc
DEPENDS = "boost camera-calibration-parsers cv-bridge dynamic-reconfigure \ DEPENDS = "boost camera-calibration-parsers cv-bridge dynamic-reconfigure \
image-geometry image-transport nodelet nodelet-topic-tools opencv roscpp \ image-geometry image-transport nodelet nodelet-topic-tools opencv roscpp \
sensor-msgs ${PYTHON_PN}-rospkg" sensor-msgs"
require image-pipeline.inc require image-pipeline.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "camera-info-manager cv-bridge dynamic-reconfigure image-transport nodelet roscpp sensor-msgs ${PYTHON_PN}-rospkg" DEPENDS = "camera-info-manager cv-bridge dynamic-reconfigure image-transport nodelet roscpp sensor-msgs"
require image-pipeline.inc require image-pipeline.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=26;endline=26;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=26;endline=26;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cmake-modules cv-bridge dynamic-reconfigure eigen-conversions image-transport nodelet opencv roscpp tf2 tf2-geometry-msgs tf2-ros ${PYTHON_PN}-rospkg" DEPENDS = "cmake-modules cv-bridge dynamic-reconfigure eigen-conversions image-transport nodelet opencv roscpp tf2 tf2-geometry-msgs tf2-ros"
require image-pipeline.inc require image-pipeline.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf ${PYTHON_PN}-rospkg" DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf"
require image-transport-plugins.inc require image-transport-plugins.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf ${PYTHON_PN}-rospkg" DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf"
require image-transport-plugins.inc require image-transport-plugins.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf rosbag ${PYTHON_PN}-rospkg" DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf rosbag libtheora"
require image-transport-plugins.inc require image-transport-plugins.inc

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=13;endline=13;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=13;endline=13;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "moveit-core moveit-ros-perception dynamic-reconfigure ${PYTHON_PN}-rospkg libtinyxml tf-conversions" DEPENDS = "moveit-core moveit-ros-perception dynamic-reconfigure libtinyxml tf-conversions"
require moveit.inc require moveit.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "LGPL-2.1+" LICENSE = "LGPL-2.1+"
LIC_FILES_CHKSUM = "file://package.xml;beginline=22;endline=22;md5=58d727014cda5ed405b7fb52666a1f97" LIC_FILES_CHKSUM = "file://package.xml;beginline=22;endline=22;md5=58d727014cda5ed405b7fb52666a1f97"
DEPENDS = "dynamic-reconfigure message-filters nav-msgs rosbag roscpp std-srvs tf ${PYTHON_PN}-rospkg" DEPENDS = "dynamic-reconfigure message-filters nav-msgs rosbag roscpp std-srvs tf"
require navigation.inc require navigation.inc

View File

@ -7,7 +7,7 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=15;endline=15;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=15;endline=15;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "dynamic-reconfigure ${PYTHON_PN}-rospkg" DEPENDS = "dynamic-reconfigure"
SRC_URI = "https://github.com/KristofRobot/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" SRC_URI = "https://github.com/KristofRobot/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "1d036536b614e4e9841c970150692e46" SRC_URI[md5sum] = "1d036536b614e4e9841c970150692e46"

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=14;endline=14;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=14;endline=14;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "diagnostic-updater dynamic-reconfigure ${PYTHON_PN}-rospkg libpcap nodelet pluginlib roscpp tf velodyne-msgs" DEPENDS = "diagnostic-updater dynamic-reconfigure libpcap nodelet pluginlib roscpp tf velodyne-msgs"
require velodyne.inc require velodyne.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp nodelet dynamic-reconfigure pluginlib geometry-msgs yaml-cpp ${PYTHON_PN}-rospkg" DEPENDS = "roscpp nodelet dynamic-reconfigure pluginlib geometry-msgs yaml-cpp"
require yujin-ocs.inc require yujin-ocs.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5" LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp pluginlib nodelet geometry-msgs nav-msgs ecl-threads dynamic-reconfigure ${PYTHON_PN}-rospkg" DEPENDS = "roscpp pluginlib nodelet geometry-msgs nav-msgs ecl-threads dynamic-reconfigure"
require yujin-ocs.inc require yujin-ocs.inc