ncnn: fix build on Darwin

ncnn defaults to static linkage on Darwin against MoltenVK, but static
libraries are not build by default for MoltenVK in nixpkgs, and it’s not
taken as a dependency anyway. Override this behavior by specifying
`Vulkan_LIBRARY` explicitly as `-lvulkan` on Darwin.
This commit is contained in:
Randy Eckenrode 2024-03-23 09:18:53 -04:00
parent c1a17238bc
commit 0697a4a55b
No known key found for this signature in database
GPG key ID: 64C1CD4EC2A600D9

View file

@ -33,7 +33,9 @@ stdenv.mkDerivation rec {
"-DNCNN_BUILD_TOOLS=0"
"-DNCNN_SYSTEM_GLSLANG=1"
"-DNCNN_PYTHON=0" # Should be an attribute
];
]
# Requires setting `Vulkan_LIBRARY` on Darwin. Otherwise the build fails due to missing symbols.
++ lib.optionals stdenv.isDarwin [ "-DVulkan_LIBRARY=-lvulkan" ];
nativeBuildInputs = [ cmake ];
buildInputs = [ vulkan-headers vulkan-loader glslang opencv protobuf ];