nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix
Samuel Evans-Powell a0efdd21a1
vulkan-loader: Fix MinGW build
- Fix mingwW64 build of vulkan-loader by not including X/wayland libraries on
  windows.

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2023-12-07 21:10:06 +08:00

45 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libxcb
, libXrandr, wayland, moltenvk, vulkan-headers, addOpenGLRunpath }:
stdenv.mkDerivation rec {
pname = "vulkan-loader";
version = "1.3.268.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Loader";
rev = "vulkan-sdk-${version}";
hash = "sha256-TDn8eVz1fhGfvUiGcxqOk2BN9tuIF5+ssIXtOo3weS0=";
};
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
}
'';
meta = with lib; {
description = "LunarG Vulkan loader";
homepage = "https://www.lunarg.com";
platforms = platforms.unix ++ platforms.windows;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
broken = (version != vulkan-headers.version);
};
}