Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkgs/development/compilers/spirv-llvm-translator/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ stdenv.mkDerivation rec {
# FIXME: CMake tries to run "/llvm-lit" which of course doesn't exist
doCheck = false;

makeFlags = [ "all" "llvm-spirv" ];

postInstall = ''
install -D tools/llvm-spirv/llvm-spirv $out/bin/llvm-spirv
'';

meta = with lib; {
homepage = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator";
description = "A tool and a library for bi-directional translation between SPIR-V and LLVM IR";
Expand Down
12 changes: 7 additions & 5 deletions pkgs/development/libraries/libclc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, ninja, cmake, python3, llvmPackages }:
{ lib, stdenv, fetchFromGitHub, ninja, cmake, python3, llvmPackages, spirv-llvm-translator }:

let
llvm = llvmPackages.llvm;
Expand All @@ -7,24 +7,26 @@ in

stdenv.mkDerivation rec {
pname = "libclc";
version = "11.0.1";
version = "12.0.1";

src = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = "llvmorg-${version}";
sha256 = "0bxh43hp1vl4axl3s9n2nb2ii8x1cbq98xz9c996f8rl5jy84ags";
sha256 = "08s5w2db9imb2yaqsvxs6pg21csi1cf6wa35rf8x6q07mam7j8qv";
};
sourceRoot = "source/libclc";

# cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
'find_program( LLVM_CLANG clang PATHS "${clang-unwrapped}/bin" NO_DEFAULT_PATH )'
'find_program( LLVM_CLANG clang PATHS "${clang-unwrapped}/bin" NO_DEFAULT_PATH )' \
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_BINDIR} NO_DEFAULT_PATH )' \
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv-llvm-translator}/bin" NO_DEFAULT_PATH )'
'';

nativeBuildInputs = [ cmake ninja python3 ];
nativeBuildInputs = [ cmake ninja python3 spirv-llvm-translator ];
buildInputs = [ llvm clang-unwrapped ];
strictDeps = true;
cmakeFlags = [
Expand Down