From 4a8cae1b864f7c99b865694adc4a995b3e67231d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 19 Jan 2023 00:19:50 +0100 Subject: [PATCH 1/2] conan v2 support --- recipes/gtsam/all/CMakeLists.txt | 7 - recipes/gtsam/all/conandata.yml | 39 ++-- recipes/gtsam/all/conanfile.py | 181 ++++++++---------- .../gtsam/all/patches/0001-conan-4.0.2.patch | 132 ------------- .../gtsam/all/patches/0001-conan-4.0.3.patch | 89 --------- .../all/patches/4.0.2-0001-cmake-boost.patch | 61 ++++++ .../all/patches/4.0.2-0002-cmake-eigen.patch | 20 ++ ...0.2.patch => 4.0.2-0003-macos-rpath.patch} | 0 .../all/patches/4.0.3-0001-cmake-boost.patch | 30 +++ .../all/patches/4.0.3-0002-cmake-eigen.patch | 20 ++ ...0.3.patch => 4.0.3-0003-macos-rpath.patch} | 0 ...1.1.patch => 4.1.1-0001-cmake-boost.patch} | 0 .../all/patches/4.1.1-0002-cmake-eigen.patch | 20 ++ ...1.1.patch => 4.1.1-0003-macos-rpath.patch} | 23 ++- recipes/gtsam/all/test_package/CMakeLists.txt | 11 +- recipes/gtsam/all/test_package/conanfile.py | 19 +- .../gtsam/all/test_v1_package/CMakeLists.txt | 8 + .../gtsam/all/test_v1_package/conanfile.py | 17 ++ 18 files changed, 320 insertions(+), 357 deletions(-) delete mode 100644 recipes/gtsam/all/CMakeLists.txt delete mode 100644 recipes/gtsam/all/patches/0001-conan-4.0.2.patch delete mode 100644 recipes/gtsam/all/patches/0001-conan-4.0.3.patch create mode 100644 recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch create mode 100644 recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch rename recipes/gtsam/all/patches/{0002-macos-rpath-4.0.2.patch => 4.0.2-0003-macos-rpath.patch} (100%) create mode 100644 recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch create mode 100644 recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch rename recipes/gtsam/all/patches/{0002-macos-rpath-4.0.3.patch => 4.0.3-0003-macos-rpath.patch} (100%) rename recipes/gtsam/all/patches/{0001-conan-4.1.1.patch => 4.1.1-0001-cmake-boost.patch} (100%) create mode 100644 recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch rename recipes/gtsam/all/patches/{0002-macos-rpath-4.1.1.patch => 4.1.1-0003-macos-rpath.patch} (58%) create mode 100644 recipes/gtsam/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/gtsam/all/test_v1_package/conanfile.py diff --git a/recipes/gtsam/all/CMakeLists.txt b/recipes/gtsam/all/CMakeLists.txt deleted file mode 100644 index 04c96c99f25c3..0000000000000 --- a/recipes/gtsam/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/gtsam/all/conandata.yml b/recipes/gtsam/all/conandata.yml index 65a33ee134c24..25303332f445b 100644 --- a/recipes/gtsam/all/conandata.yml +++ b/recipes/gtsam/all/conandata.yml @@ -10,17 +10,32 @@ sources: 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" + - patch_file: "patches/4.1.1-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.1.1-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.1.1-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" "4.0.3": - - patch_file: "patches/0001-conan-4.0.3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-macos-rpath-4.0.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.3-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.0.3-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.0.3-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" "4.0.2": - - patch_file: "patches/0001-conan-4.0.2.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-macos-rpath-4.0.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.2-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.0.2-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.0.2-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" diff --git a/recipes/gtsam/all/conanfile.py b/recipes/gtsam/all/conanfile.py index 09dde9bc58be5..6ed583d1786ac 100644 --- a/recipes/gtsam/all/conanfile.py +++ b/recipes/gtsam/all/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class GtsamConan(ConanFile): @@ -14,7 +17,7 @@ class GtsamConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = ("GTSAM is a library of C++ classes that implement\ smoothing and mapping (SAM) in robotics and vision") - topics = ("gtsam", "mapping", "smoothing") + topics = ("mapping", "smoothing") settings = "os", "arch", "compiler", "build_type" options = { @@ -66,21 +69,8 @@ class GtsamConan(ConanFile): "install_cppunitlite": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - 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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -88,12 +78,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.with_TBB: self.options["onetbb"].tbbmalloc = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.81.0") self.requires("eigen/3.4.0") if self.options.with_TBB: self.requires("onetbb/2020.3") @@ -103,89 +96,86 @@ def _required_boost_components(self): return ["serialization", "system", "filesystem", "thread", "date_time", "regex", "timer", "chrono"] def validate(self): - miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components) - if self.options["boost"].header_only or miss_boost_required_comp: + miss_boost_required_comp = any(self.dependencies["boost"].options.get_safe(f"without_{boost_comp}", True) + for boost_comp in self._required_boost_components) + if self.dependencies["boost"].options.header_only or miss_boost_required_comp: raise ConanInvalidConfiguration( - "{0} requires non header-only boost with these components: {1}".format( - self.name, ", ".join(self._required_boost_components) - ) + f"{self.ref} requires non header-only boost with these components: " + f"{', '.join(self._required_boost_components)}" ) - if self.options.with_TBB and not self.options["onetbb"].tbbmalloc: + if self.options.with_TBB and not self.dependencies["onetbb"].options.tbbmalloc: raise ConanInvalidConfiguration("gtsam with tbb requires onetbb:tbbmalloc=True") - if is_msvc(self) and tools.Version(self.settings.compiler.version) < 15: - raise ConanInvalidConfiguration ("GTSAM requires MSVC >= 15") + check_min_vs(self, "191") - 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") + if Version(self.version) >= "4.1.0" and is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} does not support shared builds with 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["GTSAM_USE_QUATERNIONS"] = self.options.use_quaternions + tc.variables["GTSAM_POSE3_EXPMAP"] = self.options.pose3_expmap + tc.variables["GTSAM_ROT3_EXPMAP"] = self.options.rot3_expmap + tc.variables["GTSAM_ENABLE_CONSISTENCY_CHECKS"] = self.options.enable_consistency_checks + tc.variables["GTSAM_WITH_TBB"] = self.options.with_TBB + tc.variables["GTSAM_WITH_EIGEN_MKL"] = self.options.with_eigen_MKL + tc.variables["GTSAM_WITH_EIGEN_MKL_OPENMP"] = self.options.with_eigen_MKL_OPENMP + tc.variables["GTSAM_THROW_CHEIRALITY_EXCEPTION"] = self.options.throw_cheirality_exception + tc.variables["GTSAM_ALLOW_DEPRECATED_SINCE_V4"] = self.options.allow_deprecated_since_V4 + tc.variables["GTSAM_TYPEDEF_POINTS_TO_VECTORS"] = self.options.typedef_points_to_vectors + tc.variables["GTSAM_SUPPORT_NESTED_DISSECTION"] = self.options.support_nested_dissection + tc.variables["GTSAM_TANGENT_PREINTEGRATION"] = self.options.tangent_preintegration + tc.variables["GTSAM_BUILD_WITH_CCACHE"] = False + tc.variables["GTSAM_BUILD_UNSTABLE"] = self.options.build_unstable + tc.variables["GTSAM_DISABLE_NEW_TIMERS"] = self.options.disable_new_timers + tc.variables["GTSAM_BUILD_TYPE_POSTFIXES"] = self.options.build_type_postfixes + tc.variables["GTSAM_BUILD_TESTS"] = False + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.variables["Boost_NO_SYSTEM_PATHS"] = True + tc.variables["GTSAM_BUILD_DOCS"] = False + tc.variables["GTSAM_BUILD_DOC_HTML"] = False + tc.variables["GTSAM_BUILD_EXAMPLES_ALWAYS"] = False + tc.variables["GTSAM_BUILD_WRAP"] = self.options.build_wrap + tc.variables["GTSAM_BUILD_WITH_MARCH_NATIVE"] = False + tc.variables["GTSAM_WRAP_SERIALIZATION"] = self.options.wrap_serialization + tc.variables["GTSAM_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox + tc.variables["GTSAM_INSTALL_CYTHON_TOOLBOX"] = self.options.install_cython_toolbox + tc.variables["GTSAM_INSTALL_CPPUNITLITE"] = self.options.install_cppunitlite + tc.variables["GTSAM_INSTALL_GEOGRAPHICLIB"] = False + tc.variables["GTSAM_USE_SYSTEM_EIGEN"] = True + tc.variables["GTSAM_BUILD_TYPE_POSTFIXES"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + # Honor vc runtime if is_msvc(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "GtsamBuildTypes.cmake"), - "/MD ", - "/{} ".format(msvc_runtime_flag(self))) - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "GtsamBuildTypes.cmake"), - "/MDd ", - "/{} ".format(msvc_runtime_flag(self))) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["GTSAM_USE_QUATERNIONS"] = self.options.use_quaternions - self._cmake.definitions["GTSAM_POSE3_EXPMAP"] = self.options.pose3_expmap - self._cmake.definitions["GTSAM_ROT3_EXPMAP"] = self.options.rot3_expmap - self._cmake.definitions["GTSAM_ENABLE_CONSISTENCY_CHECKS"] = self.options.enable_consistency_checks - self._cmake.definitions["GTSAM_WITH_TBB"] = self.options.with_TBB - self._cmake.definitions["GTSAM_WITH_EIGEN_MKL"] = self.options.with_eigen_MKL - self._cmake.definitions["GTSAM_WITH_EIGEN_MKL_OPENMP"] = self.options.with_eigen_MKL_OPENMP - self._cmake.definitions["GTSAM_THROW_CHEIRALITY_EXCEPTION"] = self.options.throw_cheirality_exception - self._cmake.definitions["GTSAM_ALLOW_DEPRECATED_SINCE_V4"] = self.options.allow_deprecated_since_V4 - self._cmake.definitions["GTSAM_TYPEDEF_POINTS_TO_VECTORS"] = self.options.typedef_points_to_vectors - self._cmake.definitions["GTSAM_SUPPORT_NESTED_DISSECTION"] = self.options.support_nested_dissection - self._cmake.definitions["GTSAM_TANGENT_PREINTEGRATION"] = self.options.tangent_preintegration - self._cmake.definitions["GTSAM_BUILD_UNSTABLE"] = self.options.build_unstable - self._cmake.definitions["GTSAM_DISABLE_NEW_TIMERS"] = self.options.disable_new_timers - self._cmake.definitions["GTSAM_BUILD_TYPE_POSTFIXES"] = self.options.build_type_postfixes - self._cmake.definitions["GTSAM_BUILD_TESTS"] = False - self._cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - self._cmake.definitions["Boost_NO_SYSTEM_PATHS"] = True - self._cmake.definitions["GTSAM_BUILD_DOCS"] = False - self._cmake.definitions["GTSAM_BUILD_DOC_HTML"] = False - self._cmake.definitions["GTSAM_BUILD_EXAMPLES_ALWAYS"] = False - self._cmake.definitions["GTSAM_BUILD_WRAP"] = self.options.build_wrap - self._cmake.definitions["GTSAM_BUILD_WITH_MARCH_NATIVE"] = False - self._cmake.definitions["GTSAM_WRAP_SERIALIZATION"] = self.options.wrap_serialization - self._cmake.definitions["GTSAM_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox - self._cmake.definitions["GTSAM_INSTALL_CYTHON_TOOLBOX"] = self.options.install_cython_toolbox - self._cmake.definitions["GTSAM_INSTALL_CPPUNITLITE"] = self.options.install_cppunitlite - self._cmake.definitions["GTSAM_INSTALL_GEOGRAPHICLIB"] = False - self._cmake.definitions["GTSAM_USE_SYSTEM_EIGEN"] = True #Set to false to use eigen sources contained in GTSAM - self._cmake.definitions["GTSAM_BUILD_TYPE_POSTFIXES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + gtsam_build_types_cmake = os.path.join(self.source_folder, "cmake", "GtsamBuildTypes.cmake") + replace_in_file(self, gtsam_build_types_cmake, "/MD ", f"/{msvc_runtime_flag(self)} ") + replace_in_file(self, gtsam_build_types_cmake, "/MDd ", f"/{msvc_runtime_flag(self)} ") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.BSD", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.BSD", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "CMake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -198,21 +188,20 @@ def package(self): } ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "GTSAM") @@ -220,19 +209,19 @@ def package_info(self): 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)] - self.cpp_info.components["libgtsam"].requires = ["boost::{}".format(component) for component in self._required_boost_components] + self.cpp_info.components["libgtsam"].libs = [f"{prefix}gtsam"] + self.cpp_info.components["libgtsam"].requires = [f"boost::{component}" for component in self._required_boost_components] self.cpp_info.components["libgtsam"].requires.append("eigen::eigen") if self.options.with_TBB: self.cpp_info.components["libgtsam"].requires.append("onetbb::onetbb") if self.options.support_nested_dissection: self.cpp_info.components["libgtsam"].requires.append("libmetis-gtsam") - if self.settings.os == "Windows" and tools.Version(self.version) >= "4.0.3": + if self.settings.os == "Windows" and Version(self.version) >= "4.0.3": self.cpp_info.components["libgtsam"].system_libs = ["dbghelp"] if self.options.build_unstable: self.cpp_info.components["libgtsam_unstable"].set_property("cmake_target_name", "gtsam_unstable") - self.cpp_info.components["libgtsam_unstable"].libs = ["{}gtsam_unstable".format(prefix)] + self.cpp_info.components["libgtsam_unstable"].libs = [f"{prefix}gtsam_unstable"] self.cpp_info.components["libgtsam_unstable"].requires = ["libgtsam"] if self.options.support_nested_dissection: diff --git a/recipes/gtsam/all/patches/0001-conan-4.0.2.patch b/recipes/gtsam/all/patches/0001-conan-4.0.2.patch deleted file mode 100644 index 67dca2813a277..0000000000000 --- a/recipes/gtsam/all/patches/0001-conan-4.0.2.patch +++ /dev/null @@ -1,132 +0,0 @@ -diff --color -ruN cmake/GtsamPythonWrap.cmake cmake/GtsamPythonWrap.cmake ---- cmake/GtsamPythonWrap.cmake 2019-10-08 00:05:09.000000000 -0300 -+++ cmake/GtsamPythonWrap.cmake 2020-12-01 16:12:54.459435000 -0300 -@@ -69,7 +69,7 @@ - ENDIF(MSVC) - - # Installs the library in the gtsam folder, which is used by setup.py to create the gtsam package -- set(PYTHON_MODULE_DIRECTORY ${CMAKE_SOURCE_DIR}/python/gtsam) -+ set(PYTHON_MODULE_DIRECTORY ${GTSAM_SOURCE_DIR}/python/gtsam) - # Cause the library to be output in the correct directory. - add_custom_command(TARGET ${moduleName}_python - POST_BUILD -diff --color -ruN CMakeLists.txt CMakeLists.txt ---- CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -35,7 +35,7 @@ - include(GtsamPrinting) - - # guard against in-source builds --if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -+if(${GTSAM_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") - endif() - -@@ -163,13 +163,13 @@ - set(BOOST_FIND_MINIMUM_VERSION 1.43) - 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}) -+find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) - - # 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.43, please install/upgrade Boost or configure your search paths.") --endif() -+#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.43, please install/upgrade Boost or configure your search paths.") -+#endif() - - # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) - option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) -@@ -179,30 +179,22 @@ - # so we downgraded this to classic filenames-based variables, and manually adding - # the target_include_directories(xxx ${Boost_INCLUDE_DIR}) - set(GTSAM_BOOST_LIBRARIES -- optimized ${Boost_SERIALIZATION_LIBRARY_RELEASE} -- optimized ${Boost_SYSTEM_LIBRARY_RELEASE} -- optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE} -- optimized ${Boost_THREAD_LIBRARY_RELEASE} -- optimized ${Boost_DATE_TIME_LIBRARY_RELEASE} -- optimized ${Boost_REGEX_LIBRARY_RELEASE} -- debug ${Boost_SERIALIZATION_LIBRARY_DEBUG} -- debug ${Boost_SYSTEM_LIBRARY_DEBUG} -- debug ${Boost_FILESYSTEM_LIBRARY_DEBUG} -- debug ${Boost_THREAD_LIBRARY_DEBUG} -- debug ${Boost_DATE_TIME_LIBRARY_DEBUG} -- debug ${Boost_REGEX_LIBRARY_DEBUG} -+ Boost::serialization -+ Boost::system -+ Boost::filesystem -+ Boost::thread -+ Boost::date_time -+ Boost::regex - ) - message(STATUS "GTSAM_BOOST_LIBRARIES: ${GTSAM_BOOST_LIBRARIES}") - 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 -- optimized ${Boost_TIMER_LIBRARY_RELEASE} -- optimized ${Boost_CHRONO_LIBRARY_RELEASE} -- debug ${Boost_TIMER_LIBRARY_DEBUG} -- debug ${Boost_CHRONO_LIBRARY_DEBUG} -+ Boost::timer -+ Boost::chrono - ) - else() - list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt -@@ -328,7 +320,7 @@ - set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/") - - # The actual include directory (for BUILD cmake target interface): -- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") -+ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${GTSAM_SOURCE_DIR}/gtsam/3rdparty/Eigen/") - endif() - - # Detect Eigen version: -diff --color -ruN gtsam/CMakeLists.txt gtsam/CMakeLists.txt ---- gtsam/CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ gtsam/CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -145,18 +145,18 @@ - $ - $ - # main gtsam includes: -- $ -+ $ - $ - # config.h -- $ -+ $ - # unit tests: -- $ -+ $ - ) - if(GTSAM_SUPPORT_NESTED_DISSECTION) - target_include_directories(gtsam BEFORE PUBLIC -- $ -- $ -- $ -+ $ -+ $ -+ $ - $ - ) - endif() -diff --color -ruN wrap/CMakeLists.txt wrap/CMakeLists.txt ---- wrap/CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ wrap/CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -20,7 +20,7 @@ - list(REMOVE_ITEM wrap_srcs ${CMAKE_CURRENT_SOURCE_DIR}/wrap.cpp) - add_library(wrap_lib STATIC ${wrap_srcs} ${wrap_headers}) - target_include_directories(wrap_lib PUBLIC -- $ -+ $ - ) - if (NOT GTSAM_WRAP_SERIALIZATION) - target_compile_definitions(wrap_lib PUBLIC -DWRAP_DISABLE_SERIALIZE) diff --git a/recipes/gtsam/all/patches/0001-conan-4.0.3.patch b/recipes/gtsam/all/patches/0001-conan-4.0.3.patch deleted file mode 100644 index 0929203d3dc38..0000000000000 --- a/recipes/gtsam/all/patches/0001-conan-4.0.3.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --color -ruN cmake/GtsamPythonWrap.cmake cmake/GtsamPythonWrap.cmake ---- cmake/GtsamPythonWrap.cmake 2020-07-22 13:22:57.000000000 -0300 -+++ cmake/GtsamPythonWrap.cmake 2020-12-02 11:28:50.140088741 -0300 -@@ -69,7 +69,7 @@ - ENDIF(MSVC) - - # Installs the library in the gtsam folder, which is used by setup.py to create the gtsam package -- set(PYTHON_MODULE_DIRECTORY ${CMAKE_SOURCE_DIR}/python/gtsam) -+ set(PYTHON_MODULE_DIRECTORY ${GTSAM_SOURCE_DIR}/python/gtsam) - # Cause the library to be output in the correct directory. - add_custom_command(TARGET ${moduleName}_python - POST_BUILD -diff --color -ruN CMakeLists.txt CMakeLists.txt ---- CMakeLists.txt 2020-07-22 13:22:57.000000000 -0300 -+++ CMakeLists.txt 2020-12-02 11:30:42.049922171 -0300 -@@ -36,7 +36,7 @@ - include(GtsamPrinting) - - # guard against in-source builds --if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -+if(${GTSAM_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") - endif() - -@@ -164,13 +164,13 @@ - set(BOOST_FIND_MINIMUM_VERSION 1.43) - 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}) -+find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) - - # 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.43, please install/upgrade Boost or configure your search paths.") --endif() -+#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.43, please install/upgrade Boost or configure your search paths.") -+#endif() - - 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) -@@ -186,7 +186,7 @@ - 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 -@@ -311,7 +311,7 @@ - set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/") - - # The actual include directory (for BUILD cmake target interface): -- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") -+ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${GTSAM_SOURCE_DIR}/gtsam/3rdparty/Eigen/") - endif() - - # Detect Eigen version: -diff --color -ruN gtsam/CMakeLists.txt gtsam/CMakeLists.txt ---- gtsam/CMakeLists.txt 2020-07-22 13:22:57.000000000 -0300 -+++ gtsam/CMakeLists.txt 2020-12-02 11:40:57.040582346 -0300 -@@ -141,18 +141,18 @@ - $ - $ - # main gtsam includes: -- $ -+ $ - $ - # config.h -- $ -+ $ - # unit tests: -- $ -+ $ - ) - if(GTSAM_SUPPORT_NESTED_DISSECTION) - target_include_directories(gtsam BEFORE PUBLIC -- $ -- $ -- $ -+ $ -+ $ -+ $ - $ - ) - endif() diff --git a/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch b/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch new file mode 100644 index 0000000000000..d19f34cd53327 --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch @@ -0,0 +1,61 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -163,13 +163,13 @@ + set(BOOST_FIND_MINIMUM_VERSION 1.43) + 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}) ++find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) + + # 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.43, please install/upgrade Boost or configure your search paths.") +-endif() ++#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.43, please install/upgrade Boost or configure your search paths.") ++#endif() + + # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) + option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) +@@ -179,30 +179,22 @@ + # so we downgraded this to classic filenames-based variables, and manually adding + # the target_include_directories(xxx ${Boost_INCLUDE_DIR}) + set(GTSAM_BOOST_LIBRARIES +- optimized ${Boost_SERIALIZATION_LIBRARY_RELEASE} +- optimized ${Boost_SYSTEM_LIBRARY_RELEASE} +- optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE} +- optimized ${Boost_THREAD_LIBRARY_RELEASE} +- optimized ${Boost_DATE_TIME_LIBRARY_RELEASE} +- optimized ${Boost_REGEX_LIBRARY_RELEASE} +- debug ${Boost_SERIALIZATION_LIBRARY_DEBUG} +- debug ${Boost_SYSTEM_LIBRARY_DEBUG} +- debug ${Boost_FILESYSTEM_LIBRARY_DEBUG} +- debug ${Boost_THREAD_LIBRARY_DEBUG} +- debug ${Boost_DATE_TIME_LIBRARY_DEBUG} +- debug ${Boost_REGEX_LIBRARY_DEBUG} ++ Boost::serialization ++ Boost::system ++ Boost::filesystem ++ Boost::thread ++ Boost::date_time ++ Boost::regex + ) + message(STATUS "GTSAM_BOOST_LIBRARIES: ${GTSAM_BOOST_LIBRARIES}") + 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 +- optimized ${Boost_TIMER_LIBRARY_RELEASE} +- optimized ${Boost_CHRONO_LIBRARY_RELEASE} +- debug ${Boost_TIMER_LIBRARY_DEBUG} +- debug ${Boost_CHRONO_LIBRARY_DEBUG} ++ 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/4.0.2-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..21c808ace60fd --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -292,7 +292,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -307,7 +307,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch b/recipes/gtsam/all/patches/4.0.2-0003-macos-rpath.patch similarity index 100% rename from recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch rename to recipes/gtsam/all/patches/4.0.2-0003-macos-rpath.patch diff --git a/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch b/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch new file mode 100644 index 0000000000000..ca7acfebb3fa2 --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,13 +164,13 @@ + set(BOOST_FIND_MINIMUM_VERSION 1.43) + 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}) ++find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) + + # 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.43, please install/upgrade Boost or configure your search paths.") +-endif() ++#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.43, please install/upgrade Boost or configure your search paths.") ++#endif() + + 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) +@@ -186,7 +186,7 @@ + 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/4.0.3-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..13c0702834d4b --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -283,7 +283,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -298,7 +298,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.0.3.patch b/recipes/gtsam/all/patches/4.0.3-0003-macos-rpath.patch similarity index 100% rename from recipes/gtsam/all/patches/0002-macos-rpath-4.0.3.patch rename to recipes/gtsam/all/patches/4.0.3-0003-macos-rpath.patch diff --git a/recipes/gtsam/all/patches/0001-conan-4.1.1.patch b/recipes/gtsam/all/patches/4.1.1-0001-cmake-boost.patch similarity index 100% rename from recipes/gtsam/all/patches/0001-conan-4.1.1.patch rename to recipes/gtsam/all/patches/4.1.1-0001-cmake-boost.patch diff --git a/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..61e8f3ee3656f --- /dev/null +++ b/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/cmake/HandleEigen.cmake ++++ b/cmake/HandleEigen.cmake +@@ -14,7 +14,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -29,7 +29,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch b/recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch similarity index 58% rename from recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch rename to recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch index 84336aaee8564..1a596c6b0883a 100644 --- a/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch +++ b/recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch @@ -1,4 +1,3 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) @@ -9,19 +8,25 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt 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/cmake/HandleGlobalBuildFlags.cmake ++++ b/cmake/HandleGlobalBuildFlags.cmake +@@ -20,7 +20,6 @@ endif() + + if (APPLE AND BUILD_SHARED_LIBS) + # Set the default install directory on macOS +- set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + ############################################################################### --- 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") +@@ -17,9 +17,6 @@ if(WIN32) endif() --if (APPLE) + if (APPLE) - set_target_properties(metis-gtsam PROPERTIES - INSTALL_NAME_DIR - "${CMAKE_INSTALL_PREFIX}/lib") -- endif() -- + endif() + install(TARGETS metis-gtsam EXPORT GTSAM-exports - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/gtsam/all/test_package/CMakeLists.txt b/recipes/gtsam/all/test_package/CMakeLists.txt index bac6d84e2319d..3f46187fc1f60 100644 --- a/recipes/gtsam/all/test_package/CMakeLists.txt +++ b/recipes/gtsam/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(GTSAM REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gtsam) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE gtsam) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gtsam/all/test_package/conanfile.py b/recipes/gtsam/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/gtsam/all/test_package/conanfile.py +++ b/recipes/gtsam/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gtsam/all/test_v1_package/CMakeLists.txt b/recipes/gtsam/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gtsam/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gtsam/all/test_v1_package/conanfile.py b/recipes/gtsam/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gtsam/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From eba67ccf4b515b9cd06f942b862c67df396e3967 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:05:43 +0100 Subject: [PATCH 2/2] fix position of project() in CMakeLists --- recipes/gtsam/all/conandata.yml | 9 +++++++++ recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch diff --git a/recipes/gtsam/all/conandata.yml b/recipes/gtsam/all/conandata.yml index 25303332f445b..a7ab46e7ea6fb 100644 --- a/recipes/gtsam/all/conandata.yml +++ b/recipes/gtsam/all/conandata.yml @@ -19,6 +19,9 @@ patches: - patch_file: "patches/4.1.1-0003-macos-rpath.patch" patch_description: "Relocatable shared libs on Apple OS" patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" "4.0.3": - patch_file: "patches/4.0.3-0001-cmake-boost.patch" patch_description: "Use boost targets" @@ -29,6 +32,9 @@ patches: - patch_file: "patches/4.0.3-0003-macos-rpath.patch" patch_description: "Relocatable shared libs on Apple OS" patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" "4.0.2": - patch_file: "patches/4.0.2-0001-cmake-boost.patch" patch_description: "Use boost targets" @@ -39,3 +45,6 @@ patches: - patch_file: "patches/4.0.2-0003-macos-rpath.patch" patch_description: "Relocatable shared libs on Apple OS" patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" diff --git a/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch b/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch new file mode 100644 index 0000000000000..e6d665e0c60aa --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch @@ -0,0 +1,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-project(GTSAM CXX C) + cmake_minimum_required(VERSION 3.0) ++project(GTSAM CXX C) + + # new feature to Cmake Version > 2.8.12 + # Mac ONLY. Define Relative Path on Mac OS