[usd] Improve CMake and fix Linux (#31807)

Co-authored-by: Zhao Liu <v-zhli17@microsoft.com>
This commit is contained in:
Michael MIGLIORE 2023-06-14 21:39:27 +02:00 committed by GitHub
parent 3056fed522
commit 2774d2bd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 30 deletions

View File

@ -2,7 +2,7 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
message(STATUS [=[
The usd port does not work the the version of Threading Building Blocks (tbb) currently chosen by vcpkg's baselines,
The usd port does not work with the version of Threading Building Blocks (tbb) currently chosen by vcpkg's baselines,
and does not expect to be updated to work with current versions soon. See
https://github.com/PixarAnimationStudios/USD/issues/1600
@ -43,6 +43,10 @@ vcpkg_cmake_configure(
vcpkg_cmake_install()
# The CMake files installation is not standard in USD and will install pxrConfig.cmake in the prefix root and
# pxrTargets.cmake in "cmake" so we are moving pxrConfig.cmake in the same folder and patch the path to pxrTargets.cmake
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/pxrConfig.cmake "/cmake/pxrTargets.cmake" "/pxrTargets.cmake")
file(
RENAME
"${CURRENT_PACKAGES_DIR}/pxrConfig.cmake"
@ -50,39 +54,40 @@ file(
vcpkg_cmake_config_fixup(CONFIG_PATH cmake PACKAGE_NAME pxr)
vcpkg_copy_pdbs()
# Remove duplicates in debug folder
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/pxrConfig.cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/LICENSE.txt)
# 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()
if(VCPKG_TARGET_IS_WINDOWS)
# 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()
vcpkg_copy_pdbs()
# 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")
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 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()
# fix dll path for 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()
endif()

View File

@ -1,7 +1,7 @@
{
"name": "usd",
"version": "23.5",
"port-version": 1,
"port-version": 2,
"description": "Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications.",
"homepage": "https://github.com/PixarAnimationStudios/USD",
"license": null,

View File

@ -8294,7 +8294,7 @@
},
"usd": {
"baseline": "23.5",
"port-version": 1
"port-version": 2
},
"usockets": {
"baseline": "0.8.6",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b5cb814be5a5aec9d600aeb98cd2126f407ca062",
"version": "23.5",
"port-version": 2
},
{
"git-tree": "cfe836715c8cf43db76006deffa234cecf77745c",
"version": "23.5",