From 974b11fd85a74ed2efac36b6d57b0aeb40ca4f7c Mon Sep 17 00:00:00 2001 From: Ashley Ruglys Date: Tue, 20 Feb 2024 12:42:37 +1300 Subject: [PATCH] opensubdiv: Get building on windows Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com> --- pkgs/by-name/op/opensubdiv/package.nix | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/op/opensubdiv/package.nix b/pkgs/by-name/op/opensubdiv/package.nix index 3f0282a20a0a..d35b64188d2c 100644 --- a/pkgs/by-name/op/opensubdiv/package.nix +++ b/pkgs/by-name/op/opensubdiv/package.nix @@ -44,9 +44,11 @@ stdenv.mkDerivation rec { ]; buildInputs = [ + python3 + ] + ++ lib.optionals stdenv.hostPlatform.isUnix [ libGLU libGL - python3 # FIXME: these are not actually needed, but the configure script wants them. glew xorg.libX11 @@ -56,7 +58,7 @@ stdenv.mkDerivation rec { xorg.libXinerama xorg.libXi ] - ++ lib.optionals (openclSupport && !stdenv.hostPlatform.isDarwin) [ ocl-icd ] + ++ lib.optionals (openclSupport && stdenv.hostPlatform.isLinux) [ ocl-icd ] ++ lib.optionals stdenv.hostPlatform.isDarwin ( with darwin.apple_sdk.frameworks; [ @@ -87,11 +89,12 @@ stdenv.mkDerivation rec { "-DNO_TUTORIALS=1" "-DNO_REGRESSION=1" "-DNO_EXAMPLES=1" + (lib.cmakeBool "NO_DX" stdenv.hostPlatform.isWindows) (lib.cmakeBool "NO_METAL" (!stdenv.hostPlatform.isDarwin)) (lib.cmakeBool "NO_OPENCL" (!openclSupport)) (lib.cmakeBool "NO_CUDA" (!cudaSupport)) ] - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + ++ lib.optionals (stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin) [ "-DGLEW_INCLUDE_DIR=${glew.dev}/include" "-DGLEW_LIBRARY=${glew.dev}/lib" ] @@ -109,15 +112,21 @@ stdenv.mkDerivation rec { NIX_BUILD_CORES=$(( NIX_BUILD_CORES < ${toString maxBuildCores} ? NIX_BUILD_CORES : ${toString maxBuildCores} )) ''; - postInstall = '' - moveToOutput "lib/*.a" $static - ''; + postInstall = + if stdenv.hostPlatform.isWindows then + '' + ln -s $out $static + '' + else + '' + moveToOutput "lib/*.a" $static + ''; meta = { description = "Open-Source subdivision surface library"; homepage = "http://graphics.pixar.com/opensubdiv"; broken = openclSupport && cudaSupport; - platforms = lib.platforms.unix; + platforms = lib.platforms.unix ++ lib.platforms.windows; maintainers = [ ]; license = lib.licenses.asl20; };