-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fafd26b
commit 000a4f9
Showing
8 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
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 | ||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
class GeogramConan(ConanFile): | ||
name = "geogram" | ||
description = "A programming library with geometric algorithms" | ||
license = "BSD-3-Clause" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/BrunoLevy/geogram" | ||
topics = ("graphics programming", "mesh generation", "geometry processing", "graphics libraries", "mesh processing") | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"with_graphics": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"with_graphics": True, | ||
} | ||
|
||
package_type = "library" | ||
short_paths = True | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
if self.options.with_graphics: | ||
# self.requires("xorg/system") | ||
self.requires("glfw/3.3.8") | ||
# self.requires("imgui/cci.20230105+1.89.2.docking") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
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_WITH_LEGACY_NUMERICS"] = False | ||
|
||
tc.generate() | ||
|
||
tc = CMakeDeps(self) | ||
tc.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
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) | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
# some files extensions and folders are not allowed. Please, read the FAQs to get informed. | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("cmake_file_name", "Geogram") | ||
|
||
if self.options.with_graphics: | ||
self.cpp_info.components["geogram_gfx"].includedirs = ["include/geogram1"] | ||
self.cpp_info.components["geogram_gfx"].libs = ["geogram_gfx"] | ||
self.cpp_info.components["geogram_gfx"].requires = ["geogram", "glfw::glfw"] | ||
self.cpp_info.components["geogram_gfx"].set_property("cmake_target_name", "Geogram::geogram") | ||
|
||
# self.cpp_info.components["geogram_num_3rdparty"].includedirs = ["include/geogram1"] | ||
# self.cpp_info.components["geogram_num_3rdparty"].libs = ["geogram_num_3rdparty"] | ||
# self.cpp_info.components["geogram_num_3rdparty"].set_property("cmake_target_name", "Geogram::geogram_num_3rdparty") | ||
|
||
self.cpp_info.components["geogram"].includedirs = ["include/geogram1"] | ||
self.cpp_info.components["geogram"].libs = ["geogram"] | ||
self.cpp_info.components["geogram"].set_property("cmake_target_name", "Geogram::geogram") | ||
if not self.options.shared: | ||
openmp_flags = [] | ||
if is_msvc(self): | ||
openmp_flags = ["-openmp"] | ||
elif self.settings.compiler in ("gcc", "clang"): | ||
openmp_flags = ["-fopenmp"] | ||
elif self.settings.compiler == "apple-clang": | ||
openmp_flags = ["-Xpreprocessor", "-fopenmp"] | ||
self.cpp_info.components["geogram"].sharedlinkflags = openmp_flags | ||
self.cpp_info.components["geogram"].exelinkflags = openmp_flags | ||
|
||
# If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("m") | ||
self.cpp_info.system_libs.append("pthread") | ||
self.cpp_info.system_libs.append("dl") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
project(test_package CXX) | ||
|
||
find_package(Geogram REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
# don't link to ${CONAN_LIBS} or CONAN_PKG::package | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Geogram::geogram) | ||
# In case the target project need a specific C++ standard | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
# It will become the standard on Conan 2.x | ||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package input.ply") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ply | ||
format ascii 1.0 | ||
comment this is our first comment | ||
element vertex 3 | ||
property float x | ||
property float y | ||
property float z | ||
element face 1 | ||
property list uchar int vertex_indices | ||
comment this is our last comment | ||
end_header | ||
-1 0 0 | ||
000 1 0 | ||
1 0000 0 | ||
3 1 00000 2 | ||
3 1 0 2 |
Oops, something went wrong.