mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
76 lines
2.0 KiB
Nix
76 lines
2.0 KiB
Nix
{ lib, stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, pkg-config
|
|
|
|
, bison
|
|
, flex
|
|
, llvmPackages_8
|
|
, opencl-clang
|
|
, python3
|
|
, spirv-llvm-translator
|
|
|
|
, buildWithPatches ? true
|
|
}:
|
|
|
|
let
|
|
llvmPkgs = llvmPackages_8 // {
|
|
inherit spirv-llvm-translator;
|
|
};
|
|
inherit (llvmPkgs) llvm;
|
|
inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang clang-unwrapped spirv-llvm-translator;
|
|
inherit (lib) getVersion optional optionals versionOlder versions;
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "intel-graphics-compiler";
|
|
version = "1.0.4241";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "intel";
|
|
repo = "intel-graphics-compiler";
|
|
rev = "igc-${version}";
|
|
sha256 = "1jp3c67ppl1x4pazr5nzy52615cpx0kyckaridhc0fsmrkgilyxq";
|
|
};
|
|
|
|
nativeBuildInputs = [ clang cmake bison flex python3 ];
|
|
|
|
buildInputs = [ clang opencl-clang spirv-llvm-translator llvm ];
|
|
|
|
strictDeps = true;
|
|
|
|
# checkInputs = [ lit pythonPackages.nose ];
|
|
|
|
# FIXME: How do we run the test suite?
|
|
# https://github.com/intel/intel-graphics-compiler/issues/98
|
|
doCheck = false;
|
|
|
|
# Handholding the braindead build script
|
|
# We put this in a derivation because the cmake requires an absolute path
|
|
prebuilds = stdenv.mkDerivation {
|
|
name = "igc-cclang-prebuilds";
|
|
phases = [ "installPhase" ];
|
|
installPhase = ''
|
|
mkdir $out
|
|
ln -s ${clang}/bin/clang $out/
|
|
ln -s clang $out/clang-${versions.major (getVersion clang)}
|
|
ln -s ${opencl-clang}/lib/* $out/
|
|
ln -s ${clang-unwrapped}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
|
|
'';
|
|
};
|
|
|
|
cmakeFlags = [
|
|
"-DCCLANG_BUILD_PREBUILDS=ON"
|
|
"-DCCLANG_BUILD_PREBUILDS_DIR=${prebuilds}"
|
|
"-DIGC_PREFERRED_LLVM_VERSION=${getVersion llvm}"
|
|
];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/intel/intel-graphics-compiler";
|
|
description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware";
|
|
license = licenses.mit;
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ gloaming ];
|
|
};
|
|
}
|