Skip to content

Commit

Permalink
vtk-m: drop Conan v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Valgur committed Feb 10, 2025
1 parent c32f6d1 commit dbed899
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 33 deletions.
38 changes: 7 additions & 31 deletions recipes/vtk-m/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, export_conandata_patches, get, load, replace_in_file, save, rmdir, apply_conandata_patches
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"
required_conan_version = ">=2.0"


class VtkmConan(ConanFile):
Expand Down Expand Up @@ -60,20 +59,6 @@ class VtkmConan(ConanFile):
"with_tbb": True,
}

@property
def _min_cppstd(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "10",
"clang": "7",
"gcc": "7",
"msvc": "191",
"Visual Studio": "15",
}

def export_sources(self):
export_conandata_patches(self)

Expand Down Expand Up @@ -116,13 +101,7 @@ def requirements(self):
# - optionparser

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
check_min_cppstd(self, 14)

if self.options.with_cuda:
raise ConanInvalidConfiguration("CUDA support is not yet implemented")
Expand All @@ -131,6 +110,9 @@ def validate(self):

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "vtkm", "thirdparty", "diy", "vtkmdiy", "cmake", "DIYConfigureMPI.cmake"),
"${MPI_CXX_LIBRARIES}", "MPI::MPI_CXX")

def generate(self):
tc = CMakeToolchain(self)
Expand Down Expand Up @@ -169,13 +151,7 @@ def generate(self):
deps = CMakeDeps(self)
deps.generate()

def _patch_sources(self):
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "vtkm", "thirdparty", "diy", "vtkmdiy", "cmake", "DIYConfigureMPI.cmake"),
"${MPI_CXX_LIBRARIES}", "MPI::MPI_CXX")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down Expand Up @@ -293,8 +269,8 @@ def package_info(self):
component.requires = info.get("requires", [])
component.system_libs = info.get("system_libs", [])

if "vtkm_io" in components and self.options.with_hdf5:
self.cpp_info.components["vtkm_io"].requires.append("hdf5::hdf5_hl")
if "io" in components and self.options.with_hdf5:
self.cpp_info.components["io"].requires.append("hdf5::hdf5_hl")

for component_name, component in self.cpp_info.components.items():
self.output.info(f"COMPONENT: {component_name}")
Expand Down
3 changes: 1 addition & 2 deletions recipes/vtk-m/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
generators = "CMakeDeps", "CMakeToolchain"

def layout(self):
cmake_layout(self)
Expand Down

0 comments on commit dbed899

Please sign in to comment.