-
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
(#10727) Add recipe for cuda-api-wrappers/0.5.1 #10728
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"0.5.1": | ||
url: "https://github.com/eyalroz/cuda-api-wrappers/archive/refs/tags/v0.5.1.tar.gz" | ||
sha256: "3a6d49f3da411c3da825b3781115c09e3420b49d53e83a3982cf4e222e223e4e" |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||||||||||||||
from conans import ConanFile, tools | ||||||||||||||||||
from conans.errors import ConanInvalidConfiguration | ||||||||||||||||||
import os | ||||||||||||||||||
|
||||||||||||||||||
required_conan_version = ">=1.33.0" | ||||||||||||||||||
|
||||||||||||||||||
class CudaKatConan(ConanFile): | ||||||||||||||||||
name = "cuda-api-wrappers" | ||||||||||||||||||
homepage = "https://github.com/eyalroz/cuda-api-wrappers" | ||||||||||||||||||
description = "Thin C++-flavored wrappers for the CUDA APIs" | ||||||||||||||||||
topics = ("gpgpu", "cuda", "cuda-api", "header-only") | ||||||||||||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||||||||||||
no_copy_source = True | ||||||||||||||||||
license = "BSD-3-Clause" | ||||||||||||||||||
|
||||||||||||||||||
settings = "os", "arch", "compiler", "build_type" | ||||||||||||||||||
|
||||||||||||||||||
@property | ||||||||||||||||||
def _source_subfolder(self): | ||||||||||||||||||
return "source_subfolder" | ||||||||||||||||||
|
||||||||||||||||||
def package_id(self): | ||||||||||||||||||
self.info.header_only() | ||||||||||||||||||
|
||||||||||||||||||
def source(self): | ||||||||||||||||||
tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) | ||||||||||||||||||
|
||||||||||||||||||
def package(self): | ||||||||||||||||||
self.copy(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") | ||||||||||||||||||
self.copy("*", src=os.path.join(self._source_subfolder, "src"), dst="include") | ||||||||||||||||||
|
||||||||||||||||||
def package_info(self): | ||||||||||||||||||
self.cpp_info.names["cmake_find_package"] = "cuda-api-wrappers" | ||||||||||||||||||
self.cpp_info.names["cmake_find_package_multi"] = "cuda-api-wrappers" | ||||||||||||||||||
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Better compatibility with Conan 2.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Target name is wrong, there should be 3 imported targets There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SpaceIm Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused, how to declare 3 imported targets? def package_info(self):
self.cpp_info.names["cmake_find_package"] = "cuda-api-wrappres"
self.cpp_info.names["cmake_find_package_multi"] = "cuda-api-wrappers"
self.cpp_info.components["runtime-and-driver"].names["cmake_find_package"] = "runtime-and-driver"
self.cpp_info.components["runtime-and-driver"].system_libs = ["libcudart", "libcuda"]
self.cpp_info.components["nvrtc"].names["cmake_find_package"] = "nvrtc"
self.cpp_info.components["nvrtc"].system_libs = ["libnvrtc", "libcudart", "libcuda"]
self.cpp_info.components["nvtx"].names["cmake_find_package"] = "nvtx"
self.cpp_info.components["nvtx"].requires = ["runtime-and-driver"]
self.cpp_info.components["nvtx"].system_libs = ["libnvToolsExt", "libthreads",
"libcudart", "libcuda"] Can you provide any example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, with Conan the only way to provide several targets is to create several components |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(cuda-api-wrappers REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} cuda-api-wrappers::cuda-api-wrappers) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
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): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <iostream> | ||
#include <cuda/undefine_specifiers.hpp> | ||
|
||
|
||
int main() { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try consuming something from header. You could generate a version, for instance: https://github.com/eyalroz/cuda-api-wrappers/blob/master/src/cuda/api/versions.hpp#L115 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not possible, there is a dependency to CUDA. This recipe shouldn't be merged until we have some There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this recipe requires |
||
return 0; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"0.5.1": | ||
folder: all |
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.
Checks from the linter will be mandatory in the near future, so better to start fixing them. Thanks!