2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2021-05-20 23:08:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, lit
|
2021-12-06 16:07:01 +00:00
|
|
|
, llvm_11
|
2022-05-18 14:49:53 +00:00
|
|
|
, spirv-headers
|
|
|
|
, spirv-tools
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "SPIRV-LLVM-Translator";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "unstable-2022-05-04";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-LLVM-Translator";
|
2022-05-18 14:49:53 +00:00
|
|
|
rev = "99420daab98998a7e36858befac9c5ed109d4920";
|
|
|
|
sha256 = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake llvm_11.dev spirv-tools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
buildInputs = [ spirv-headers llvm_11 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkInputs = [ lit ];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DLLVM_INCLUDE_TESTS=ON"
|
2022-05-18 14:49:53 +00:00
|
|
|
"-DLLVM_DIR=${llvm_11.dev}"
|
|
|
|
"-DBUILD_SHARED_LIBS=YES"
|
|
|
|
"-DLLVM_SPIRV_BUILD_EXTERNAL=YES"
|
2022-08-12 12:06:08 +00:00
|
|
|
# RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# FIXME: CMake tries to run "/llvm-lit" which of course doesn't exist
|
|
|
|
doCheck = false;
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
makeFlags = [ "all" "llvm-spirv" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
install -D tools/llvm-spirv/llvm-spirv $out/bin/llvm-spirv
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator";
|
|
|
|
description = "A tool and a library for bi-directional translation between SPIR-V and LLVM IR";
|
|
|
|
license = licenses.ncsa;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ gloaming ];
|
|
|
|
};
|
|
|
|
}
|