-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add catalyst library #22415
Open
jjcasmar
wants to merge
1
commit into
conan-io:master
Choose a base branch
from
jjcasmar:catalyst
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add catalyst library #22415
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,101 @@ | ||
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") | ||
|
||
|
||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("dl") | ||
|
||
if self.settings.os == "Windows" and self.settings.build_type == "Debug": | ||
self.cpp_info.libs = [f"catalystd"] | ||
else: | ||
self.cpp_info.libs = ["catalyst"] | ||
|
||
|
||
# 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" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a system_libs dependency instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work in Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Windows does not require linking against an additional library for loading of dynamic libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jjcasmar please take a look at the comment above. I think it is the only thing missing in this PR