2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, python3, spirv-headers }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "spirv-tools";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "1.3.239.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
src = (assert version == spirv-headers.version;
|
|
|
|
fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Tools";
|
|
|
|
rev = "sdk-${version}";
|
2023-03-04 12:14:45 +00:00
|
|
|
hash = "sha256-xLYykbCHb6OH5wUSgheAfReXhxZtI3RqBJ+PxDZx58s=";
|
2022-09-09 14:08:57 +00:00
|
|
|
}
|
|
|
|
);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DSPIRV-Headers_SOURCE_DIR=${spirv-headers.src}"
|
|
|
|
# Avoid blanket -Werror to evade build failures on less
|
|
|
|
# tested compilers.
|
|
|
|
"-DSPIRV_WERROR=OFF"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# 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@
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The SPIR-V Tools project provides an API and commands for processing SPIR-V modules";
|
2022-12-02 08:20:57 +00:00
|
|
|
homepage = "https://github.com/KhronosGroup/SPIRV-Tools";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2022-02-20 05:27:41 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.ralith ];
|
|
|
|
};
|
|
|
|
}
|