Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ompl/1.5.2 recipe #6542

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ompl: fix conan attributes
url, author
  • Loading branch information
mohamedghita committed Jul 27, 2021
commit 2764f17695093f1327c0fce65b1b4521d4bd184f
75 changes: 42 additions & 33 deletions recipes/ompl/1.5.2/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
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"
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)"
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):
Expand All @@ -38,43 +41,49 @@ 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)
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"]
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):
Expand All @@ -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']
self.cpp_info.libdirs = ['lib']
2 changes: 1 addition & 1 deletion recipes/ompl/1.5.2/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
9 changes: 2 additions & 7 deletions recipes/ompl/1.5.2/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)