depot/third_party/nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix
Default email c7cb07f092 Project import generated by Copybara.
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
2024-02-29 21:09:43 +01:00

53 lines
1.6 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libxcb
, libXrandr, wayland, moltenvk, vulkan-headers, addOpenGLRunpath
, testers }:
stdenv.mkDerivation (finalAttrs: {
pname = "vulkan-loader";
version = "1.3.275.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Loader";
rev = "vulkan-sdk-${finalAttrs.version}";
hash = "sha256-53PUXAWiK38ciV6oMvD7ZHdXi4RU4r0RmDWUUHU3mE0=";
};
patches = [ ./fix-pkgconfig.patch ];
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ vulkan-headers ]
++ lib.optionals stdenv.isLinux [ libX11 libxcb libXrandr wayland ];
cmakeFlags = [ "-DCMAKE_INSTALL_INCLUDEDIR=${vulkan-headers}/include" ]
++ lib.optional stdenv.isDarwin "-DSYSCONFDIR=${moltenvk}/share"
++ lib.optional stdenv.isLinux "-DSYSCONFDIR=${addOpenGLRunpath.driverLink}/share"
++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DUSE_GAS=OFF";
outputs = [ "out" "dev" ];
doInstallCheck = true;
installCheckPhase = ''
grep -q "${vulkan-headers}/include" $dev/lib/pkgconfig/vulkan.pc || {
echo vulkan-headers include directory not found in pkg-config file
exit 1
}
'';
passthru = {
tests.pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = with lib; {
description = "LunarG Vulkan loader";
homepage = "https://www.lunarg.com";
platforms = platforms.unix ++ platforms.windows;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
broken = finalAttrs.version != vulkan-headers.version;
pkgConfigModules = [ "vulkan" ];
};
})