depot/third_party/nixpkgs/pkgs/development/tools/spirv-tools/default.nix
Default email 01ed8ef136 Project import generated by Copybara.
GitOrigin-RevId: 20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8
2022-11-21 19:40:18 +02:00

47 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, python3, spirv-headers }:
stdenv.mkDerivation rec {
pname = "spirv-tools";
version = "1.3.231.0";
src = (assert version == spirv-headers.version;
fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
rev = "sdk-${version}";
hash = "sha256-sqjQoz9v9alSPc0ujEcWZxDAWh2S6oAPP1+JZmNCpA0=";
}
);
nativeBuildInputs = [ cmake python3 ];
cmakeFlags = [
"-DSPIRV-Headers_SOURCE_DIR=${spirv-headers.src}"
# Avoid blanket -Werror to evade build failures on less
# tested compilers.
"-DSPIRV_WERROR=OFF"
];
# https://github.com/KhronosGroup/SPIRV-Tools/issues/3905
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace '-P ''${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake' \
'-DCMAKE_INSTALL_FULL_LIBDIR=''${CMAKE_INSTALL_FULL_LIBDIR}
-DCMAKE_INSTALL_FULL_INCLUDEDIR=''${CMAKE_INSTALL_FULL_INCLUDEDIR}
-P ''${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake'
substituteInPlace cmake/SPIRV-Tools.pc.in \
--replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
substituteInPlace cmake/SPIRV-Tools-shared.pc.in \
--replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
'';
meta = with lib; {
inherit (src.meta) homepage;
description = "The SPIR-V Tools project provides an API and commands for processing SPIR-V modules";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = [ maintainers.ralith ];
};
}