summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorThomas Bouvier <contact@thomas-bouvier.io>2023-07-04 13:07:41 +0200
committerGitHub <noreply@github.com>2023-07-04 07:07:41 -0400
commit78e78eb1da803eaa2d78ed337db178d0b28d85a2 (patch)
tree28aaaee065981e435d17c820c360f7400452a207 /var
parent8aeecafd1a84f08637b1f076e3b53fc2d22a48ba (diff)
downloadspack-78e78eb1da803eaa2d78ed337db178d0b28d85a2.tar.gz
spack-78e78eb1da803eaa2d78ed337db178d0b28d85a2.tar.bz2
spack-78e78eb1da803eaa2d78ed337db178d0b28d85a2.tar.xz
spack-78e78eb1da803eaa2d78ed337db178d0b28d85a2.zip
nvtx: add new package (#38430)
Co-authored-by: thomas-bouvier <thomas-bouvier@users.noreply.github.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/nvtx/nvtx-config.patch10
-rw-r--r--var/spack/repos/builtin/packages/nvtx/package.py49
2 files changed, 59 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/nvtx/nvtx-config.patch b/var/spack/repos/builtin/packages/nvtx/nvtx-config.patch
new file mode 100644
index 0000000000..83282e9210
--- /dev/null
+++ b/var/spack/repos/builtin/packages/nvtx/nvtx-config.patch
@@ -0,0 +1,10 @@
+diff --git a/nvtx-config.cmake b/nvtx-config.cmake
+new file mode 100644
+index 0000000000..bcad258624
+--- /dev/null
++++ b/nvtx-config.cmake
+@@ -0,0 +1,4 @@
++include("${CMAKE_CURRENT_LIST_DIR}/nvtxImportedTargets.cmake")
++set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
diff --git a/var/spack/repos/builtin/packages/nvtx/package.py b/var/spack/repos/builtin/packages/nvtx/package.py
new file mode 100644
index 0000000000..b7ca514cf1
--- /dev/null
+++ b/var/spack/repos/builtin/packages/nvtx/package.py
@@ -0,0 +1,49 @@
+# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack.package import *
+
+
+class Nvtx(Package, PythonExtension):
+ """Python code annotation library"""
+
+ git = "https://github.com/NVIDIA/NVTX.git"
+ url = "https://github.com/NVIDIA/NVTX/archive/refs/tags/v3.1.0.tar.gz"
+
+ maintainers("thomas-bouvier")
+
+ version("develop", branch="dev")
+ version("3.1.0", sha256="dc4e4a227d04d3da46ad920dfee5f7599ac8d6b2ee1809c9067110fb1cc71ced")
+
+ variant("python", default=True, description="Install Python bindings.")
+ extends("python", when="+python")
+ depends_on("py-pip", type="build", when="+python")
+ depends_on("py-setuptools", type="build", when="+python")
+ depends_on("py-wheel", type="build", when="+python")
+ depends_on("py-cython", type="build", when="+python")
+
+ build_directory = "python"
+
+ # Create a nvtx-config.cmake file to make calls to find_package(nvtx) to
+ # work as expected
+ patch("nvtx-config.patch")
+
+ def patch(self):
+ """Patch setup.py to provide include directory."""
+ include_dir = prefix.include
+ setup = FileFilter("python/setup.py")
+ setup.filter("include_dirs=include_dirs", f"include_dirs=['{include_dir}']", string=True)
+
+ def install(self, spec, prefix):
+ install_tree("c/include", prefix.include)
+ install("c/CMakeLists.txt", prefix)
+ install("c/nvtxImportedTargets.cmake", prefix)
+ install("./LICENSE.txt", prefix)
+
+ install("./nvtx-config.cmake", prefix) # added by the patch above
+
+ args = std_pip_args + ["--prefix=" + prefix, "."]
+ with working_dir(self.build_directory):
+ pip(*args)