From 4733e26fa827d173c67e780ac154307581688afa Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 13 Nov 2020 05:37:53 +0900 Subject: [PATCH] [usd] fix dll path and update to 20.08 (#13687) * fix plugInfo.json and dll path * release build issue: https://github.com/PixarAnimationStudios/USD/issues/960 * add usage * [usd] Add homepage * [usd] Fix install copyright * fix for linux build * fix windows build * fix No such file or directory * use VCPKG_TARGET_IS_WINDOWS * cmake to share/pxr * fix TARGET_PATH Co-authored-by: Lily <47812810+LilyWangL@users.noreply.github.com> Co-authored-by: wangli28 Co-authored-by: Nicole Mazzuca --- ports/usd/CONTROL | 3 ++- ports/usd/fix-build-error.patch | 13 ---------- ports/usd/fix_build-location.patch | 13 ++++++++++ ports/usd/portfile.cmake | 40 ++++++++++++++++++++++++------ 4 files changed, 48 insertions(+), 21 deletions(-) delete mode 100644 ports/usd/fix-build-error.patch create mode 100644 ports/usd/fix_build-location.patch diff --git a/ports/usd/CONTROL b/ports/usd/CONTROL index 59df24ec36..1d3225a0d8 100644 --- a/ports/usd/CONTROL +++ b/ports/usd/CONTROL @@ -1,5 +1,6 @@ Source: usd -Version: 20.02-1 +Version: 20.08 +Homepage: https://github.com/PixarAnimationStudios/USD Build-Depends: boost-assign, boost-crc, boost-date-time, boost-filesystem, boost-format, boost-multi-index, boost-program-options, boost-regex, boost-system, boost-vmd, tbb, zlib Description: Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. Supports: !x86 diff --git a/ports/usd/fix-build-error.patch b/ports/usd/fix-build-error.patch deleted file mode 100644 index b13fa69725..0000000000 --- a/ports/usd/fix-build-error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/pxr/usd/ar/packageUtils.cpp b/pxr/usd/ar/packageUtils.cpp -index d497587..ed3df29 100644 ---- a/pxr/usd/ar/packageUtils.cpp -+++ b/pxr/usd/ar/packageUtils.cpp -@@ -29,6 +29,8 @@ - #include "pxr/base/tf/pathUtils.h" - #include "pxr/base/tf/stringUtils.h" - -+#include -+ - PXR_NAMESPACE_OPEN_SCOPE - - namespace diff --git a/ports/usd/fix_build-location.patch b/ports/usd/fix_build-location.patch new file mode 100644 index 0000000000..34d77cae63 --- /dev/null +++ b/ports/usd/fix_build-location.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/macros/Private.cmake b/cmake/macros/Private.cmake +index 3825e2a19..0a79b49bd 100644 +--- a/cmake/macros/Private.cmake ++++ b/cmake/macros/Private.cmake +@@ -1238,7 +1238,7 @@ function(_pxr_library NAME) + MFB_PACKAGE_NAME=${PXR_PACKAGE} + MFB_ALT_PACKAGE_NAME=${PXR_PACKAGE} + MFB_PACKAGE_MODULE=${pythonModuleName} +- PXR_BUILD_LOCATION=usd ++ PXR_BUILD_LOCATION=../lib/usd + PXR_PLUGIN_BUILD_LOCATION=../plugin/usd + ${pxrInstallLocation} + ${pythonModulesEnabled} diff --git a/ports/usd/portfile.cmake b/ports/usd/portfile.cmake index e6cbfaba8b..6abb5c15e3 100644 --- a/ports/usd/portfile.cmake +++ b/ports/usd/portfile.cmake @@ -6,17 +6,22 @@ SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO PixarAnimationStudios/USD - REF be1a80f8cb91133ac75e1fc2a2e1832cd10d91c8 # v20.02 - SHA512 12c7cf7e5320b168ddde870b1a68b482515b33bd29206c4f6cbb248b9071b866c47353bf496890e01950abb5f725157eca576f9dc403e15020474f9a653b43fe + REF 71b4baace2044ea4400ba802e91667f9ebe342f0 # v20.08 + SHA512 0f23b84d314d88d3524f22ebc344e2b506cb7e8ac064726df432a968a4bae0fd2249e968bd10845de9067290eaaa3f8c9e2a483551ffc06b826f3eba816061a9 HEAD_REF master PATCHES - fix-build-error.patch + fix_build-location.patch ) vcpkg_find_acquire_program(PYTHON2) get_filename_component(PYTHON2_DIR "${PYTHON2}" DIRECTORY) vcpkg_add_to_path("${PYTHON2_DIR}") +IF (VCPKG_TARGET_IS_WINDOWS) +ELSE() +file(REMOVE ${SOURCE_PATH}/cmake/modules/FindTBB.cmake) +ENDIF() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -29,6 +34,9 @@ vcpkg_configure_cmake( -DPXR_BUILD_TESTS:BOOL=OFF -DPXR_BUILD_USD_IMAGING:BOOL=OFF -DPXR_ENABLE_PYTHON_SUPPORT:BOOL=OFF + -DPXR_BUILD_EXAMPLES:BOOL=OFF + -DPXR_BUILD_TUTORIALS:BOOL=OFF + -DPXR_BUILD_USD_TOOLS:BOOL=OFF ) vcpkg_install_cmake() @@ -38,7 +46,7 @@ file( "${CURRENT_PACKAGES_DIR}/pxrConfig.cmake" "${CURRENT_PACKAGES_DIR}/cmake/pxrConfig.cmake") -vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) +vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/pxr) vcpkg_copy_pdbs() @@ -46,14 +54,32 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright -file( - COPY ${SOURCE_PATH}/LICENSE.txt - DESTINATION ${CURRENT_PACKAGES_DIR}/share/usd/copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) # Move all dlls to bin file(GLOB RELEASE_DLL ${CURRENT_PACKAGES_DIR}/lib/*.dll) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) file(GLOB DEBUG_DLL ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) foreach(CURRENT_FROM ${RELEASE_DLL} ${DEBUG_DLL}) string(REPLACE "/lib/" "/bin/" CURRENT_TO ${CURRENT_FROM}) file(RENAME ${CURRENT_FROM} ${CURRENT_TO}) endforeach() + +function(file_replace_regex filename match_string replace_string) + file(READ ${filename} _contents) + string(REGEX REPLACE "${match_string}" "${replace_string}" _contents "${_contents}") + file(WRITE ${filename} "${_contents}") +endfunction() + +# fix dll path for cmake +file_replace_regex(${CURRENT_PACKAGES_DIR}/share/pxr/pxrConfig.cmake "/cmake/pxrTargets.cmake" "/pxrTargets.cmake") +file_replace_regex(${CURRENT_PACKAGES_DIR}/share/pxr/pxrTargets-debug.cmake "debug/lib/([a-zA-Z0-9_]+)\\.dll" "debug/bin/\\1.dll") +file_replace_regex(${CURRENT_PACKAGES_DIR}/share/pxr/pxrTargets-release.cmake "lib/([a-zA-Z0-9_]+)\\.dll" "bin/\\1.dll") + +# fix plugInfo.json for runtime +file(GLOB_RECURSE PLUGINFO_FILES ${CURRENT_PACKAGES_DIR}/lib/usd/*/resources/plugInfo.json) +file(GLOB_RECURSE PLUGINFO_FILES_DEBUG ${CURRENT_PACKAGES_DIR}/debug/lib/usd/*/resources/plugInfo.json) +foreach(PLUGINFO ${PLUGINFO_FILES} ${PLUGINFO_FILES_DEBUG}) + file_replace_regex(${PLUGINFO} [=["LibraryPath": "../../([a-zA-Z0-9_]+).dll"]=] [=["LibraryPath": "../../../bin/\1.dll"]=]) +endforeach()