2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, python3, spirv-headers }:
|
2016-08-31 12:19:14 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "spirv-tools";
|
2024-03-22 06:31:25 +01:00
|
|
|
version = "1.3.280.0";
|
2016-08-31 12:19:14 +02:00
|
|
|
|
2023-04-04 14:52:36 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Tools";
|
2023-10-24 17:09:01 +02:00
|
|
|
rev = "vulkan-sdk-${version}";
|
2024-03-22 06:31:25 +01:00
|
|
|
hash = "sha256-WnlFr9M7OI4unCIxfmSkvcLqZFKhW4Qkbb4+xp8lSOo=";
|
2023-04-04 14:52:36 +02:00
|
|
|
};
|
2016-08-31 12:19:14 +02:00
|
|
|
|
2023-08-08 15:46:29 +02:00
|
|
|
# The cmake options are sufficient for turning on static building, but not
|
|
|
|
# for disabling shared building, just trim the shared lib from the CMake
|
|
|
|
# description
|
|
|
|
patches = lib.optional stdenv.hostPlatform.isStatic ./no-shared-libs.patch;
|
|
|
|
|
2019-11-02 19:41:47 +01:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2016-08-31 12:19:14 +02:00
|
|
|
|
2022-11-01 23:59:31 +01:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DSPIRV-Headers_SOURCE_DIR=${spirv-headers.src}"
|
|
|
|
# Avoid blanket -Werror to evade build failures on less
|
|
|
|
# tested compilers.
|
|
|
|
"-DSPIRV_WERROR=OFF"
|
|
|
|
];
|
2016-09-18 07:19:40 +02:00
|
|
|
|
2022-05-09 06:48:49 +02: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-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2017-01-04 10:56:26 +01:00
|
|
|
description = "The SPIR-V Tools project provides an API and commands for processing SPIR-V modules";
|
2022-11-28 05:37:56 +01:00
|
|
|
homepage = "https://github.com/KhronosGroup/SPIRV-Tools";
|
2017-01-04 10:56:26 +01:00
|
|
|
license = licenses.asl20;
|
2023-08-08 16:25:44 +02:00
|
|
|
platforms = with platforms; unix ++ windows;
|
2017-04-01 21:28:59 +02:00
|
|
|
maintainers = [ maintainers.ralith ];
|
2016-08-31 12:19:14 +02:00
|
|
|
};
|
|
|
|
}
|