diff --git a/recipes/fcl/all/conandata.yml b/recipes/fcl/all/conandata.yml index 6c9bdf6f4e328..7cbfdbcb46342 100644 --- a/recipes/fcl/all/conandata.yml +++ b/recipes/fcl/all/conandata.yml @@ -1,15 +1,20 @@ sources: - "0.6.1": - url: "https://github.com/flexible-collision-library/fcl/archive/v0.6.1.tar.gz" - sha256: "c8a68de8d35a4a5cd563411e7577c0dc2c626aba1eef288cb1ca88561f8d8019" "0.7.0": url: "https://github.com/flexible-collision-library/fcl/archive/refs/tags/0.7.0.tar.gz" sha256: "90409e940b24045987506a6b239424a4222e2daf648c86dd146cbcb692ebdcbc" + "0.6.1": + url: "https://github.com/flexible-collision-library/fcl/archive/v0.6.1.tar.gz" + sha256: "c8a68de8d35a4a5cd563411e7577c0dc2c626aba1eef288cb1ca88561f8d8019" patches: + "0.7.0": + - patch_file: "patches/0001-fix-cmake-0.7.0.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-fix-mingw-bigobj.patch" + base_path: "source_subfolder" "0.6.1": - - patch_file: "patches/conanize-cmake-0.6.1.patch" + - patch_file: "patches/0001-fix-cmake-0.6.1.patch" base_path: "source_subfolder" - - patch_file: "patches/fix-mingw-bigobj.patch" + - patch_file: "patches/0002-fix-mingw-bigobj.patch" base_path: "source_subfolder" - - patch_file: "patches/fix-alias-type-msvc2015.patch" + - patch_file: "patches/0003-fix-alias-type-msvc2015.patch" base_path: "source_subfolder" diff --git a/recipes/fcl/all/conanfile.py b/recipes/fcl/all/conanfile.py index 88b04825f383c..23cfa02dbd370 100644 --- a/recipes/fcl/all/conanfile.py +++ b/recipes/fcl/all/conanfile.py @@ -3,7 +3,7 @@ import os import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.43.0" class FclConan(ConanFile): @@ -11,23 +11,23 @@ class FclConan(ConanFile): 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") + topics = ("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] + "with_octomap": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_octomap": True + "with_octomap": True, } + generators = "cmake", "cmake_find_package_multi" _cmake = None @property @@ -38,6 +38,11 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" + def export_sources(self): + self.copy("CMakeLists.txt") + for patch in self.conan_data.get("patches", {}).get(self.version, []): + self.copy(patch["patch_file"]) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -45,17 +50,20 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - 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("eigen/3.3.9") + self.requires("eigen/3.4.0") self.requires("libccd/2.1") if self.options.with_octomap: - self.requires("octomap/1.9.6") + self.requires("octomap/1.9.7") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + if self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration( + "fcl {} doesn't properly support shared lib on Windows".format(self.version) + ) def source(self): tools.get(**self.conan_data["sources"][self.version], @@ -75,13 +83,14 @@ def _configure_cmake(self): 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_X64_SSE"] = False # Let consumer decide to add relevant compile options, fcl 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: + self._cmake.definitions["OCTOMAP_VERSION"] = self.deps_cpp_info["octomap"].version 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 @@ -98,6 +107,8 @@ def package(self): 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")) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"fcl": "fcl::fcl"} @@ -115,20 +126,16 @@ def _create_cmake_module_alias_targets(module_file, targets): """.format(alias=alias, aliased=aliased)) tools.save(module_file, content) - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") - @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "fcl" - self.cpp_info.names["cmake_find_package_multi"] = "fcl" - self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.set_property("cmake_file_name", "fcl") + self.cpp_info.set_property("cmake_target_name", "fcl") + self.cpp_info.set_property("pkg_config_name", "fcl") + self.cpp_info.libs = ["fcl"] + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "fcl" - self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/fcl/all/patches/0001-fix-cmake-0.6.1.patch b/recipes/fcl/all/patches/0001-fix-cmake-0.6.1.patch new file mode 100644 index 0000000000000..87690d911d402 --- /dev/null +++ b/recipes/fcl/all/patches/0001-fix-cmake-0.6.1.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -72,7 +72,7 @@ if(MSVC OR MSVC90 OR MSVC10) + endif (MSVC OR MSVC90 OR MSVC10) + + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") + include(CMakePackageConfigHelpers) + include(GenerateExportHeader) + include(GNUInstallDirs) +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -103,6 +103,8 @@ if(FCL_HAVE_OCTOMAP) + # available, otherwise fall back to OCTOMAP_INCLUDE_DIRS and OCTOMAP_LIBRARIES + if(TARGET octomap) + target_link_libraries(${PROJECT_NAME} PUBLIC octomap) ++ elseif(TARGET octomap-static) ++ target_link_libraries(${PROJECT_NAME} PUBLIC octomap-static) + 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}") diff --git a/recipes/fcl/all/patches/0001-fix-cmake-0.7.0.patch b/recipes/fcl/all/patches/0001-fix-cmake-0.7.0.patch new file mode 100644 index 0000000000000..54b12b1ddcc5a --- /dev/null +++ b/recipes/fcl/all/patches/0001-fix-cmake-0.7.0.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,7 +66,7 @@ if(MSVC OR MSVC90 OR MSVC10) + endif (MSVC OR MSVC90 OR MSVC10) + + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") + include(CMakePackageConfigHelpers) + include(GenerateExportHeader) + include(GNUInstallDirs) +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -103,6 +103,8 @@ if(FCL_HAVE_OCTOMAP) + # available, otherwise fall back to OCTOMAP_INCLUDE_DIRS and OCTOMAP_LIBRARIES + if(TARGET octomap) + target_link_libraries(${PROJECT_NAME} PUBLIC octomap) ++ elseif(TARGET octomap-static) ++ target_link_libraries(${PROJECT_NAME} PUBLIC octomap-static) + 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}") diff --git a/recipes/fcl/all/patches/fix-mingw-bigobj.patch b/recipes/fcl/all/patches/0002-fix-mingw-bigobj.patch similarity index 100% rename from recipes/fcl/all/patches/fix-mingw-bigobj.patch rename to recipes/fcl/all/patches/0002-fix-mingw-bigobj.patch diff --git a/recipes/fcl/all/patches/fix-alias-type-msvc2015.patch b/recipes/fcl/all/patches/0003-fix-alias-type-msvc2015.patch similarity index 100% rename from recipes/fcl/all/patches/fix-alias-type-msvc2015.patch rename to recipes/fcl/all/patches/0003-fix-alias-type-msvc2015.patch diff --git a/recipes/fcl/all/patches/conanize-cmake-0.6.1.patch b/recipes/fcl/all/patches/conanize-cmake-0.6.1.patch deleted file mode 100644 index 5f650800aa804..0000000000000 --- a/recipes/fcl/all/patches/conanize-cmake-0.6.1.patch +++ /dev/null @@ -1,169 +0,0 @@ ---- 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 diff --git a/recipes/fcl/all/test_package/conanfile.py b/recipes/fcl/all/test_package/conanfile.py index a9f777f7680ff..38f4483872d47 100644 --- a/recipes/fcl/all/test_package/conanfile.py +++ b/recipes/fcl/all/test_package/conanfile.py @@ -12,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/fcl/config.yml b/recipes/fcl/config.yml index 4f7627fae6b9e..20ca85280a5a5 100644 --- a/recipes/fcl/config.yml +++ b/recipes/fcl/config.yml @@ -1,5 +1,5 @@ versions: - "0.6.1": - folder: all "0.7.0": folder: all + "0.6.1": + folder: all