diff --git a/recipes/geogram/all/conandata.yml b/recipes/geogram/all/conandata.yml index 7b711e00ba237b..fbdf31a1bb81ab 100644 --- a/recipes/geogram/all/conandata.yml +++ b/recipes/geogram/all/conandata.yml @@ -1,19 +1,5 @@ sources: "1.9.0": url: - - "https://github.com/BrunoLevy/geogram/releases/download/v1.9.0/geogram_1.9.0.tar.gz" - sha256: "09c0e28ffc08fdab1f2214ee32e49610d64972d052e890d3cc6dcb6bd25b5fc0" - "1.8.8": - url: - - "https://github.com/BrunoLevy/geogram/releases/download/v1.8.8/geogram_1.8.8.tar.gz" - sha256: "698bc9ad9d58139fe9fdf3eab0596f5b418c4edd593eee960de98c0ab646d47e" -patches: - "1.1.0": - - patch_file: "patches/0001-fix-cmake.patch" - patch_description: "correct the order of cmake min and project" - patch_type: "backport" - patch_source: "https://github.com/owner/package/pulls/42" - - patch_file: "patches/0002-fix-linux.patch" - patch_description: "add missing header to support linux" - patch_type: "portability" - patch_source: "https://github.com/owner/package/issues/0" + - "https://github.com/BrunoLevy/geogram/archive/refs/tags/v1.9.0.tar.gz" + sha256: "22baa50539a56f0f88ce84adfc8bea50a379caf7120f03d3df834c4bd607a1d0" diff --git a/recipes/geogram/all/conanfile.py b/recipes/geogram/all/conanfile.py index 2d52bf8d206a7e..3e35f055a77547 100644 --- a/recipes/geogram/all/conanfile.py +++ b/recipes/geogram/all/conanfile.py @@ -1,8 +1,7 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir -from conan.tools.microsoft import check_min_vs, is_msvc -from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc import os required_conan_version = ">=1.53.0" @@ -23,7 +22,7 @@ class GeogramConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "with_graphics": True, + "with_graphics": False, } package_type = "library" @@ -44,10 +43,15 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libmeshb/7.80") + self.requires("rply/1.1.4") + self.requires("amgcl/1.4.4") + if self.options.with_graphics: - # self.requires("xorg/system") + self.requires("xorg/system") self.requires("glfw/3.3.8") - # self.requires("imgui/cci.20230105+1.89.2.docking") + self.requires("imgui/1.91.0") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -56,24 +60,61 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["VORPALINE_BUILD_DYNAMIC"] = self.options.shared tc.variables["GEOGRAM_WITH_GRAPHICS"] = self.options.with_graphics - tc.variables["GEOGRAM_LIB_ONLY"] = False - # To use glfw from conan cache - tc.variables["GEOGRAM_USE_SYSTEM_GLFW3"] = True - # tc.variables["GEOGRAM_SUB_BUILD"] = True + tc.variables["GEOGRAM_LIB_ONLY"] = True tc.variables["GEOGRAM_WITH_LEGACY_NUMERICS"] = False - + tc.variables["GEOGRAM_WITH_HLBFGS"] = False + tc.variables["GEOGRAM_WITH_TETGEN"] = False + tc.variables["GEOGRAM_WITH_TRIANGLE"] = False + tc.variables["GEOGRAM_WITH_LUA"] = False + tc.variables["GEOGRAM_WITH_FPG"] = False + # To use glfw from conan dependencies + tc.variables["GEOGRAM_USE_SYSTEM_GLFW3"] = True + tc.variables["GEOGRAM_WITH_GARGANTUA"] = False + tc.variables["GEOGRAM_WITH_TBB"] = False tc.generate() - + tc = CMakeDeps(self) tc.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + # Remove gitmodules dependencies + rmdir(self, os.path.join(self.source_folder, "src/lib/geogram/third_party/amgcl")) + rmdir(self, os.path.join(self.source_folder, "src/lib/third_party/glfw")) + rmdir(self, os.path.join(self.source_folder, "src/lib/geogram_gfx/third_party/imgui")) + # rmdir(self, os.path.join(self.source_folder, "src/lib/geogram/third_party/libMeshb")) + rmdir(self, os.path.join(self.source_folder, "src/lib/geogram/third_party/rply")) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(src/lib/third_party)", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(doc)", "") + replace_in_file(self, os.path.join(self.source_folder, "src", "lib", "geogram", "CMakeLists.txt"), "add_subdirectory(third_party)", + """ + add_subdirectory(third_party) + + find_package(libMeshb REQUIRED CONFIG) + find_package(rply REQUIRED CONFIG) + find_package(amgcl REQUIRED CONFIG) + """) + replace_in_file(self, os.path.join(self.source_folder, "src", "lib", "geogram", "CMakeLists.txt"), "add_library(geogram ${SOURCES} $)", + """ + add_library(geogram ${SOURCES} $) + + target_link_libraries(geogram libMeshb::Meshb.7) + target_link_libraries(geogram rply::rply) + target_link_libraries(geogram amgcl::amgcl) + """) + + # Rework cpp includes to works with libmeshb conan dependency + replace_in_file(self, os.path.join(self.source_folder, "src/lib/geogram/mesh/mesh_io.cpp"), "#include ", "#include ") + replace_in_file(self, os.path.join(self.source_folder, "src/lib/geogram/mesh/mesh_io.cpp"), "#include ", "#include ") + + def build(self): + self._patch_sources() + cmake = CMake(self) cmake.configure() - cmake.verbose = True - cmake.build(cli_args=["--verbose"], build_tool_args=["-j 10"]) - # cmake.build() + # cmake.verbose = True + # cmake.build(cli_args=["--verbose"], build_tool_args=["-j 10"]) + cmake.build() def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) diff --git a/recipes/geogram/config.yml b/recipes/geogram/config.yml index 3e4788dc1aa3ff..81634fc799e565 100644 --- a/recipes/geogram/config.yml +++ b/recipes/geogram/config.yml @@ -1,5 +1,3 @@ versions: "1.9.0": folder: all - "1.8.8": - folder: all