spirv-llvm-translator: version depends on llvm version
This commit is contained in:
parent
c96a0248ca
commit
ea2ca5e639
1 changed files with 16 additions and 7 deletions
|
@ -3,31 +3,40 @@
|
||||||
, cmake
|
, cmake
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, lit
|
, lit
|
||||||
, llvm_11
|
, llvm
|
||||||
, spirv-headers
|
, spirv-headers
|
||||||
, spirv-tools
|
, spirv-tools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
llvmMajor = lib.versions.major llvm.version;
|
||||||
|
|
||||||
|
branch =
|
||||||
|
if llvmMajor == "11" then {
|
||||||
|
version = "unstable-2022-05-04";
|
||||||
|
rev = "99420daab98998a7e36858befac9c5ed109d4920"; # 265 commits ahead of v11.0.0
|
||||||
|
hash = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg=";
|
||||||
|
} else throw "Incompatible LLVM version.";
|
||||||
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "SPIRV-LLVM-Translator";
|
pname = "SPIRV-LLVM-Translator";
|
||||||
version = "unstable-2022-05-04";
|
inherit (branch) version;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "KhronosGroup";
|
owner = "KhronosGroup";
|
||||||
repo = "SPIRV-LLVM-Translator";
|
repo = "SPIRV-LLVM-Translator";
|
||||||
rev = "99420daab98998a7e36858befac9c5ed109d4920";
|
inherit (branch) rev hash;
|
||||||
sha256 = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg=";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config cmake llvm_11.dev spirv-tools ];
|
nativeBuildInputs = [ pkg-config cmake llvm.dev spirv-tools ];
|
||||||
|
|
||||||
buildInputs = [ spirv-headers llvm_11 ];
|
buildInputs = [ spirv-headers llvm ];
|
||||||
|
|
||||||
checkInputs = [ lit ];
|
checkInputs = [ lit ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DLLVM_INCLUDE_TESTS=ON"
|
"-DLLVM_INCLUDE_TESTS=ON"
|
||||||
"-DLLVM_DIR=${llvm_11.dev}"
|
"-DLLVM_DIR=${llvm.dev}"
|
||||||
"-DBUILD_SHARED_LIBS=YES"
|
"-DBUILD_SHARED_LIBS=YES"
|
||||||
"-DLLVM_SPIRV_BUILD_EXTERNAL=YES"
|
"-DLLVM_SPIRV_BUILD_EXTERNAL=YES"
|
||||||
# RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/
|
# RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/
|
||||||
|
|
Loading…
Reference in a new issue