From 4ee90e5f2e046c840787e7ed314d2406c1fc8371 Mon Sep 17 00:00:00 2001 From: Mohamed Ghita Date: Tue, 27 Jul 2021 09:31:16 +0200 Subject: [PATCH 1/4] ompl/1.5.2 recipe --- recipes/ompl/1.5.2/conandata.yml | 4 + recipes/ompl/1.5.2/conanfile.py | 95 +++++++++++++++++++ .../ompl/1.5.2/test_package/CMakeLists.txt | 16 ++++ recipes/ompl/1.5.2/test_package/conanfile.py | 24 +++++ recipes/ompl/1.5.2/test_package/example.cpp | 13 +++ recipes/ompl/config.yml | 4 + 6 files changed, 156 insertions(+) create mode 100644 recipes/ompl/1.5.2/conandata.yml create mode 100644 recipes/ompl/1.5.2/conanfile.py create mode 100644 recipes/ompl/1.5.2/test_package/CMakeLists.txt create mode 100644 recipes/ompl/1.5.2/test_package/conanfile.py create mode 100644 recipes/ompl/1.5.2/test_package/example.cpp create mode 100644 recipes/ompl/config.yml diff --git a/recipes/ompl/1.5.2/conandata.yml b/recipes/ompl/1.5.2/conandata.yml new file mode 100644 index 0000000000000..668840e61f9f4 --- /dev/null +++ b/recipes/ompl/1.5.2/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5.2": + url: "https://github.com/ompl/ompl/archive/refs/tags/1.5.2.zip" + sha256: "1b9f25339e014c448334cb8bd5d7d52d1dcf457227cc2dde4c2210d1d494258d" diff --git a/recipes/ompl/1.5.2/conanfile.py b/recipes/ompl/1.5.2/conanfile.py new file mode 100644 index 0000000000000..54e3b172e2b0a --- /dev/null +++ b/recipes/ompl/1.5.2/conanfile.py @@ -0,0 +1,95 @@ +from conans import ConanFile, tools, CMake +import os +import glob + +BOOST_MODULES = ["system","filesystem","program_options","serialization","test"] +BOOST_UNUSED_MODULES = ["atomic","chrono","container","context","contract","coroutine","date_time","exception", + "fiber","graph","graph_parallel","iostreams","locale","log","math","mpi","python","random", + "regex","stacktrace","thread","timer","type_erasure","wave"] + +class ConanOmpl(ConanFile): + name = "ompl" + version = "1.5.2" + license = "BSD" + homepage = "https://ompl.kavrakilab.org/" + description = "OMPL, the Open Motion Planning Library, consists of many state-of-the-art sampling-based motion planning algorithms." + url = "https://bitbucket.org/radalytica/conan-packages" + author = "Mohamed Ghita (https://github.com/mohamedghita)" + generators = "cmake_find_package", "cmake_paths", "cmake" + BOOST_VERSION = "1.72.0" + requires = "boost/{}".format(BOOST_VERSION), "eigen/3.3.9" + + settings = 'os', 'compiler', 'build_type', 'arch' + options = {"shared": [True, False], "run_tests": [True, False], "fPIC": [True, False],} + default_options = {"shared": True, "run_tests": False, "fPIC": True} + + def configure(self): + if self.options.shared: + del self.options.fPIC + + boost_options = self.options["boost"] + for module in BOOST_MODULES: + setattr(boost_options, "without_{}".format(module), False) + for module in BOOST_UNUSED_MODULES: + setattr(boost_options, "without_{}".format(module), True) + + @property + def _source_subfolder(self): + return "ompl-{}".format(self.version) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "project(ompl VERSION {} LANGUAGES CXX)".format(self.version), + 'project(ompl VERSION {} LANGUAGES CXX)\n'.format(self.version) + + 'include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n' + + 'conan_basic_setup(KEEP_RPATHS)\n' + + 'include(${CMAKE_BINARY_DIR}/conan_paths.cmake)\n') + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "find_package(Boost 1.58 QUIET REQUIRED COMPONENTS serialization filesystem system program_options)", + 'find_package(Boost {} REQUIRED)\n'.format(self.BOOST_VERSION) + + 'set(Boost_SERIALIZATION_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_FILESYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_SYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_LIBRARY_DIRS " ")') + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "find_package(Eigen3 REQUIRED)", + 'find_package(Eigen3 REQUIRED)\n' + + 'set(EIGEN3_INCLUDE_DIR ${Eigen3_INCLUDE_DIR})') + + def _configure_cmake(self): + cmake = CMake(self) + cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared + cmake.definitions["OMPL_BUILD_TESTS"] = self.options.run_tests + cmake.definitions["OMPL_BUILD_DEMOS"] = self.options.run_tests + + ignored_packages = ["pypy","flann","ODE", "spot","MORSE","Triangle"] + for pkg in ignored_packages: + cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_{}".format(pkg)] = "ON" + + disabled_options = ["BUILD_PYBINDINGS","BUILD_PYTESTS","REGISTRATION","VERSIONED_INSTALL"] + for opt in disabled_options: + cmake.definitions["OMPL_{}".format(opt)] = "OFF" + + cmake.configure(source_folder=os.path.join(self.build_folder, self._source_subfolder)) + return cmake + + def build(self): + cmake = self._configure_cmake() + if self.options.run_tests: + cmake.build() + cmake.test() + else: + cmake.build(target="ompl") + + def package(self): + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["ompl"] + self.cpp_info.libdirs = ['lib'] \ No newline at end of file diff --git a/recipes/ompl/1.5.2/test_package/CMakeLists.txt b/recipes/ompl/1.5.2/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..64cbfddae794c --- /dev/null +++ b/recipes/ompl/1.5.2/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8.12) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(KEEP_RPATHS) +find_package(OMPL REQUIRED) + +if (APPLE) + set(CMAKE_INSTALL_RPATH "@executable_path" "@executable_path/../lib") +elseif(NOT WIN32) # Linux + set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib") +endif() # windows, the library stays in bin folder with the executables +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) + +add_executable(example example.cpp) +target_link_libraries(example ompl::ompl) diff --git a/recipes/ompl/1.5.2/test_package/conanfile.py b/recipes/ompl/1.5.2/test_package/conanfile.py new file mode 100644 index 0000000000000..3793ba475d634 --- /dev/null +++ b/recipes/ompl/1.5.2/test_package/conanfile.py @@ -0,0 +1,24 @@ +import os +import shutil + +from conans import ConanFile, CMake, tools + + +class PackageTest(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + self.copy('*.so*', dst='bin', src='lib') + + def test(self): + if not tools.cross_building(self.settings): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/recipes/ompl/1.5.2/test_package/example.cpp b/recipes/ompl/1.5.2/test_package/example.cpp new file mode 100644 index 0000000000000..1b23e402b49a1 --- /dev/null +++ b/recipes/ompl/1.5.2/test_package/example.cpp @@ -0,0 +1,13 @@ +#include +#include + +#include +#include + +int main() { + auto stateSpace = std::make_shared(5); + auto setup = std::make_shared (stateSpace); + std::cout << "ompl objects constructed successfully" << std::endl; + + return 0; +} \ No newline at end of file diff --git a/recipes/ompl/config.yml b/recipes/ompl/config.yml new file mode 100644 index 0000000000000..0b6520705eb42 --- /dev/null +++ b/recipes/ompl/config.yml @@ -0,0 +1,4 @@ +versions: + "1.5.2": + folder: 1.5.2 + From 2764f17695093f1327c0fce65b1b4521d4bd184f Mon Sep 17 00:00:00 2001 From: Mohamed Ghita Date: Tue, 27 Jul 2021 10:11:46 +0200 Subject: [PATCH 2/4] ompl: fix conan attributes url, author --- recipes/ompl/1.5.2/conanfile.py | 75 +++++++++++-------- .../ompl/1.5.2/test_package/CMakeLists.txt | 2 +- recipes/ompl/1.5.2/test_package/conanfile.py | 9 +-- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/recipes/ompl/1.5.2/conanfile.py b/recipes/ompl/1.5.2/conanfile.py index 54e3b172e2b0a..3c64b1ea44f8e 100644 --- a/recipes/ompl/1.5.2/conanfile.py +++ b/recipes/ompl/1.5.2/conanfile.py @@ -2,10 +2,12 @@ import os import glob -BOOST_MODULES = ["system","filesystem","program_options","serialization","test"] -BOOST_UNUSED_MODULES = ["atomic","chrono","container","context","contract","coroutine","date_time","exception", - "fiber","graph","graph_parallel","iostreams","locale","log","math","mpi","python","random", - "regex","stacktrace","thread","timer","type_erasure","wave"] +BOOST_MODULES = ["system", "filesystem", + "program_options", "serialization", "test"] +BOOST_UNUSED_MODULES = ["atomic", "chrono", "container", "context", "contract", "coroutine", "date_time", "exception", + "fiber", "graph", "graph_parallel", "iostreams", "locale", "log", "math", "mpi", "python", "random", + "regex", "stacktrace", "thread", "timer", "type_erasure", "wave"] + class ConanOmpl(ConanFile): name = "ompl" @@ -13,14 +15,15 @@ class ConanOmpl(ConanFile): license = "BSD" homepage = "https://ompl.kavrakilab.org/" description = "OMPL, the Open Motion Planning Library, consists of many state-of-the-art sampling-based motion planning algorithms." - url = "https://bitbucket.org/radalytica/conan-packages" - author = "Mohamed Ghita (https://github.com/mohamedghita)" + url = "https://github.com/conan-io/conan-center-index" + topics = ("ompl", "motion-planning", "robotics", "collision") generators = "cmake_find_package", "cmake_paths", "cmake" BOOST_VERSION = "1.72.0" requires = "boost/{}".format(BOOST_VERSION), "eigen/3.3.9" settings = 'os', 'compiler', 'build_type', 'arch' - options = {"shared": [True, False], "run_tests": [True, False], "fPIC": [True, False],} + options = {"shared": [True, False], "run_tests": [ + True, False], "fPIC": [True, False]} default_options = {"shared": True, "run_tests": False, "fPIC": True} def configure(self): @@ -38,27 +41,29 @@ def _source_subfolder(self): return "ompl-{}".format(self.version) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), - "project(ompl VERSION {} LANGUAGES CXX)".format(self.version), - 'project(ompl VERSION {} LANGUAGES CXX)\n'.format(self.version) + - 'include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n' + - 'conan_basic_setup(KEEP_RPATHS)\n' + - 'include(${CMAKE_BINARY_DIR}/conan_paths.cmake)\n') - - tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), - "find_package(Boost 1.58 QUIET REQUIRED COMPONENTS serialization filesystem system program_options)", - 'find_package(Boost {} REQUIRED)\n'.format(self.BOOST_VERSION) + - 'set(Boost_SERIALIZATION_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + - 'set(Boost_FILESYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + - 'set(Boost_SYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + - 'set(Boost_LIBRARY_DIRS " ")') - - tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), - "find_package(Eigen3 REQUIRED)", - 'find_package(Eigen3 REQUIRED)\n' + - 'set(EIGEN3_INCLUDE_DIR ${Eigen3_INCLUDE_DIR})') + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "project(ompl VERSION {} LANGUAGES CXX)".format( + self.version), + 'project(ompl VERSION {} LANGUAGES CXX)\n'.format(self.version) + + 'include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n' + + 'conan_basic_setup(KEEP_RPATHS)\n' + + 'include(${CMAKE_BINARY_DIR}/conan_paths.cmake)\n') + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "find_package(Boost 1.58 QUIET REQUIRED COMPONENTS serialization filesystem system program_options)", + 'find_package(Boost {} REQUIRED)\n'.format(self.BOOST_VERSION) + + 'set(Boost_SERIALIZATION_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_FILESYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_SYSTEM_LIBRARY "${Boost_LIBRARIES_TARGETS}")\n' + + 'set(Boost_LIBRARY_DIRS " ")') + + tools.replace_in_file("{}/CMakeLists.txt".format(self._source_subfolder), + "find_package(Eigen3 REQUIRED)", + 'find_package(Eigen3 REQUIRED)\n' + + 'set(EIGEN3_INCLUDE_DIR ${Eigen3_INCLUDE_DIR})') def _configure_cmake(self): cmake = CMake(self) @@ -66,15 +71,19 @@ def _configure_cmake(self): cmake.definitions["OMPL_BUILD_TESTS"] = self.options.run_tests cmake.definitions["OMPL_BUILD_DEMOS"] = self.options.run_tests - ignored_packages = ["pypy","flann","ODE", "spot","MORSE","Triangle"] + ignored_packages = ["pypy", "flann", + "ODE", "spot", "MORSE", "Triangle"] for pkg in ignored_packages: - cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_{}".format(pkg)] = "ON" + cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_{}".format( + pkg)] = "ON" - disabled_options = ["BUILD_PYBINDINGS","BUILD_PYTESTS","REGISTRATION","VERSIONED_INSTALL"] + disabled_options = ["BUILD_PYBINDINGS", + "BUILD_PYTESTS", "REGISTRATION", "VERSIONED_INSTALL"] for opt in disabled_options: cmake.definitions["OMPL_{}".format(opt)] = "OFF" - cmake.configure(source_folder=os.path.join(self.build_folder, self._source_subfolder)) + cmake.configure(source_folder=os.path.join( + self.build_folder, self._source_subfolder)) return cmake def build(self): @@ -92,4 +101,4 @@ def package(self): def package_info(self): self.cpp_info.includedirs = ["include"] self.cpp_info.libs = ["ompl"] - self.cpp_info.libdirs = ['lib'] \ No newline at end of file + self.cpp_info.libdirs = ['lib'] diff --git a/recipes/ompl/1.5.2/test_package/CMakeLists.txt b/recipes/ompl/1.5.2/test_package/CMakeLists.txt index 64cbfddae794c..51a08787e0cdb 100644 --- a/recipes/ompl/1.5.2/test_package/CMakeLists.txt +++ b/recipes/ompl/1.5.2/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) project(PackageTest CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/ompl/1.5.2/test_package/conanfile.py b/recipes/ompl/1.5.2/test_package/conanfile.py index 3793ba475d634..f3b80b5b79d91 100644 --- a/recipes/ompl/1.5.2/test_package/conanfile.py +++ b/recipes/ompl/1.5.2/test_package/conanfile.py @@ -13,12 +13,7 @@ def build(self): cmake.configure() cmake.build() - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='bin', src='lib') - def test(self): if not tools.cross_building(self.settings): - os.chdir("bin") - self.run(".%sexample" % os.sep) + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) From 1d0020a153a3de5cd46e7f1f88f6e664baadf937 Mon Sep 17 00:00:00 2001 From: Mohamed Ghita Date: Tue, 27 Jul 2021 10:27:15 +0200 Subject: [PATCH 3/4] newlines --- recipes/ompl/1.5.2/test_package/example.cpp | 2 +- recipes/ompl/config.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/ompl/1.5.2/test_package/example.cpp b/recipes/ompl/1.5.2/test_package/example.cpp index 1b23e402b49a1..0e704c481f795 100644 --- a/recipes/ompl/1.5.2/test_package/example.cpp +++ b/recipes/ompl/1.5.2/test_package/example.cpp @@ -10,4 +10,4 @@ int main() { std::cout << "ompl objects constructed successfully" << std::endl; return 0; -} \ No newline at end of file +} diff --git a/recipes/ompl/config.yml b/recipes/ompl/config.yml index 0b6520705eb42..1cb587e2a9ff1 100644 --- a/recipes/ompl/config.yml +++ b/recipes/ompl/config.yml @@ -1,4 +1,3 @@ versions: "1.5.2": folder: 1.5.2 - From 190cab1a4b78ddfdc05f2ecb5a329cc5c3702b52 Mon Sep 17 00:00:00 2001 From: Mohamed Ghita Date: Tue, 27 Jul 2021 10:36:45 +0200 Subject: [PATCH 4/4] ompl set default shared to false --- recipes/ompl/1.5.2/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ompl/1.5.2/conanfile.py b/recipes/ompl/1.5.2/conanfile.py index 3c64b1ea44f8e..8e77149235579 100644 --- a/recipes/ompl/1.5.2/conanfile.py +++ b/recipes/ompl/1.5.2/conanfile.py @@ -24,7 +24,7 @@ class ConanOmpl(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' options = {"shared": [True, False], "run_tests": [ True, False], "fPIC": [True, False]} - default_options = {"shared": True, "run_tests": False, "fPIC": True} + default_options = {"shared": False, "run_tests": False, "fPIC": True} def configure(self): if self.options.shared: