aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix b/nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix
new file mode 100644
index 00000000000..22fbc0e998a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rocm-comgr/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, cmake, clang, device-libs, lld, llvm }:
+
+stdenv.mkDerivation rec {
+ pname = "rocm-comgr";
+ version = "3.7.0";
+
+ src = fetchFromGitHub {
+ owner = "RadeonOpenCompute";
+ repo = "ROCm-CompilerSupport";
+ rev = "rocm-${version}";
+ sha256 = "1r7arfdqfh6pfvjza6x2dzd5gjmkndngrp688d3n2ab92n5ijiqf";
+ };
+
+ sourceRoot = "source/lib/comgr";
+
+ nativeBuildInputs = [ cmake ];
+
+ buildInputs = [ clang device-libs lld llvm ];
+
+ cmakeFlags = [
+ "-DCLANG=${clang}/bin/clang"
+ "-DCMAKE_BUILD_TYPE=Release"
+ "-DCMAKE_C_COMPILER=${clang}/bin/clang"
+ "-DCMAKE_CXX_COMPILER=${clang}/bin/clang++"
+ "-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm"
+ "-DLLD_INCLUDE_DIRS=${lld.src}/include"
+ "-DLLVM_TARGETS_TO_BUILD=\"AMDGPU;X86\""
+ ];
+
+ # The comgr build tends to link against the static LLVM libraries
+ # *and* the dynamic library. Linking against both causes errors
+ # about command line options being registered twice. This patch
+ # removes the static library linking.
+ patchPhase = ''
+ sed -e '/^llvm_map_components_to_libnames/,/[[:space:]]*Symbolize)/d' \
+ -i CMakeLists.txt
+ '';
+
+ meta = with stdenv.lib; {
+ description = "APIs for compiling and inspecting AMDGPU code objects";
+ homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr";
+ license = licenses.ncsa;
+ maintainers = with maintainers; [ danieldk ];
+ platforms = platforms.linux;
+ };
+}