2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, clang, device-libs, lld, llvm }:
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rocm-comgr";
|
2020-12-25 13:55:36 +00:00
|
|
|
version = "4.0.0";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "ROCm-CompilerSupport";
|
|
|
|
rev = "rocm-${version}";
|
2020-12-03 08:41:04 +00:00
|
|
|
hash = "sha256-JMzXg1Hw0iWcTnKu/NgW7rD8iagp724F01GaJbrJj9M=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|