From b8d84a3ac4d216ae4e5993dc1d213cfd15aa70b1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jul 2023 23:16:23 +0300 Subject: [PATCH 01/19] libigl: migrate to Conan v2 --- recipes/libigl/2.x.x/CMakeLists.txt | 5 +- recipes/libigl/2.x.x/conandata.yml | 4 - recipes/libigl/2.x.x/conanfile.py | 210 ++++++++++-------- .../2.x.x/patches/0001-correct-fpic.patch | 17 -- .../libigl/2.x.x/test_package/CMakeLists.txt | 5 +- .../libigl/2.x.x/test_package/conanfile.py | 23 +- .../2.x.x/test_v1_package/CMakeLists.txt | 8 + .../libigl/2.x.x/test_v1_package/conanfile.py | 19 ++ 8 files changed, 161 insertions(+), 130 deletions(-) delete mode 100644 recipes/libigl/2.x.x/patches/0001-correct-fpic.patch create mode 100644 recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt create mode 100644 recipes/libigl/2.x.x/test_v1_package/conanfile.py diff --git a/recipes/libigl/2.x.x/CMakeLists.txt b/recipes/libigl/2.x.x/CMakeLists.txt index 64994fe16fd84..1fdb7845ab9fc 100644 --- a/recipes/libigl/2.x.x/CMakeLists.txt +++ b/recipes/libigl/2.x.x/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(conanlibigl) -include(conanbuildinfo.cmake) -conan_basic_setup() - find_package(Eigen3 REQUIRED) -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/libigl/2.x.x/conandata.yml b/recipes/libigl/2.x.x/conandata.yml index 1ac5bf040c202..8e0e122c545ef 100644 --- a/recipes/libigl/2.x.x/conandata.yml +++ b/recipes/libigl/2.x.x/conandata.yml @@ -2,7 +2,3 @@ sources: "2.3.0": sha256: 5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455 url: https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip -patches: - "2.3.0": - - patch_file: "patches/0001-correct-fpic.patch" - base_path: "source_subfolder" diff --git a/recipes/libigl/2.x.x/conanfile.py b/recipes/libigl/2.x.x/conanfile.py index f5ac50b8841ac..bc8747c50231a 100644 --- a/recipes/libigl/2.x.x/conanfile.py +++ b/recipes/libigl/2.x.x/conanfile.py @@ -1,30 +1,35 @@ import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class LibiglConan(ConanFile): name = "libigl" - description = ("Simple C++ geometry processing library") - topics = ("conan", "libigl", "geometry", "matrices", "algorithms") + description = "Simple C++ geometry processing library" + license = "MPL-2.0" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] homepage = "https://libigl.github.io/" - license = "MPL-2.0" - settings = "os", "arch", "compiler", "build_type" - options = {"header_only": [True, False], "fPIC": [True, False]} - default_options = {"header_only": True, "fPIC": True} - generators = "cmake", "cmake_find_package" - requires = ("eigen/3.3.9") - _cmake = None + topics = ("geometry", "matrices", "algorithms", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "header_only": [True, False], + } + default_options = { + "fPIC": True, + "header_only": True, + } + no_copy_source = True @property def _minimum_cpp_standard(self): @@ -34,26 +39,14 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "6", "clang": "3.4", "apple-clang": "5.1", } - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) - else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( - self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) - if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime and not self.options.header_only: - raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") - if "arm" in self.settings.arch or "x86" is self.settings.arch: - raise ConanInvalidConfiguration("Not available for arm. Requested arch: {}".format(self.settings.arch)) + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -61,80 +54,111 @@ def config_options(self): def configure(self): if self.options.header_only: - del self.options.fPIC + self.options.rm_safe("fPIC") - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("eigen/3.4.0", transitive_headers=True) + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if not min_version: + self.output.warning( + f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support." + ) + else: + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) + if is_msvc_static_runtime(self) and not self.options.header_only: + raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") + if "arm" in self.settings.arch or "x86" is self.settings.arch: + raise ConanInvalidConfiguration( + f"Not available for arm. Requested arch: {self.settings.arch}" + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self, parallel=False) - self._cmake.definitions["LIBIGL_EXPORT_TARGETS"] = True - self._cmake.definitions["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only - - # All these dependencies are needed to build the examples or the tests - self._cmake.definitions["LIBIGL_BUILD_TUTORIALS"] = "OFF" - self._cmake.definitions["LIBIGL_BUILD_TESTS"] = "OFF" - self._cmake.definitions["LIBIGL_BUILD_PYTHON"] = "OFF" - - self._cmake.definitions["LIBIGL_WITH_CGAL"] = False - self._cmake.definitions["LIBIGL_WITH_COMISO"] = False - self._cmake.definitions["LIBIGL_WITH_CORK"] = False - self._cmake.definitions["LIBIGL_WITH_EMBREE"] = False - self._cmake.definitions["LIBIGL_WITH_MATLAB"] = False - self._cmake.definitions["LIBIGL_WITH_MOSEK"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL_GLFW"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False - self._cmake.definitions["LIBIGL_WITH_PNG"] = False - self._cmake.definitions["LIBIGL_WITH_TETGEN"] = False - self._cmake.definitions["LIBIGL_WITH_TRIANGLE"] = False - self._cmake.definitions["LIBIGL_WITH_XML"] = False - self._cmake.definitions["LIBIGL_WITH_PYTHON"] = "OFF" - self._cmake.definitions["LIBIGL_WITH_PREDICATES"] = False - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBIGL_EXPORT_TARGETS"] = True + tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only + + # All these dependencies are needed to build the examples or the tests + tc.variables["LIBIGL_BUILD_TUTORIALS"] = "OFF" + tc.variables["LIBIGL_BUILD_TESTS"] = "OFF" + tc.variables["LIBIGL_BUILD_PYTHON"] = "OFF" + + tc.variables["LIBIGL_WITH_CGAL"] = False + tc.variables["LIBIGL_WITH_COMISO"] = False + tc.variables["LIBIGL_WITH_CORK"] = False + tc.variables["LIBIGL_WITH_EMBREE"] = False + tc.variables["LIBIGL_WITH_MATLAB"] = False + tc.variables["LIBIGL_WITH_MOSEK"] = False + tc.variables["LIBIGL_WITH_OPENGL"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False + tc.variables["LIBIGL_WITH_PNG"] = False + tc.variables["LIBIGL_WITH_TETGEN"] = False + tc.variables["LIBIGL_WITH_TRIANGLE"] = False + tc.variables["LIBIGL_WITH_XML"] = False + tc.variables["LIBIGL_WITH_PYTHON"] = "OFF" + tc.variables["LIBIGL_WITH_PREDICATES"] = False + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + libigl_cmake = os.path.join(self.source_folder, "cmake", "libigl.cmake") + replace_in_file(self, libigl_cmake, "-fPIC", "") + replace_in_file(self, libigl_cmake, "INTERFACE_POSITION_INDEPENDENT_CODE ON", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() - cmake.configure() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENSE.GPL", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.MPL2", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE.GPL", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE.MPL2", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) if not self.options.header_only: - tools.remove_files_by_mask(self.package_folder, "*.c") - tools.remove_files_by_mask(self.package_folder, "*.cpp") - - def package_id(self): - if self.options.header_only: - self.info.header_only() + rm(self, "*.c", self.package_folder, recursive=True) + rm(self, "*.cpp", self.package_folder, recursive=True) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libigl") + self.cpp_info.set_property("cmake_target_name", "igl::igl") + + self.cpp_info.components["common"].set_property("cmake_target_name", "igl::common") + self.cpp_info.components["common"].requires = ["eigen::eigen"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["common"].system_libs = ["pthread"] + + self.cpp_info.components["core"].set_property("cmake_target_name", "igl::core") + self.cpp_info.components["core"].requires = ["common"] + if not self.options.header_only: + self.cpp_info.components["core"].libs = ["igl"] + self.cpp_info.components["core"].defines.append("IGL_STATIC_LIBRARY") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "libigl" self.cpp_info.filenames["cmake_find_package_multi"] = "libigl" self.cpp_info.names["cmake_find_package"] = "igl" self.cpp_info.names["cmake_find_package_multi"] = "igl" - - self.cpp_info.components["igl_common"].names["cmake_find_package"] = "common" - self.cpp_info.components["igl_common"].names["cmake_find_package_multi"] = "common" - self.cpp_info.components["igl_common"].libs = [] - self.cpp_info.components["igl_common"].requires = ["eigen::eigen"] - if self.settings.os == "Linux": - self.cpp_info.components["igl_common"].system_libs = ["pthread"] - - self.cpp_info.components["igl_core"].names["cmake_find_package"] = "core" - self.cpp_info.components["igl_core"].names["cmake_find_package_multi"] = "core" - self.cpp_info.components["igl_core"].requires = ["igl_common"] - if not self.options.header_only: - self.cpp_info.components["igl_core"].libs = ["igl"] - self.cpp_info.components["igl_core"].defines.append("IGL_STATIC_LIBRARY") diff --git a/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch b/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch deleted file mode 100644 index 6a5a6c38650c0..0000000000000 --- a/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake -index 6de1b418..0cc75fcd 100644 ---- a/cmake/libigl.cmake -+++ b/cmake/libigl.cmake -@@ -96,11 +96,6 @@ if(BUILD_SHARED_LIBS) - set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON) - endif() - --if(UNIX AND NOT HUNTER_ENABLED) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") --endif() -- - if(HUNTER_ENABLED) - hunter_add_package(Eigen) - find_package(Eigen3 CONFIG REQUIRED) - diff --git a/recipes/libigl/2.x.x/test_package/CMakeLists.txt b/recipes/libigl/2.x.x/test_package/CMakeLists.txt index 174c1ae49d642..eba5d0a0a901d 100644 --- a/recipes/libigl/2.x.x/test_package/CMakeLists.txt +++ b/recipes/libigl/2.x.x/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libigl REQUIRED CONFIG) add_executable(example example.cpp) diff --git a/recipes/libigl/2.x.x/test_package/conanfile.py b/recipes/libigl/2.x.x/test_package/conanfile.py index 321eb52ae4077..8d52b7021efe1 100644 --- a/recipes/libigl/2.x.x/test_package/conanfile.py +++ b/recipes/libigl/2.x.x/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibiglTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/libigl/2.x.x/test_v1_package/conanfile.py b/recipes/libigl/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..321eb52ae4077 --- /dev/null +++ b/recipes/libigl/2.x.x/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os + +from conans import ConanFile, CMake, tools + + +class LibiglTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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.settings): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) + From f832d38de4cacded7b2a5b4825f31c5939a14d5f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 19 Sep 2023 13:56:34 +0300 Subject: [PATCH 02/19] libigl: add v3.4.0 --- recipes/libigl/2.x.x/conandata.yml | 4 - recipes/libigl/{2.x.x => all}/CMakeLists.txt | 0 recipes/libigl/all/conandata.yml | 7 ++ recipes/libigl/{2.x.x => all}/conanfile.py | 87 +++++++++---------- .../test_package/CMakeLists.txt | 0 .../{2.x.x => all}/test_package/conanfile.py | 0 .../{2.x.x => all}/test_package/example.cpp | 0 .../test_v1_package/CMakeLists.txt | 0 .../test_v1_package/conanfile.py | 0 recipes/libigl/config.yml | 4 +- 10 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 recipes/libigl/2.x.x/conandata.yml rename recipes/libigl/{2.x.x => all}/CMakeLists.txt (100%) create mode 100644 recipes/libigl/all/conandata.yml rename recipes/libigl/{2.x.x => all}/conanfile.py (64%) rename recipes/libigl/{2.x.x => all}/test_package/CMakeLists.txt (100%) rename recipes/libigl/{2.x.x => all}/test_package/conanfile.py (100%) rename recipes/libigl/{2.x.x => all}/test_package/example.cpp (100%) rename recipes/libigl/{2.x.x => all}/test_v1_package/CMakeLists.txt (100%) rename recipes/libigl/{2.x.x => all}/test_v1_package/conanfile.py (100%) diff --git a/recipes/libigl/2.x.x/conandata.yml b/recipes/libigl/2.x.x/conandata.yml deleted file mode 100644 index 8e0e122c545ef..0000000000000 --- a/recipes/libigl/2.x.x/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "2.3.0": - sha256: 5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455 - url: https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip diff --git a/recipes/libigl/2.x.x/CMakeLists.txt b/recipes/libigl/all/CMakeLists.txt similarity index 100% rename from recipes/libigl/2.x.x/CMakeLists.txt rename to recipes/libigl/all/CMakeLists.txt diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml new file mode 100644 index 0000000000000..b30e52821d534 --- /dev/null +++ b/recipes/libigl/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.4.0": + url: "https://github.com/libigl/libigl/archive/refs/tags/v2.4.0.zip" + sha256: "b20d80c9a3fa7d0c6bc3adee58e44f0cdb1cbb49228df6d67f9ddbfc08ee1403" + "2.3.0": + url: "https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip" + sha256: "5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455" diff --git a/recipes/libigl/2.x.x/conanfile.py b/recipes/libigl/all/conanfile.py similarity index 64% rename from recipes/libigl/2.x.x/conanfile.py rename to recipes/libigl/all/conanfile.py index bc8747c50231a..e88abcd52d215 100644 --- a/recipes/libigl/2.x.x/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -19,7 +19,7 @@ class LibiglConan(ConanFile): homepage = "https://libigl.github.io/" topics = ("geometry", "matrices", "algorithms", "header-only") - package_type = "library" + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -27,9 +27,8 @@ class LibiglConan(ConanFile): } default_options = { "fPIC": True, - "header_only": True, + "header_only": False, } - no_copy_source = True @property def _minimum_cpp_standard(self): @@ -60,31 +59,25 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("eigen/3.4.0", transitive_headers=True) + # Eigen v3.4+ is not compatible + self.requires("eigen/3.3.9", transitive_headers=True) def package_id(self): if self.info.options.header_only: self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if not min_version: - self.output.warning( - f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support." - ) - else: - if Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" - f" {self.settings.compiler} {self.settings.compiler.version} does not support it." - ) + if "arm" in self.settings.arch or "x86" is self.settings.arch: + raise ConanInvalidConfiguration(f"Not available for arm. Requested arch: {self.settings.arch}") if is_msvc_static_runtime(self) and not self.options.header_only: raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") - if "arm" in self.settings.arch or "x86" is self.settings.arch: + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if min_version and Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( - f"Not available for arm. Requested arch: {self.settings.arch}" + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." ) def source(self): @@ -92,38 +85,42 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["LIBIGL_EXPORT_TARGETS"] = True - tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only + tc.cache_variables["LIBIGL_INSTALL"] = True + tc.cache_variables["LIBIGL_EXPORT_TARGETS"] = True + tc.cache_variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only + tc.cache_variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0048"] = "NEW" # All these dependencies are needed to build the examples or the tests - tc.variables["LIBIGL_BUILD_TUTORIALS"] = "OFF" - tc.variables["LIBIGL_BUILD_TESTS"] = "OFF" - tc.variables["LIBIGL_BUILD_PYTHON"] = "OFF" - - tc.variables["LIBIGL_WITH_CGAL"] = False - tc.variables["LIBIGL_WITH_COMISO"] = False - tc.variables["LIBIGL_WITH_CORK"] = False - tc.variables["LIBIGL_WITH_EMBREE"] = False - tc.variables["LIBIGL_WITH_MATLAB"] = False - tc.variables["LIBIGL_WITH_MOSEK"] = False - tc.variables["LIBIGL_WITH_OPENGL"] = False - tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False - tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False - tc.variables["LIBIGL_WITH_PNG"] = False - tc.variables["LIBIGL_WITH_TETGEN"] = False - tc.variables["LIBIGL_WITH_TRIANGLE"] = False - tc.variables["LIBIGL_WITH_XML"] = False - tc.variables["LIBIGL_WITH_PYTHON"] = "OFF" - tc.variables["LIBIGL_WITH_PREDICATES"] = False + tc.cache_variables["LIBIGL_BUILD_TUTORIALS"] = False + tc.cache_variables["LIBIGL_BUILD_TESTS"] = False + tc.cache_variables["LIBIGL_BUILD_PYTHON"] = False + + tc.cache_variables["LIBIGL_WITH_CGAL"] = False + tc.cache_variables["LIBIGL_WITH_COMISO"] = False + tc.cache_variables["LIBIGL_WITH_CORK"] = False + tc.cache_variables["LIBIGL_WITH_EMBREE"] = False + tc.cache_variables["LIBIGL_WITH_MATLAB"] = False + tc.cache_variables["LIBIGL_WITH_MOSEK"] = False + tc.cache_variables["LIBIGL_WITH_OPENGL"] = False + tc.cache_variables["LIBIGL_WITH_OPENGL_GLFW"] = False + tc.cache_variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False + tc.cache_variables["LIBIGL_WITH_PNG"] = False + tc.cache_variables["LIBIGL_WITH_TETGEN"] = False + tc.cache_variables["LIBIGL_WITH_TRIANGLE"] = False + tc.cache_variables["LIBIGL_WITH_XML"] = False + tc.cache_variables["LIBIGL_WITH_PYTHON"] = False + tc.cache_variables["LIBIGL_WITH_PREDICATES"] = False tc.generate() - tc = CMakeDeps(self) - tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - libigl_cmake = os.path.join(self.source_folder, "cmake", "libigl.cmake") - replace_in_file(self, libigl_cmake, "-fPIC", "") - replace_in_file(self, libigl_cmake, "INTERFACE_POSITION_INDEPENDENT_CODE ON", "") + if Version(self.version) < "2.4.0": + libigl_cmake = os.path.join(self.source_folder, "cmake", "libigl.cmake") + replace_in_file(self, libigl_cmake, "-fPIC", "") + replace_in_file(self, libigl_cmake, "INTERFACE_POSITION_INDEPENDENT_CODE ON", "") def build(self): self._patch_sources() diff --git a/recipes/libigl/2.x.x/test_package/CMakeLists.txt b/recipes/libigl/all/test_package/CMakeLists.txt similarity index 100% rename from recipes/libigl/2.x.x/test_package/CMakeLists.txt rename to recipes/libigl/all/test_package/CMakeLists.txt diff --git a/recipes/libigl/2.x.x/test_package/conanfile.py b/recipes/libigl/all/test_package/conanfile.py similarity index 100% rename from recipes/libigl/2.x.x/test_package/conanfile.py rename to recipes/libigl/all/test_package/conanfile.py diff --git a/recipes/libigl/2.x.x/test_package/example.cpp b/recipes/libigl/all/test_package/example.cpp similarity index 100% rename from recipes/libigl/2.x.x/test_package/example.cpp rename to recipes/libigl/all/test_package/example.cpp diff --git a/recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libigl/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/libigl/2.x.x/test_v1_package/CMakeLists.txt rename to recipes/libigl/all/test_v1_package/CMakeLists.txt diff --git a/recipes/libigl/2.x.x/test_v1_package/conanfile.py b/recipes/libigl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libigl/2.x.x/test_v1_package/conanfile.py rename to recipes/libigl/all/test_v1_package/conanfile.py diff --git a/recipes/libigl/config.yml b/recipes/libigl/config.yml index 58d1203871eb7..6c846df6a512f 100644 --- a/recipes/libigl/config.yml +++ b/recipes/libigl/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.0": + folder: "all" "2.3.0": - folder: "2.x.x" + folder: "all" From 0eaac892a673f3027d81cbd57099d47f5d31a179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 2 Oct 2023 15:55:48 +0200 Subject: [PATCH 03/19] Manually override package_type when header_only --- recipes/libigl/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index e88abcd52d215..96c67afd1f8c4 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -54,6 +54,8 @@ def config_options(self): def configure(self): if self.options.header_only: self.options.rm_safe("fPIC") + # No automatic detection for non "library" package-types, manually override + self.package_type = "header-library" def layout(self): cmake_layout(self, src_folder="src") From 6a15dd5997b6ee8947123cafba1bc610d78edd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 2 Oct 2023 16:21:23 +0200 Subject: [PATCH 04/19] Fix license of components that we're not packaging --- recipes/libigl/all/conanfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index 96c67afd1f8c4..a463c8ad6511b 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -14,6 +14,8 @@ class LibiglConan(ConanFile): name = "libigl" description = "Simple C++ geometry processing library" + # As per https://libigl.github.io/license/, the library itself is MPL-2, components are not + # No issue as we don't build them, but if done so in the future, please update this field! license = "MPL-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libigl.github.io/" @@ -63,6 +65,9 @@ def layout(self): def requirements(self): # Eigen v3.4+ is not compatible self.requires("eigen/3.3.9", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") def package_id(self): if self.info.options.header_only: @@ -133,7 +138,8 @@ def build(self): def package(self): cmake = CMake(self) cmake.install() - copy(self, "LICENSE.GPL", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + # If components are built and packaged in the future, uncomment this line, their license is different + # copy(self, "LICENSE.GPL", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) copy(self, "LICENSE.MPL2", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) rmdir(self, os.path.join(self.package_folder, "share")) From 6348d90e1f89bffa77575373f33ef91831bfde0d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 4 Nov 2023 16:50:27 +0200 Subject: [PATCH 05/19] libigl: add VirtualBuildEnv, rmdir lib/cmake --- recipes/libigl/all/conanfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index a463c8ad6511b..69f62b875e41f 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -4,6 +4,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, rm, rmdir, replace_in_file from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version @@ -65,7 +66,7 @@ def layout(self): def requirements(self): # Eigen v3.4+ is not compatible self.requires("eigen/3.3.9", transitive_headers=True) - + def build_requirements(self): self.tool_requires("cmake/[>=3.16 <4]") @@ -91,6 +92,9 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) tc.cache_variables["LIBIGL_INSTALL"] = True tc.cache_variables["LIBIGL_EXPORT_TARGETS"] = True @@ -143,6 +147,7 @@ def package(self): copy(self, "LICENSE.MPL2", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) if not self.options.header_only: rm(self, "*.c", self.package_folder, recursive=True) rm(self, "*.cpp", self.package_folder, recursive=True) From cfcb4ab81e6bb36569628e79282e51b76502aba6 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 4 Nov 2023 20:55:40 +0200 Subject: [PATCH 06/19] libigl: backport a patch for C++17 incompatibility --- recipes/libigl/all/conandata.yml | 11 +++++++ recipes/libigl/all/conanfile.py | 4 ++- .../patches/001-replace-random_shuffle.patch | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 recipes/libigl/all/patches/001-replace-random_shuffle.patch diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml index b30e52821d534..2766df4be0182 100644 --- a/recipes/libigl/all/conandata.yml +++ b/recipes/libigl/all/conandata.yml @@ -5,3 +5,14 @@ sources: "2.3.0": url: "https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip" sha256: "5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455" +patches: + "2.4.0": + - patch_file: "patches/001-replace-random_shuffle.patch" + patch_type: "portability" + patch_description: "Replace std::random_shuffle that was removed in C++17" + patch_source: "https://github.com/libigl/libigl/commit/3f3d186db7c2f5ce79194c3439134ca5faf2818a" + "2.3.0": + - patch_file: "patches/001-replace-random_shuffle.patch" + patch_type: "portability" + patch_description: "Replace std::random_shuffle that was removed in C++17" + patch_source: "https://github.com/libigl/libigl/commit/3f3d186db7c2f5ce79194c3439134ca5faf2818a" diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index 69f62b875e41f..a0ec9014e7d6e 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.files import copy, get, rm, rmdir, replace_in_file, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version @@ -48,6 +48,7 @@ def _minimum_compilers_version(self): } def export_sources(self): + export_conandata_patches(self) copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): @@ -128,6 +129,7 @@ def generate(self): deps.generate() def _patch_sources(self): + apply_conandata_patches(self) if Version(self.version) < "2.4.0": libigl_cmake = os.path.join(self.source_folder, "cmake", "libigl.cmake") replace_in_file(self, libigl_cmake, "-fPIC", "") diff --git a/recipes/libigl/all/patches/001-replace-random_shuffle.patch b/recipes/libigl/all/patches/001-replace-random_shuffle.patch new file mode 100644 index 0000000000000..fa53d862ad422 --- /dev/null +++ b/recipes/libigl/all/patches/001-replace-random_shuffle.patch @@ -0,0 +1,31 @@ +From 3f3d186db7c2f5ce79194c3439134ca5faf2818a Mon Sep 17 00:00:00 2001 +From: Jeremie Dumas +Date: Wed, 5 Jan 2022 11:26:47 -0800 +Subject: [PATCH] Fix blue noise random shuffle. + +--- + include/igl/blue_noise.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/igl/blue_noise.cpp b/include/igl/blue_noise.cpp +index ac447feb42..10df1ad1ba 100644 +--- a/include/igl/blue_noise.cpp ++++ b/include/igl/blue_noise.cpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + namespace igl + { +@@ -209,7 +210,8 @@ namespace igl + } + //printf(" --------\n"); + // randomize order: this might be a little paranoid... +- std::random_shuffle(std::begin(N), std::end(N)); ++ std::mt19937 twister; ++ std::shuffle(std::begin(N), std::end(N), twister); + bool found = false; + for(const BlueNoiseKeyType & nk : N) + { From 718cdec3e0483c538e5b4ee0cc3315842e70391f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 4 Nov 2023 20:55:48 +0200 Subject: [PATCH 07/19] libigl: add v2.5.0 --- recipes/libigl/all/conandata.yml | 3 +++ recipes/libigl/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml index 2766df4be0182..23132cddadf2c 100644 --- a/recipes/libigl/all/conandata.yml +++ b/recipes/libigl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.5.0": + url: "https://github.com/libigl/libigl/archive/refs/tags/v2.5.0.zip" + sha256: "84af6a5f9266a4c1ce530f9ef8028c8a3569318563012d72a753622f61ea2f68" "2.4.0": url: "https://github.com/libigl/libigl/archive/refs/tags/v2.4.0.zip" sha256: "b20d80c9a3fa7d0c6bc3adee58e44f0cdb1cbb49228df6d67f9ddbfc08ee1403" diff --git a/recipes/libigl/config.yml b/recipes/libigl/config.yml index 6c846df6a512f..8e8d396222578 100644 --- a/recipes/libigl/config.yml +++ b/recipes/libigl/config.yml @@ -1,4 +1,6 @@ versions: + "2.5.0": + folder: "all" "2.4.0": folder: "all" "2.3.0": From 21d7eb5cdfe6209d955edd1f744c6ccd44687c4e Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 5 Nov 2023 12:28:55 +0200 Subject: [PATCH 08/19] libigl: bump Eigen --- recipes/libigl/all/conanfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index a0ec9014e7d6e..b48da75db7d64 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -65,8 +65,11 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - # Eigen v3.4+ is not compatible - self.requires("eigen/3.3.9", transitive_headers=True) + if Version(self.version) >= "2.5.0": + self.requires("eigen/3.4.0", transitive_headers=True) + else: + # 3.4.0 is not compatible with older versions + self.requires("eigen/3.3.9", transitive_headers=True) def build_requirements(self): self.tool_requires("cmake/[>=3.16 <4]") From 9a5067ad5e7a3bd490bbfdad61cc61664166808a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 14:03:19 +0200 Subject: [PATCH 09/19] libigl: patch not required on 2.4.0 --- recipes/libigl/all/conandata.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml index 23132cddadf2c..5060fb3ccd0aa 100644 --- a/recipes/libigl/all/conandata.yml +++ b/recipes/libigl/all/conandata.yml @@ -9,11 +9,6 @@ sources: url: "https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip" sha256: "5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455" patches: - "2.4.0": - - patch_file: "patches/001-replace-random_shuffle.patch" - patch_type: "portability" - patch_description: "Replace std::random_shuffle that was removed in C++17" - patch_source: "https://github.com/libigl/libigl/commit/3f3d186db7c2f5ce79194c3439134ca5faf2818a" "2.3.0": - patch_file: "patches/001-replace-random_shuffle.patch" patch_type: "portability" From 553c3dcff8cf1aba0ddbdb991c3dd3f18b3e6986 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 14:05:13 +0200 Subject: [PATCH 10/19] libigl: add build OOM workaround --- recipes/libigl/all/conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index b48da75db7d64..3ecfd50c1bb1f 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -142,7 +142,11 @@ def build(self): self._patch_sources() cmake = CMake(self) cmake.configure(build_script_folder=self.source_path.parent) - cmake.build() + try: + cmake.build() + except Exception: + # Workaround for C3I running out of memory during build + cmake.build(cli_args=["-j1"]) def package(self): cmake = CMake(self) From 63dbe32239f2b9d6d263fd94ad04796af218ee3f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 14:05:21 +0200 Subject: [PATCH 11/19] libigl: bump cmake_minimum_required --- recipes/libigl/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libigl/all/CMakeLists.txt b/recipes/libigl/all/CMakeLists.txt index 1fdb7845ab9fc..a7215875f3473 100644 --- a/recipes/libigl/all/CMakeLists.txt +++ b/recipes/libigl/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.15) project(conanlibigl) find_package(Eigen3 REQUIRED) From d8394ea73c97ec6ec7be3360bce6d6d8d50a5856 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 11:51:35 +0200 Subject: [PATCH 12/19] libigl: use loose_lt_semver --- recipes/libigl/all/conanfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index 3ecfd50c1bb1f..ca4ca79b66713 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -79,14 +79,18 @@ def package_id(self): self.info.clear() def validate(self): - if "arm" in self.settings.arch or "x86" is self.settings.arch: + if "arm" in self.settings.arch or self.settings.arch == "x86": raise ConanInvalidConfiguration(f"Not available for arm. Requested arch: {self.settings.arch}") if is_msvc_static_runtime(self) and not self.options.header_only: raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") + + def loose_lt_semver(v1, v2): + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + if self.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if min_version and Version(self.settings.compiler.version) < min_version: + if min_version and loose_lt_semver(self.settings.compiler.version, min_version): raise ConanInvalidConfiguration( f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" f" {self.settings.compiler} {self.settings.compiler.version} does not support it." From d52bdd5e361f1a20d03e7dd9ef0b320d8a997bc1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 11:51:57 +0200 Subject: [PATCH 13/19] libigl: use non-cache variables, use project_include --- recipes/libigl/all/CMakeLists.txt | 6 ---- recipes/libigl/all/conan_deps.cmake | 1 + recipes/libigl/all/conanfile.py | 56 +++++++++++++++-------------- 3 files changed, 30 insertions(+), 33 deletions(-) delete mode 100644 recipes/libigl/all/CMakeLists.txt create mode 100644 recipes/libigl/all/conan_deps.cmake diff --git a/recipes/libigl/all/CMakeLists.txt b/recipes/libigl/all/CMakeLists.txt deleted file mode 100644 index a7215875f3473..0000000000000 --- a/recipes/libigl/all/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(conanlibigl) - -find_package(Eigen3 REQUIRED) - -add_subdirectory(src) diff --git a/recipes/libigl/all/conan_deps.cmake b/recipes/libigl/all/conan_deps.cmake new file mode 100644 index 0000000000000..4c824341569d9 --- /dev/null +++ b/recipes/libigl/all/conan_deps.cmake @@ -0,0 +1 @@ +find_package(Eigen3 REQUIRED) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index ca4ca79b66713..dc6096b8c24a5 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -1,7 +1,7 @@ import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv @@ -49,7 +49,7 @@ def _minimum_compilers_version(self): def export_sources(self): export_conandata_patches(self) - copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -104,32 +104,34 @@ def generate(self): env.generate() tc = CMakeToolchain(self) - tc.cache_variables["LIBIGL_INSTALL"] = True - tc.cache_variables["LIBIGL_EXPORT_TARGETS"] = True - tc.cache_variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only - tc.cache_variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.variables["CMAKE_PROJECT_libigl_INCLUDE"] = "conan_deps.cmake" + tc.variables["LIBIGL_INSTALL"] = True + tc.variables["LIBIGL_EXPORT_TARGETS"] = True + tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only + tc.variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0048"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" # All these dependencies are needed to build the examples or the tests - tc.cache_variables["LIBIGL_BUILD_TUTORIALS"] = False - tc.cache_variables["LIBIGL_BUILD_TESTS"] = False - tc.cache_variables["LIBIGL_BUILD_PYTHON"] = False - - tc.cache_variables["LIBIGL_WITH_CGAL"] = False - tc.cache_variables["LIBIGL_WITH_COMISO"] = False - tc.cache_variables["LIBIGL_WITH_CORK"] = False - tc.cache_variables["LIBIGL_WITH_EMBREE"] = False - tc.cache_variables["LIBIGL_WITH_MATLAB"] = False - tc.cache_variables["LIBIGL_WITH_MOSEK"] = False - tc.cache_variables["LIBIGL_WITH_OPENGL"] = False - tc.cache_variables["LIBIGL_WITH_OPENGL_GLFW"] = False - tc.cache_variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False - tc.cache_variables["LIBIGL_WITH_PNG"] = False - tc.cache_variables["LIBIGL_WITH_TETGEN"] = False - tc.cache_variables["LIBIGL_WITH_TRIANGLE"] = False - tc.cache_variables["LIBIGL_WITH_XML"] = False - tc.cache_variables["LIBIGL_WITH_PYTHON"] = False - tc.cache_variables["LIBIGL_WITH_PREDICATES"] = False + tc.variables["LIBIGL_BUILD_TUTORIALS"] = False + tc.variables["LIBIGL_BUILD_TESTS"] = False + tc.variables["LIBIGL_BUILD_PYTHON"] = False + + tc.variables["LIBIGL_WITH_CGAL"] = False + tc.variables["LIBIGL_WITH_COMISO"] = False + tc.variables["LIBIGL_WITH_CORK"] = False + tc.variables["LIBIGL_WITH_EMBREE"] = False + tc.variables["LIBIGL_WITH_MATLAB"] = False + tc.variables["LIBIGL_WITH_MOSEK"] = False + tc.variables["LIBIGL_WITH_OPENGL"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False + tc.variables["LIBIGL_WITH_PNG"] = False + tc.variables["LIBIGL_WITH_TETGEN"] = False + tc.variables["LIBIGL_WITH_TRIANGLE"] = False + tc.variables["LIBIGL_WITH_XML"] = False + tc.variables["LIBIGL_WITH_PYTHON"] = False + tc.variables["LIBIGL_WITH_PREDICATES"] = False tc.generate() deps = CMakeDeps(self) @@ -145,10 +147,10 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=self.source_path.parent) + cmake.configure() try: cmake.build() - except Exception: + except ConanException: # Workaround for C3I running out of memory during build cmake.build(cli_args=["-j1"]) From 1a3272852ac422481e17c2c5c32dbadc30ae0584 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 11:57:34 +0200 Subject: [PATCH 14/19] libigl: can drop v2.4.0 --- recipes/libigl/all/conandata.yml | 3 --- recipes/libigl/config.yml | 2 -- 2 files changed, 5 deletions(-) diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml index 5060fb3ccd0aa..d6842af62c120 100644 --- a/recipes/libigl/all/conandata.yml +++ b/recipes/libigl/all/conandata.yml @@ -2,9 +2,6 @@ sources: "2.5.0": url: "https://github.com/libigl/libigl/archive/refs/tags/v2.5.0.zip" sha256: "84af6a5f9266a4c1ce530f9ef8028c8a3569318563012d72a753622f61ea2f68" - "2.4.0": - url: "https://github.com/libigl/libigl/archive/refs/tags/v2.4.0.zip" - sha256: "b20d80c9a3fa7d0c6bc3adee58e44f0cdb1cbb49228df6d67f9ddbfc08ee1403" "2.3.0": url: "https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip" sha256: "5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455" diff --git a/recipes/libigl/config.yml b/recipes/libigl/config.yml index 8e8d396222578..7578fb2ee13b0 100644 --- a/recipes/libigl/config.yml +++ b/recipes/libigl/config.yml @@ -1,7 +1,5 @@ versions: "2.5.0": folder: "all" - "2.4.0": - folder: "all" "2.3.0": folder: "all" From a210b0def216b224a6ef23cb09804ba09194a9f8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 12:17:04 +0200 Subject: [PATCH 15/19] libigl: update CMake variables for v2.5.0 --- recipes/libigl/all/conanfile.py | 52 ++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index dc6096b8c24a5..c79214d09c79d 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -105,8 +105,7 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_PROJECT_libigl_INCLUDE"] = "conan_deps.cmake" - tc.variables["LIBIGL_INSTALL"] = True - tc.variables["LIBIGL_EXPORT_TARGETS"] = True + tc.variables[""] = True tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only tc.variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0048"] = "NEW" @@ -117,21 +116,40 @@ def generate(self): tc.variables["LIBIGL_BUILD_TESTS"] = False tc.variables["LIBIGL_BUILD_PYTHON"] = False - tc.variables["LIBIGL_WITH_CGAL"] = False - tc.variables["LIBIGL_WITH_COMISO"] = False - tc.variables["LIBIGL_WITH_CORK"] = False - tc.variables["LIBIGL_WITH_EMBREE"] = False - tc.variables["LIBIGL_WITH_MATLAB"] = False - tc.variables["LIBIGL_WITH_MOSEK"] = False - tc.variables["LIBIGL_WITH_OPENGL"] = False - tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False - tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False - tc.variables["LIBIGL_WITH_PNG"] = False - tc.variables["LIBIGL_WITH_TETGEN"] = False - tc.variables["LIBIGL_WITH_TRIANGLE"] = False - tc.variables["LIBIGL_WITH_XML"] = False - tc.variables["LIBIGL_WITH_PYTHON"] = False - tc.variables["LIBIGL_WITH_PREDICATES"] = False + if Version(self.version) >= "2.4.0": + tc.variables["LIBIGL_EMBREE"] = False + tc.variables["LIBIGL_GLFW"] = False + tc.variables["LIBIGL_IMGUI"] = False + tc.variables["LIBIGL_OPENGL"] = False + tc.variables["LIBIGL_STB"] = False + tc.variables["LIBIGL_PREDICATES"] = False + tc.variables["LIBIGL_SPECTRA"] = False + tc.variables["LIBIGL_XML"] = False + tc.variables["LIBIGL_COPYLEFT_CORE"] = False + tc.variables["LIBIGL_COPYLEFT_CGAL"] = False + tc.variables["LIBIGL_COPYLEFT_COMISO"] = False + tc.variables["LIBIGL_COPYLEFT_TETGEN"] = False + tc.variables["LIBIGL_RESTRICTED_MATLAB"] = False + tc.variables["LIBIGL_RESTRICTED_MOSEK"] = False + tc.variables["LIBIGL_RESTRICTED_TRIANGLE"] = False + tc.variables["LIBIGL_GLFW_TESTS"] = False + else: + tc.variables["LIBIGL_EXPORT_TARGETS"] = True + tc.variables["LIBIGL_WITH_EMBREE"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False + tc.variables["LIBIGL_WITH_OPENGL"] = False + tc.variables["LIBIGL_WITH_PNG"] = False + tc.variables["LIBIGL_WITH_PREDICATES"] = False + tc.variables["LIBIGL_WITH_XML"] = False + tc.variables["LIBIGL_WITH_CGAL"] = False + tc.variables["LIBIGL_WITH_COMISO"] = False + tc.variables["LIBIGL_WITH_CORK"] = False + tc.variables["LIBIGL_WITH_TETGEN"] = False + tc.variables["LIBIGL_WITH_MATLAB"] = False + tc.variables["LIBIGL_WITH_MOSEK"] = False + tc.variables["LIBIGL_WITH_TRIANGLE"] = False + tc.variables["LIBIGL_WITH_PYTHON"] = False tc.generate() deps = CMakeDeps(self) From e2e70b5f55aeef8d703cb45127a41e16e91b0741 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 12:22:57 +0200 Subject: [PATCH 16/19] libigl: fix parallel build not being disabled in v1 --- recipes/libigl/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index c79214d09c79d..feeae49b89219 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -170,7 +170,8 @@ def build(self): cmake.build() except ConanException: # Workaround for C3I running out of memory during build - cmake.build(cli_args=["-j1"]) + self.conf.define("tools.build:jobs", 1) + cmake.build() def package(self): cmake = CMake(self) From 9fef3a2d26b040947dd6745b78824c76828728cc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 18:21:34 +0200 Subject: [PATCH 17/19] libigl: disable Conan v1 debug build --- recipes/libigl/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index feeae49b89219..7814e094f9124 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -1,6 +1,6 @@ import os -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout @@ -84,6 +84,9 @@ def validate(self): if is_msvc_static_runtime(self) and not self.options.header_only: raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") + if self.version == "2.3.0" and conan_version.major == 1 and self.settings.build_type == "Debug": + raise ConanException("Debug build disabled for Conan 1.x due to excessive memory use in ConanCenter CI") + def loose_lt_semver(v1, v2): return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) From 227de22cd4c1b4eea6f80d3ae3a570ad691eb317 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 18 Jan 2024 19:08:33 +0200 Subject: [PATCH 18/19] libigl: fix incorrect exception --- recipes/libigl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index 7814e094f9124..8d1384102ec1c 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -85,7 +85,7 @@ def validate(self): raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") if self.version == "2.3.0" and conan_version.major == 1 and self.settings.build_type == "Debug": - raise ConanException("Debug build disabled for Conan 1.x due to excessive memory use in ConanCenter CI") + raise ConanInvalidConfiguration("Debug build disabled for Conan 1.x due to excessive memory use in ConanCenter CI") def loose_lt_semver(v1, v2): return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) From 5b25d6690a9c0e30e04a70c83c309aae14e941a8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 10 Apr 2024 12:11:37 +0300 Subject: [PATCH 19/19] Update conanfile.py --- recipes/libigl/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py index 8d1384102ec1c..354d3819dc46d 100644 --- a/recipes/libigl/all/conanfile.py +++ b/recipes/libigl/all/conanfile.py @@ -108,7 +108,6 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_PROJECT_libigl_INCLUDE"] = "conan_deps.cmake" - tc.variables[""] = True tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only tc.variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0048"] = "NEW"