2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, python3, git }:
|
2020-11-20 08:24:40 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "directx-shader-compiler";
|
2021-10-13 16:36:45 +01:00
|
|
|
version = "1.6.2106";
|
2020-11-20 08:24:40 +00:00
|
|
|
|
|
|
|
# Put headers in dev, there are lot of them which aren't necessary for
|
|
|
|
# using the compiler binary.
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "microsoft";
|
|
|
|
repo = "DirectXShaderCompiler";
|
|
|
|
rev = "v${version}";
|
2021-10-13 16:36:45 +01:00
|
|
|
sha256 = "6kQgAESYiQ06LkiGTfDBYwd/ORLSm1W+BcO+OUp4yXY=";
|
2020-11-20 08:24:40 +00:00
|
|
|
# We rely on the side effect of leaving the .git directory here for the
|
|
|
|
# version-grabbing functionality of the build system.
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake git python3 ];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
# Requires some additional flags to cmake from a file in the repo
|
|
|
|
additionalCMakeFlags=$(< utils/cmake-predefined-config-params)
|
|
|
|
cmakeFlags="$additionalCMakeFlags''${cmakeFlags:+ $cmakeFlags}"
|
|
|
|
cmakeConfigurePhase
|
|
|
|
'';
|
|
|
|
|
|
|
|
# The default install target installs heaps of LLVM stuff.
|
|
|
|
#
|
|
|
|
# Upstream issue: https://github.com/microsoft/DirectXShaderCompiler/issues/3276
|
|
|
|
#
|
|
|
|
# The following is based on the CI script:
|
|
|
|
# https://github.com/microsoft/DirectXShaderCompiler/blob/master/appveyor.yml#L63-L66
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/lib $dev/include
|
|
|
|
mv bin/dxc* $out/bin/
|
2020-11-20 08:24:40 +00:00
|
|
|
mv lib/libdxcompiler.so* lib/libdxcompiler.*dylib $out/lib/
|
2020-11-20 08:24:40 +00:00
|
|
|
cp -r $src/include/dxc $dev/include/
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-11-20 08:24:40 +00:00
|
|
|
description = "A compiler to compile HLSL programs into DXIL and SPIR-V";
|
|
|
|
homepage = "https://github.com/microsoft/DirectXShaderCompiler";
|
2020-11-20 08:24:40 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2020-11-20 08:24:40 +00:00
|
|
|
license = licenses.ncsa;
|
|
|
|
maintainers = with maintainers; [ expipiplus1 ];
|
|
|
|
};
|
|
|
|
}
|