diff --git a/recipes/gtsam/all/conandata.yml b/recipes/gtsam/all/conandata.yml index 1612a37c7aa97..65a33ee134c24 100644 --- a/recipes/gtsam/all/conandata.yml +++ b/recipes/gtsam/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.1": + url: "https://github.com/borglab/gtsam/archive/4.1.1.tar.gz" + sha256: "c7b5e6cdad52b141c272778f47baf628975457be3e26ed96a7bc2ae685a00af0" "4.0.3": url: "https://github.com/borglab/gtsam/archive/4.0.3.tar.gz" sha256: "eaa561749edf7a2d402981828253e28aed6c717dae35738301c5ab23e2595f25" @@ -6,6 +9,11 @@ sources: url: "https://github.com/borglab/gtsam/archive/4.0.2.tar.gz" sha256: "8770a440f1af98c3f0d9d4dffd568de2d4c21b245e7231e987e26bc236aeb5aa" patches: + "4.1.1": + - patch_file: "patches/0001-conan-4.1.1.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-macos-rpath-4.1.1.patch" + base_path: "source_subfolder" "4.0.3": - patch_file: "patches/0001-conan-4.0.3.patch" base_path: "source_subfolder" diff --git a/recipes/gtsam/all/conanfile.py b/recipes/gtsam/all/conanfile.py index 5ec6b807c74ad..09dde9bc58be5 100644 --- a/recipes/gtsam/all/conanfile.py +++ b/recipes/gtsam/all/conanfile.py @@ -1,4 +1,4 @@ -from conan.tools.microsoft import msvc_runtime_flag +from conan.tools.microsoft import msvc_runtime_flag, is_msvc from conans import ConanFile, tools, CMake from conans.errors import ConanInvalidConfiguration import os @@ -77,10 +77,6 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): self.copy("CMakeLists.txt") for patch in self.conan_data.get("patches", {}).get(self.version, []): @@ -118,9 +114,13 @@ def validate(self): if self.options.with_TBB and not self.options["onetbb"].tbbmalloc: raise ConanInvalidConfiguration("gtsam with tbb requires onetbb:tbbmalloc=True") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 15: + if is_msvc(self) and tools.Version(self.settings.compiler.version) < 15: raise ConanInvalidConfiguration ("GTSAM requires MSVC >= 15") + if is_msvc(self) and tools.Version(self.version) >= '4.1' \ + and self.options.shared: + raise ConanInvalidConfiguration("GTSAM does not support shared builds on MSVC. see https://github.com/borglab/gtsam/issues/1087") + def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @@ -128,7 +128,7 @@ def source(self): def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) - if self._is_msvc: + if is_msvc(self): tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "GtsamBuildTypes.cmake"), "/MD ", "/{} ".format(msvc_runtime_flag(self))) @@ -217,7 +217,7 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "GTSAM") - prefix = "lib" if self._is_msvc and not self.options.shared else "" + prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.components["libgtsam"].set_property("cmake_target_name", "gtsam") self.cpp_info.components["libgtsam"].libs = ["{}gtsam".format(prefix)] diff --git a/recipes/gtsam/all/patches/0001-conan-4.1.1.patch b/recipes/gtsam/all/patches/0001-conan-4.1.1.patch new file mode 100644 index 0000000000000..ccc216be860c8 --- /dev/null +++ b/recipes/gtsam/all/patches/0001-conan-4.1.1.patch @@ -0,0 +1,27 @@ +diff --git a/cmake/HandleBoost.cmake b/cmake/HandleBoost.cmake +--- a/cmake/HandleBoost.cmake ++++ b/cmake/HandleBoost.cmake +@@ -25,13 +25,7 @@ endif() + set(BOOST_FIND_MINIMUM_VERSION 1.65) + set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex) + +-find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS}) +- +-# Required components +-if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR +- NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) +- message(FATAL_ERROR "Missing required Boost components >= v1.65, please install/upgrade Boost or configure your search paths.") +-endif() ++find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) + + option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) + # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) +@@ -47,7 +41,7 @@ if (GTSAM_DISABLE_NEW_TIMERS) + message("WARNING: GTSAM timing instrumentation manually disabled") + list_append_cache(GTSAM_COMPILE_DEFINITIONS_PUBLIC DGTSAM_DISABLE_NEW_TIMERS) + else() +- if(Boost_TIMER_LIBRARY) ++ if(TARGET Boost::timer) + list(APPEND GTSAM_BOOST_LIBRARIES Boost::timer Boost::chrono) + else() + list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch b/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch new file mode 100644 index 0000000000000..84336aaee8564 --- /dev/null +++ b/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) + # new feature to Cmake Version > 2.8.12 + # Mac ONLY. Define Relative Path on Mac OS + if(NOT DEFINED CMAKE_MACOSX_RPATH) +- set(CMAKE_MACOSX_RPATH 0) + endif() + + # Set the version number for the library +diff --git a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt +--- a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt ++++ b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt +@@ -16,12 +16,6 @@ if(WIN32) + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/../../../bin") + endif() + +-if (APPLE) +- set_target_properties(metis-gtsam PROPERTIES +- INSTALL_NAME_DIR +- "${CMAKE_INSTALL_PREFIX}/lib") +- endif() +- + install(TARGETS metis-gtsam EXPORT GTSAM-exports + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/gtsam/config.yml b/recipes/gtsam/config.yml index d9e49f7cf409c..6f380a83ebb14 100644 --- a/recipes/gtsam/config.yml +++ b/recipes/gtsam/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.1": + folder: all "4.0.3": folder: all "4.0.2":