spirv-llvm-translator: allow rocm versioning
This commit is contained in:
parent
7f864b4a32
commit
8be466f744
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
llvmMajor = lib.versions.major llvm.version;
|
llvmMajor = lib.versions.major llvm.version;
|
||||||
|
isROCm = lib.hasPrefix "rocm" llvm.pname;
|
||||||
|
|
||||||
|
# ROCm will always be at the latest version
|
||||||
branch =
|
branch =
|
||||||
if llvmMajor == "15" then rec {
|
if llvmMajor == "15" || isROCm then rec {
|
||||||
version = "15.0.0";
|
version = "15.0.0";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-111yL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg=";
|
hash = "sha256-OsDohXRxovtEXaWiRGp8gJ0dXmoALyO+ZimeSO8aPVI=";
|
||||||
} else if llvmMajor == "14" then rec{
|
} else if llvmMajor == "14" then rec{
|
||||||
version = "14.0.0";
|
version = "14.0.0";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
|
@ -36,15 +38,17 @@ stdenv.mkDerivation {
|
||||||
inherit (branch) rev hash;
|
inherit (branch) rev hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config cmake llvm.dev spirv-tools ];
|
nativeBuildInputs = [ pkg-config cmake spirv-tools ]
|
||||||
|
++ (if isROCm then [ llvm ] else [ llvm.dev ]);
|
||||||
|
|
||||||
buildInputs = [ spirv-headers llvm ];
|
buildInputs = [ spirv-headers ]
|
||||||
|
++ lib.optionals (!isROCm) [ llvm ];
|
||||||
|
|
||||||
checkInputs = [ lit ];
|
checkInputs = [ lit ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DLLVM_INCLUDE_TESTS=ON"
|
"-DLLVM_INCLUDE_TESTS=ON"
|
||||||
"-DLLVM_DIR=${llvm.dev}"
|
"-DLLVM_DIR=${(if isROCm then llvm else 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