Skip to content

Commit

Permalink
(#10665) vcglib: add 2022.02 + modernize
Browse files Browse the repository at this point in the history
* modernize

* bump eigen

* add vcglib/2022.02
  • Loading branch information
SpaceIm authored May 9, 2022
1 parent a6bc459 commit 7cac22f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion recipes/vcglib/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8)
project(vcglib)

include(conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(KEEP_RPATHS)

set(VCGLIB_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder)

Expand Down
6 changes: 6 additions & 0 deletions recipes/vcglib/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
sources:
"2022.02":
url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2022.02.tar.gz"
sha256: "724f5ef6ab9b9d21ff2e9e965c2ce909cc024b29f2aa7d39e2974b28ff25bc3f"
"2020.12":
url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2020.12.tar.gz"
sha256: "731c57435e39c4b958a1d766cadd9865d9db35e36410708f2da7818e9fa5f786"
patches:
"2022.02":
- patch_file: "patches/0001-use-external-eigen.patch"
base_path: "source_subfolder"
"2020.12":
- patch_file: "patches/0001-use-external-eigen.patch"
base_path: "source_subfolder"
21 changes: 12 additions & 9 deletions recipes/vcglib/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conans import ConanFile, CMake, tools
import functools

required_conan_version = ">=1.33.0"

Expand All @@ -7,7 +8,7 @@ class VcglibConan(ConanFile):
name = "vcglib"
description = "Library for manipulation, processing, cleaning, simplifying triangle meshes."
license = "GPL-3.0-only"
topics = ("conan", "vcglib", "mesh-processing")
topics = ("vcglib", "mesh-processing")
homepage = "https://github.com/cnr-isti-vclab/vcglib"
url = "https://github.com/conan-io/conan-center-index"

Expand All @@ -21,14 +22,17 @@ class VcglibConan(ConanFile):
"fPIC": True,
}

exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake", "cmake_find_package_multi"
_cmake = None

@property
def _source_subfolder(self):
return "source_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"])

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -38,7 +42,7 @@ def configure(self):
del self.options.fPIC

def requirements(self):
self.requires("eigen/3.3.9")
self.requires("eigen/3.4.0")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
Expand All @@ -48,12 +52,11 @@ def source(self):
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

@functools.lru_cache(1)
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.configure()
return self._cmake
cmake = CMake(self)
cmake.configure()
return cmake

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
Expand Down
6 changes: 4 additions & 2 deletions recipes/vcglib/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(vcglib REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
target_link_libraries(${PROJECT_NAME} vcglib::vcglib)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
4 changes: 2 additions & 2 deletions recipes/vcglib/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake"
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):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
obj_path = os.path.join(self.source_folder, "cube.obj")
self.run("{} {}".format(bin_path, obj_path), run_environment=True)
2 changes: 2 additions & 0 deletions recipes/vcglib/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"2022.02":
folder: all
"2020.12":
folder: all

0 comments on commit 7cac22f

Please sign in to comment.