depot/third_party/nixpkgs/pkgs/development/libraries/libclc/default.nix
Default email 2ce5db779a Project import generated by Copybara.
GitOrigin-RevId: 48037fd90426e44e4bf03e6479e88a11453b9b66
2022-05-18 16:49:53 +02:00

42 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, ninja, cmake, python3, llvmPackages, spirv-llvm-translator }:
let
llvm = llvmPackages.llvm;
clang-unwrapped = llvmPackages.clang-unwrapped;
in
stdenv.mkDerivation rec {
pname = "libclc";
version = "12.0.1";
src = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = "llvmorg-${version}";
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 )' \
--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 spirv-llvm-translator ];
buildInputs = [ llvm clang-unwrapped ];
strictDeps = true;
cmakeFlags = [
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
meta = with lib; {
homepage = "http://libclc.llvm.org/";
description = "Implementation of the library requirements of the OpenCL C programming language";
license = licenses.mit;
platforms = platforms.all;
};
}