Unverified Commit 22c320b5 authored by Zexin Yuan's avatar Zexin Yuan
Browse files

opensubdiv: fix static target path

parent 540c43dc
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
diff --git a/opensubdiv-config.cmake.in b/opensubdiv-config.cmake.in
index 08a005aa..48fd2cdc 100644
--- a/opensubdiv-config.cmake.in
+++ b/opensubdiv-config.cmake.in
@@ -1,6 +1,6 @@
 @PACKAGE_INIT@
 
-set_and_check(OpenSubdiv_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
-set_and_check(OpenSubdiv_LIB_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
+set(OpenSubdiv_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
+set(OpenSubdiv_LIB_DIR "@CMAKE_INSTALL_FULL_LIBDIR@")
 
 include("${CMAKE_CURRENT_LIST_DIR}/OpenSubdivTargets.cmake")
+16 −3
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
    ++ lib.optionals cudaSupport [
      cudaPackages.cuda_nvcc
    ];

  buildInputs =
    lib.optionals stdenv.hostPlatform.isUnix [
      libGLU
@@ -55,12 +56,18 @@ stdenv.mkDerivation (finalAttrs: {
      xorg.libXinerama
      xorg.libXi
    ]
    ++ lib.optionals (openclSupport && stdenv.hostPlatform.isLinux) [ ocl-icd ]

    ++ lib.optionals (openclSupport && stdenv.hostPlatform.isLinux) [
      ocl-icd
    ]
    ++ lib.optionals cudaSupport [
      cudaPackages.cuda_cudart
    ];

  patches = [
    # Prevent CMake from generating a redundant nested path like /nix/store/.../nix/store/...
    ./cmake-config.patch
  ];

  # It's important to set OSD_CUDA_NVCC_FLAGS,
  # because otherwise OSD might piggyback unwanted architectures:
  # https://github.com/PixarAnimationStudios/OpenSubdiv/blob/7d0ab5530feef693ac0a920585b5c663b80773b3/CMakeLists.txt#L602
@@ -105,7 +112,13 @@ stdenv.mkDerivation (finalAttrs: {
      ''
    else
      ''
        moveToOutput "lib/*.a" $static
        moveToOutput "lib/libosd*.a" $static
      '';

  postFixup = ''
    # Adjust static library path to reflect relocation to $static
    sed -i -E "s|\\\$\{_IMPORT_PREFIX\}/lib/(libosd.*\.a)|$static/lib/\1|" \
      $dev/lib/cmake/OpenSubdiv/OpenSubdivTargets-release.cmake
  '';

  meta = {