-
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
Showing
8 changed files
with
180 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,4 @@ | ||
sources: | ||
"2.0.0-rc4": | ||
url: "https://gitlab.kitware.com/api/v4/projects/5912/packages/generic/catalyst/v2.0.0-rc4/catalyst-v2.0.0-rc4.tar.gz" | ||
sha256: "cb491e4ccd344156cc2494f65b9f38885598c16d12e1016c36e2ee0bc3640863" |
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,96 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanException | ||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout | ||
from conan.tools.files import get, copy, rmdir | ||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class CatalystConan(ConanFile): | ||
name = "catalyst" | ||
package_type = "library" | ||
description = "Catalyst is an API specification developed for simulations (and other scientific data producers) to analyze and visualize data in situ." | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://gitlab.kitware.com/paraview/catalyst" | ||
topics = ("simulation", "visualization", "paraview", "in-situ", "in-transit") | ||
license = "BSD-3" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"use_mpi": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"use_mpi": False, | ||
} | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/[>3.26]") | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def configure(self): | ||
if self.options.get_safe("shared"): | ||
self.options.rm_safe("fPIC") | ||
|
||
def validate(self): | ||
# OpenMPI is not yet conan 2.0 compatible, so raise an exception in case its used | ||
if self.options.use_mpi: | ||
raise ConanException("MPI is not yet supported by the Catalyst recipe") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["CATALYST_BUILD_REPLAY"] = False | ||
tc.variables["CATALYST_BUILD_TESTING"] = False | ||
tc.variables["CATALYST_BUILD_SHARED_LIBS"] = self.options.shared | ||
tc.variables["CATALYST_USE_MPI"] = False | ||
tc.variables["CATALYST_BUILD_TOOLS"] = False | ||
|
||
# Catalyst adds by default catalyst_${VERSION} as suffix for static libs. Remove that | ||
if not self.options.get_safe("shared"): | ||
tc.variables["CATALYST_CUSTOM_LIBRARY_SUFFIX"] = "" | ||
|
||
tc.generate() | ||
|
||
cmake_deps = CMakeDeps(self) | ||
cmake_deps.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "License.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.install() | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "catalyst", "cmake")) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("cmake_file_name", "catalyst") | ||
self.cpp_info.set_property("cmake_target_name", "catalyst::catalyst") | ||
self.cpp_info.set_property("pkg_config_name", "catalyst") | ||
|
||
self.cpp_info.libs = [f"catalyst"] | ||
|
||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("dl") | ||
|
||
# Includes are installed under catalyst-2.0, but official documentation says we should use -I<install_dir>/include/catalyst-2.0 | ||
self.cpp_info.includedirs = ["include/catalyst-2.0"] | ||
|
||
self.cpp_info.names["cmake_find_package"] = "catalyst" | ||
self.cpp_info.names["cmake_find_package_multi"] = "catalyst" |
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,9 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(catalyst REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC catalyst::catalyst ${CMAKE_DL_LIBS}) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) | ||
|
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,31 @@ | ||
import os | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, CMakeToolchain | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.generate() | ||
|
||
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.bindirs[0], "test_package") | ||
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,11 @@ | ||
#include <cstdlib> | ||
#include <catalyst.hpp> | ||
#include <conduit.h> | ||
|
||
int main(void) { | ||
conduit_cpp::Node node; | ||
const auto init{catalyst_initialize(conduit_cpp::c_node(&node))}; | ||
const auto exec{catalyst_execute(conduit_cpp::c_node(&node))}; | ||
const auto finalize{catalyst_finalize(conduit_cpp::c_node(&node))}; | ||
return EXIT_SUCCESS; | ||
} |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
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) |
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,18 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
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): | ||
tools.mkdir("logs/") | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
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,3 @@ | ||
versions: | ||
"2.0.0-rc4": | ||
folder: "all" |