nixpkgs/pkgs/development/tools/spirv-tools/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
2.0 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, cmake, python3, spirv-headers }:
2016-08-31 10:19:14 +00:00
stdenv.mkDerivation rec {
pname = "spirv-tools";
version = "1.3.261.0";
2016-08-31 10:19:14 +00:00
2023-04-04 12:52:36 +00:00
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
rev = "sdk-${version}";
hash = "sha256-K7cv0mMNrXYOlJsxAPwz3rVX5FnsnBNvaU33k9hYnQc=";
2023-04-04 12:52:36 +00:00
};
2016-08-31 10:19:14 +00:00
2023-08-08 13:46:29 +00: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 18:41:47 +00:00
nativeBuildInputs = [ cmake python3 ];
2016-08-31 10:19:14 +00:00
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; {
description = "The SPIR-V Tools project provides an API and commands for processing SPIR-V modules";
2022-11-28 04:37:56 +00:00
homepage = "https://github.com/KhronosGroup/SPIRV-Tools";
license = licenses.asl20;
2023-08-08 14:25:44 +00:00
platforms = with platforms; unix ++ windows;
2017-04-01 19:28:59 +00:00
maintainers = [ maintainers.ralith ];
2016-08-31 10:19:14 +00:00
};
}