-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
457 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1.2) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory("source_subfolder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sources: | ||
"0.6.1": | ||
url: "https://github.com/flexible-collision-library/fcl/archive/v0.6.1.tar.gz" | ||
sha256: "c8a68de8d35a4a5cd563411e7577c0dc2c626aba1eef288cb1ca88561f8d8019" | ||
patches: | ||
"0.6.1": | ||
- patch_file: "patches/conanize-cmake-0.6.1.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/fix-mingw-bigobj.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/fix-alias-type-msvc2015.patch" | ||
base_path: "source_subfolder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
class FclConan(ConanFile): | ||
name = "fcl" | ||
description = "C++11 library for performing three types of proximity " \ | ||
"queries on a pair of geometric models composed of triangles." | ||
license = "BSD-3-Clause" | ||
topics = ("conan", "fcl", "geometry", "collision") | ||
homepage = "https://github.com/flexible-collision-library/fcl" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
exports_sources = ["CMakeLists.txt", "patches/**"] | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"with_octomap": [True, False] | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"with_octomap": True | ||
} | ||
|
||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.settings.compiler.cppstd: | ||
tools.check_min_cppstd(self, 11) | ||
if self.settings.os == "Windows" and self.options.shared: | ||
raise ConanInvalidConfiguration("{0} {1} doesn't properly support shared lib on Windows".format(self.name, | ||
self.version)) | ||
|
||
def requirements(self): | ||
self.requires.add("eigen/3.3.7") | ||
self.requires.add("libccd/2.1") | ||
if self.options.with_octomap: | ||
self.requires.add("octomap/1.9.3") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename(self.name + "-" + self.version, self._source_subfolder) | ||
|
||
def build(self): | ||
for patch in self.conan_data["patches"][self.version]: | ||
tools.patch(**patch) | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.definitions["FCL_ENABLE_PROFILING"] = False | ||
self._cmake.definitions["FCL_TREAT_WARNINGS_AS_ERRORS"] = False | ||
self._cmake.definitions["FCL_HIDE_ALL_SYMBOLS"] = False | ||
self._cmake.definitions["FCL_STATIC_LIBRARY"] = not self.options.shared | ||
self._cmake.definitions["FCL_USE_X64_SSE"] = False # Let consumer decide to add relevant compile options, ftl doesn't have simd intrinsics | ||
self._cmake.definitions["FCL_USE_HOST_NATIVE_ARCH"] = False | ||
self._cmake.definitions["FCL_USE_SSE"] = False | ||
self._cmake.definitions["FCL_COVERALLS"] = False | ||
self._cmake.definitions["FCL_COVERALLS_UPLOAD"] = False | ||
self._cmake.definitions["FCL_WITH_OCTOMAP"] = self.options.with_octomap | ||
if self.options.with_octomap: | ||
octomap_major, octomap_minor, octomap_patch = self.deps_cpp_info["octomap"].version.split(".") | ||
self._cmake.definitions["OCTOMAP_MAJOR_VERSION"] = octomap_major | ||
self._cmake.definitions["OCTOMAP_MINOR_VERSION"] = octomap_minor | ||
self._cmake.definitions["OCTOMAP_PATCH_VERSION"] = octomap_patch | ||
self._cmake.definitions["BUILD_TESTING"] = False | ||
self._cmake.configure(build_folder=self._build_subfolder) | ||
return self._cmake | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "CMake")) | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = tools.collect_libs(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -142,20 +142,6 @@ set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) | ||
# | ||
# If Eigen3 is not found, manually set the cache variable EIGEN3_INCLUDE_DIR | ||
#=============================================================================== | ||
-find_package(Eigen3 3.0.5 QUIET CONFIG) | ||
- | ||
-# If Eigen3Config.cmake is not found, use the FindEigen3.cmake module | ||
-if(NOT Eigen3_FOUND) | ||
- find_package(Eigen3 3.0.5 QUIET MODULE) | ||
- set(Eigen3_FOUND ON) | ||
-endif() | ||
- | ||
-if(Eigen3_FOUND) | ||
- set(FCL_HAVE_EIGEN TRUE) | ||
-else() | ||
- message(SEND_ERROR "EIGEN3 (>= 3.0.5) is required by FCL") | ||
- set(FCL_HAVE_EIGEN FALSE) | ||
-endif() | ||
|
||
#=============================================================================== | ||
# Find required dependency libccd | ||
@@ -163,41 +149,6 @@ endif() | ||
# If libccd is not found, manually set the cache variables CCD_INCLUDE_DIR and | ||
# CCD_LIBRARY | ||
#=============================================================================== | ||
-find_package(ccd QUIET) | ||
- | ||
-# If ccd-config.cmake is not found, use pkg-config and/or find_path() and | ||
-# find_library() | ||
-if(NOT ccd_FOUND) | ||
- if(PKG_CONFIG_FOUND) | ||
- pkg_check_modules(PC_CCD ccd) | ||
- pkg_check_modules(PC_LIBCCD libccd) | ||
- endif() | ||
- | ||
- find_path(CCD_INCLUDE_DIR ccd/ccd.h | ||
- HINTS "${PC_CCD_INCLUDE_DIRS}" "${PC_LIBCCD_INCLUDE_DIRS}") | ||
- | ||
- # Using find_library() even if pkg-config is available ensures that the full | ||
- # path to the ccd library is available in CCD_LIBRARIES | ||
- find_library(CCD_LIBRARY ccd | ||
- HINTS "${PC_CCD_LIBRARY_DIRS}" "${PC_LIBCCD_LIBRARY_DIRS}") | ||
- | ||
- # libccd links to LibM on UNIX. | ||
- if(CYGWIN OR NOT WIN32) | ||
- find_library(M_LIBRARY m) | ||
- endif() | ||
- | ||
- if(CCD_INCLUDE_DIR AND CCD_LIBRARY) | ||
- set(CCD_INCLUDE_DIRS "${CCD_INCLUDE_DIR}") | ||
- set(CCD_LIBRARIES "${CCD_LIBRARY}" "${M_LIBRARY}") | ||
- set(ccd_FOUND ON) | ||
- | ||
- mark_as_advanced(CCD_INCLUDE_DIR CCD_LIBRARY) | ||
- endif() | ||
-endif() | ||
- | ||
-if(NOT ccd_FOUND) | ||
- message(FATAL_ERROR "CCD is required by FCL") | ||
-endif() | ||
|
||
set(PKG_EXTERNAL_DEPS "ccd eigen3") | ||
|
||
@@ -211,58 +162,9 @@ option(FCL_WITH_OCTOMAP "OctoMap library support" ON) | ||
set(FCL_HAVE_OCTOMAP 0) | ||
|
||
if(FCL_WITH_OCTOMAP) | ||
- find_package(octomap QUIET) | ||
- | ||
- # Older versions of octomap-config.cmake may not define OCTOMAP_VERSION so | ||
- # fall back to pkg-config | ||
- if(NOT octomap_FOUND OR NOT OCTOMAP_VERSION) | ||
- if(PKG_CONFIG_FOUND) | ||
- pkg_check_modules(PC_OCTOMAP octomap) | ||
- endif() | ||
- | ||
- find_path(OCTOMAP_INCLUDE_DIR octomap/octomap.h | ||
- HINTS "${PC_OCTOMAP_INCLUDE_DIRS}") | ||
- | ||
- # Using find_library() even if pkg-config is available ensures that the full | ||
- # paths to the octomap and octomath libraries are set in OCTOMAP_LIBRARIES | ||
- find_library(OCTOMAP_LIBRARY octomap | ||
- HINTS "${PC_OCTOMAP_LIBRARY_DIRS}") | ||
- | ||
- find_library(OCTOMATH_LIBRARY octomath | ||
- HINTS "${PC_OCTOMAP_LIBRARY_DIRS}") | ||
- | ||
- # Use a cache variable so that the version can be manually set if pkg-config | ||
- # is not available | ||
- set(OCTOMAP_VERSION "${PC_OCTOMAP_VERSION}" | ||
- CACHE STRING "octomap version (major.minor.patch)") | ||
- | ||
- if(OCTOMAP_INCLUDE_DIR AND OCTOMAP_LIBRARY AND OCTOMATH_LIBRARY AND OCTOMAP_VERSION) | ||
- set(OCTOMAP_INCLUDE_DIRS "${OCTOMAP_INCLUDE_DIR}") | ||
- set(OCTOMAP_LIBRARIES "${OCTOMAP_LIBRARY}" "${OCTOMATH_LIBRARY}") | ||
- set(octomap_FOUND ON) | ||
- | ||
- mark_as_advanced(OCTOMAP_INCLUDE_DIR OCTOMAP_LIBRARY OCTOMATH_LIBRARY OCTOMAP_VERSION) | ||
- else() | ||
- set(octomap_FOUND OFF) | ||
- endif() | ||
- endif() | ||
- | ||
- if(octomap_FOUND) | ||
- if(NOT OCTOMAP_MAJOR_VERSION AND NOT OCTOMAP_MINOR_VERSION AND NOT OCTOMAP_PATCH_VERSION) | ||
- string(REPLACE "." ";" VERSION_LIST "${OCTOMAP_VERSION}") | ||
- list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION) | ||
- list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION) | ||
- list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION) | ||
- endif() | ||
- | ||
- set(FCL_HAVE_OCTOMAP 1) | ||
- message(STATUS "FCL uses OctoMap") | ||
- set(PKG_EXTERNAL_DEPS "${PKG_EXTERNAL_DEPS} octomap") | ||
- else() | ||
- message(STATUS "FCL does not use OctoMap") | ||
- endif() | ||
-else() | ||
- message(STATUS "FCL does not use OctoMap (as requested)") | ||
+ set(FCL_HAVE_OCTOMAP 1) | ||
+ message(STATUS "FCL uses OctoMap") | ||
+ set(PKG_EXTERNAL_DEPS "${PKG_EXTERNAL_DEPS} octomap") | ||
endif() | ||
|
||
if(TARGET ccd) | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -77,36 +77,17 @@ endif() | ||
|
||
# Use the IMPORTED target from newer versions of ccd-config.cmake if available, | ||
# otherwise fall back to CCD_INCLUDE_DIRS and CCD_LIBRARIES | ||
-if(TARGET ccd) | ||
- target_link_libraries(${PROJECT_NAME} PUBLIC ccd) | ||
-else() | ||
- target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${CCD_INCLUDE_DIRS}") | ||
- target_link_libraries(${PROJECT_NAME} PUBLIC "${CCD_LIBRARIES}") | ||
-endif() | ||
+target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::libccd) | ||
|
||
# Use the IMPORTED target from newer versions of Eigen3Config.cmake if | ||
# available, otherwise fall back to EIGEN3_INCLUDE_DIRS from older versions of | ||
# Eigen3Config.cmake or EIGEN3_INCLUDE_DIR from FindEigen3.cmake | ||
-if(TARGET Eigen3::Eigen) | ||
- # Note that Eigen3::Eigen is an INTERFACE library, so the INCLUDE_DIRECTORIES | ||
- # and INTERFACE_INCLUDE_DIRECTORIES are populated, but nothing is actually | ||
- # linked | ||
- target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen) | ||
-elseif(EIGEN3_INCLUDE_DIRS) | ||
- target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${EIGEN3_INCLUDE_DIRS}") | ||
-else() | ||
- target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${EIGEN3_INCLUDE_DIR}") | ||
-endif() | ||
+target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::eigen) | ||
|
||
if(FCL_HAVE_OCTOMAP) | ||
# Use the IMPORTED target from newer versions of octomap-config.cmake if | ||
# available, otherwise fall back to OCTOMAP_INCLUDE_DIRS and OCTOMAP_LIBRARIES | ||
- if(TARGET octomap) | ||
- target_link_libraries(${PROJECT_NAME} PUBLIC octomap) | ||
- elseif(OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARIES) | ||
- target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${OCTOMAP_INCLUDE_DIRS}") | ||
- target_link_libraries(${PROJECT_NAME} PUBLIC "${OCTOMAP_LIBRARIES}") | ||
- endif() | ||
+ target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::octomap) | ||
endif() | ||
|
||
target_include_directories(${PROJECT_NAME} INTERFACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- a/include/fcl/geometry/octree/octree-inl.h | ||
+++ b/include/fcl/geometry/octree/octree-inl.h | ||
@@ -107,7 +107,7 @@ typename OcTree<S>::OcTreeNode* OcTree<S>::getRoot() const | ||
|
||
//============================================================================== | ||
template <typename S> | ||
-bool OcTree<S>::isNodeOccupied(const OcTree<S>::OcTreeNode* node) const | ||
+bool OcTree<S>::isNodeOccupied(const typename OcTree<S>::OcTreeNode* node) const | ||
{ | ||
// return tree->isNodeOccupied(node); | ||
return node->getOccupancy() >= occupancy_threshold; | ||
@@ -115,7 +115,7 @@ bool OcTree<S>::isNodeOccupied(const OcTree<S>::OcTreeNode* node) const | ||
|
||
//============================================================================== | ||
template <typename S> | ||
-bool OcTree<S>::isNodeFree(const OcTree<S>::OcTreeNode* node) const | ||
+bool OcTree<S>::isNodeFree(const typename OcTree<S>::OcTreeNode* node) const | ||
{ | ||
// return false; // default no definitely free node | ||
return node->getOccupancy() <= free_threshold; | ||
@@ -123,7 +123,7 @@ bool OcTree<S>::isNodeFree(const OcTree<S>::OcTreeNode* node) const | ||
|
||
//============================================================================== | ||
template <typename S> | ||
-bool OcTree<S>::isNodeUncertain(const OcTree<S>::OcTreeNode* node) const | ||
+bool OcTree<S>::isNodeUncertain(const typename OcTree<S>::OcTreeNode* node) const | ||
{ | ||
return (!isNodeOccupied(node)) && (!isNodeFree(node)); | ||
} | ||
@@ -197,7 +197,7 @@ const typename OcTree<S>::OcTreeNode* OcTree<S>::getNodeChild( | ||
//============================================================================== | ||
template <typename S> | ||
bool OcTree<S>::nodeChildExists( | ||
- const OcTree<S>::OcTreeNode* node, unsigned int childIdx) const | ||
+ const typename OcTree<S>::OcTreeNode* node, unsigned int childIdx) const | ||
{ | ||
#if OCTOMAP_VERSION_AT_LEAST(1,8,0) | ||
return tree->nodeChildExists(node, childIdx); | ||
@@ -208,7 +208,7 @@ bool OcTree<S>::nodeChildExists( | ||
|
||
//============================================================================== | ||
template <typename S> | ||
-bool OcTree<S>::nodeHasChildren(const OcTree<S>::OcTreeNode* node) const | ||
+bool OcTree<S>::nodeHasChildren(const typename OcTree<S>::OcTreeNode* node) const | ||
{ | ||
#if OCTOMAP_VERSION_AT_LEAST(1,8,0) | ||
return tree->nodeHasChildren(node); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- a/CMakeModules/CompilerSettings.cmake | ||
+++ b/CMakeModules/CompilerSettings.cmake | ||
@@ -104,11 +104,13 @@ endif() | ||
|
||
# MinGW | ||
if((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW) | ||
- add_definitions(-fPIC) | ||
if(FCL_TREAT_WARNINGS_AS_ERRORS) | ||
add_definitions(-Werror) | ||
endif() | ||
endif() | ||
+if(MINGW) | ||
+ add_definitions(-Wa,-mbig-obj) | ||
+endif() | ||
|
||
# By default CMake sets RPATH for binaries in the build tree, but clears | ||
# it when installing. Switch this option off if the default behaviour is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 2.8.11) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Oops, something went wrong.