blender: fix build, cleanup config, mark darwin as broken (#341622)

This commit is contained in:
Dmitry Kalinkin 2024-09-13 15:51:10 -04:00 committed by GitHub
commit 518ed8ab56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,6 +84,10 @@
}:
let
embreeSupport = (!stdenv.isAarch64 && stdenv.isLinux) || stdenv.isDarwin;
openImageDenoiseSupport = (!stdenv.isAarch64 && stdenv.isLinux) || stdenv.isDarwin;
openUsdSupport = !stdenv.isDarwin;
python3 = python3Packages.python;
pyPkgsOpenusd = python3Packages.openusd.override { withOsl = false; };
@ -163,8 +167,10 @@ stdenv.mkDerivation (finalAttrs: {
"-DWITH_CODEC_SNDFILE=ON"
"-DWITH_CPU_CHECK=OFF"
"-DWITH_CYCLES_DEVICE_OPTIX=${if cudaSupport then "ON" else "OFF"}"
"-DWITH_CYCLES_EMBREE=${if embreeSupport then "ON" else "OFF"}"
"-DWITH_CYCLES_OSL=OFF"
"-DWITH_FFTW3=ON"
"-DWITH_HYDRA=${if openUsdSupport then "ON" else "OFF"}"
"-DWITH_IMAGE_OPENJPEG=ON"
"-DWITH_INSTALL_PORTABLE=OFF"
"-DWITH_JACK=${if jackaudioSupport then "ON" else "OFF"}"
@ -172,6 +178,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DWITH_MOD_OCEANSIM=ON"
"-DWITH_OPENCOLLADA=${if colladaSupport then "ON" else "OFF"}"
"-DWITH_OPENCOLORIO=ON"
"-DWITH_OPENIMAGEDENOISE=${if openImageDenoiseSupport then "ON" else "OFF"}"
"-DWITH_OPENSUBDIV=ON"
"-DWITH_OPENVDB=ON"
"-DWITH_PULSEAUDIO=OFF"
@ -181,7 +188,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DWITH_SDL=OFF"
"-DWITH_STRICT_BUILD_OPTIONS=ON"
"-DWITH_TBB=ON"
"-DWITH_USD=ON"
"-DWITH_USD=${if openUsdSupport then "ON" else "OFF"}"
# Blender supplies its own FindAlembic.cmake (incompatible with the Alembic-supplied config file)
"-DALEMBIC_INCLUDE_DIR=${lib.getDev alembic}/include"
@ -193,13 +200,9 @@ stdenv.mkDerivation (finalAttrs: {
"-DWITH_GHOST_WAYLAND_DYNLOAD=OFF"
"-DWITH_GHOST_WAYLAND_LIBDECOR=ON"
]
++ lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [
"-DWITH_CYCLES_EMBREE=OFF"
]
++ lib.optionals stdenv.isDarwin [
"-DLIBDIR=/does-not-exist"
"-DSSE2NEON_INCLUDE_DIR=${sse2neon}/lib"
"-DWITH_USD=OFF" # currently fails on darwin
]
++ lib.optional stdenv.cc.isClang "-DPYTHON_LINKFLAGS=" # Clang doesn't support "-export-dynamic"
++ lib.optionals cudaSupport [
@ -269,10 +272,8 @@ stdenv.mkDerivation (finalAttrs: {
zlib
zstd
]
++ lib.optionals (!stdenv.isAarch64 && stdenv.isLinux) [
embree
(openimagedenoise.override { inherit cudaSupport; })
]
++ lib.optional embreeSupport embree
++ lib.optional openImageDenoiseSupport (openimagedenoise.override { inherit cudaSupport; })
++ (
if (!stdenv.isDarwin) then
[
@ -285,7 +286,6 @@ stdenv.mkDerivation (finalAttrs: {
libXxf86vm
openal
openxr-loader
pyPkgsOpenusd
]
else
[
@ -296,13 +296,12 @@ stdenv.mkDerivation (finalAttrs: {
OpenGL
SDL
brotli
embree
llvmPackages.openmp
(openimagedenoise.override { inherit cudaSupport; })
sse2neon
]
)
++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart ]
++ lib.optionals openUsdSupport [ pyPkgsOpenusd ]
++ lib.optionals waylandSupport [
dbus
libdecor'
@ -325,7 +324,7 @@ stdenv.mkDerivation (finalAttrs: {
ps.requests
ps.zstandard
]
++ lib.optionals (!stdenv.isDarwin) [ pyPkgsOpenusd ];
++ lib.optional openUsdSupport [ pyPkgsOpenusd ];
blenderExecutable =
placeholder "out"
@ -434,8 +433,7 @@ stdenv.mkDerivation (finalAttrs: {
"x86_64-linux"
"aarch64-darwin"
];
# the current apple sdk is too old (currently 11_0) and fails to build "metal" on x86_64-darwin
broken = stdenv.hostPlatform.system == "x86_64-darwin";
broken = stdenv.isDarwin; # fails due to too-old SDK, using newer SDK fails to compile
maintainers = with lib.maintainers; [
amarshall
veprbl