vcpkg/ports/usd/portfile.cmake

148 lines
5.6 KiB
CMake
Raw Normal View History

2024-11-14 18:56:53 +08:00
# USD plugins do not produce .lib
set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)
2024-11-14 18:56:53 +08:00
# Proper support for a true static usd build is left as a future port improvement.
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
[tbb, pagmo2] Update TBB to 2021.5 and update pagmo2 to 2.18.0 (#26284) * [tbb] Update to 2021.3.0 * [tbb] Add Threads dependency * [pagmo2] Update to support new TBB * [openvdb] Update to 8.1.0 * [embree2] Remove from baseline -- it is no longer receiving support from upstream * [usd] Mark as unsupported * [usd] Disable USD in CI due to policy https://github.com/PixarAnimationStudios/USD/issues/1600 * [openvdb] Bump port-version * Update version database * [pagmo2] Fix vcpkg.json * update version * wip update * versions * [embree2] deprecate, [openvdb,usd] resolve conflicts, [tbb] update * Added libxml port. * Remove port version as it's initial port. * Added baseline version * Support only for windows and static * Allowed building debug version * update versions * Update ports/libxpm/portfile.cmake Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> * Added new lines * Update ports/libxpm/vcpkg.json Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> * Update ports/libxpm/portfile.cmake Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> * Update ports/libxpm/vcpkg.json Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> * Regenerated versions * Update ports/libxpm/vcpkg.json Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Libxpm is taken from gitlab now. * Dropped changes against master in original repo for libxpm. * Dropped libxpm from baseline * Dropped version for libxpm * Update cpuinfo * Updated date of version * Update version database * Removed support for arm32 & uwp as library is not supporting it. * Version regenerated * Update ports/cpuinfo/vcpkg.json Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> * Updated versions * Initial commit WIP * Fixed compilation of latest stable version * Dropped comments * Switch from version-string to version * Added versions * Fixed path of cmake files for other projects * Updated versions * Various modernization. * Fully mark embree2 as deprecated. * [pagmo2] Disable -Werror * [cctag] Fix finding and use of TBB. * [openvdb] Baseline the static versions because they exceed FFFFFFFF in size, and I'm not sure if that's fixable.... * [gazebo] Apply https://github.com/osrf/gazebo/pull/3174 patch to fix TBB. * Respond to failures in https://dev.azure.com/vcpkg/public/_build/results?buildId=76586 * [pagmo2] Add license. See https://github.com/esa/pagmo2/blob/19d774fbb6128124305225803f8c1ad9e2f95c8c/src/bfe.cpp#L5-L27 * [tbb] Add license. * [embree2] Add "license". * [tbb] Use vcpkg_cmake_config_fixup and fix version as requested by @LilyWangLL * [usd] Add usd is known broken message. * [embree2] Remove completely. * Fix version database. * Fix usd version database. * Fix wrong case on Linux. * Lowercase the tbb directory to get to their configs. * [cctag] minimize patches * [tbb] Apply supports expression fix suggested in https://github.com/microsoft/vcpkg/pull/26284#discussion_r967427833 * [usd] Add note about upstream issue. * [pagmo2] Minimize patch. Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: Jonliu1993 <13720414433@163.com> Co-authored-by: Mathis Logemann <mathisloge@gmail.com> Co-authored-by: Victor Romero <viromer@microsoft.com> Co-authored-by: Vladimír Aubrecht <vladimir.aubrecht@me.com> Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>
2022-09-24 03:03:33 +08:00
2023-03-16 01:50:48 +08:00
string(REGEX REPLACE "^([0-9]+)[.]([0-9])\$" "\\1.0\\2" USD_VERSION "${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO PixarAnimationStudios/OpenUSD
2023-03-16 01:50:48 +08:00
REF "v${USD_VERSION}"
2024-11-14 18:56:53 +08:00
SHA512 7d4404980579c4de3c155386184ca9d2eb96756ef6e090611bae7b4c21ad942c649f73a39b74ad84d0151ce6b9236c4b6c0c555e8e36fdd86304079e1c2e5cbe
HEAD_REF release
PATCHES
2024-11-14 18:56:53 +08:00
001-fix_rename_find_package_to_find_dependency.patch # See PixarAnimationStudios/OpenUSD#3205
002-vcpkg_find_tbb.patch # See PixarAnimationStudios/OpenUSD#3207
003-vcpkg_find_opensubdiv.patch
004-vcpkg_find_openimageio.patch
005-vcpkg_find_shaderc.patch
006-vcpkg_find_spirv-reflect.patch
007-vcpkg_find_vma.patch
008-fix_cmake_package.patch
009-fix_cmake_hgi_interop.patch
010-fix_missing_find_dependency_vulkan.patch
011-fix_clang8_compiler_error.patch
012-vcpkg_install_folder_conventions.patch
013-cmake_export_plugin_as_modules.patch
014-MaterialX_v1.38-39.patch # PixarAnimationStudios/OpenUSD#3159
015-fix_missing_find_dependency_opengl.patch
016-TBB-2022.patch # Accomodate oneapi-src/oneTBB#1345 changes
)
# Changes accompanying 006-vcpkg_find_spirv-reflect.patch
vcpkg_replace_string("${SOURCE_PATH}/pxr/imaging/hgiVulkan/shaderCompiler.cpp"
[[#include "pxr/imaging/hgiVulkan/spirv_reflect.h"]]
[[#include <spirv_reflect.h>]]
)
file(REMOVE
"${SOURCE_PATH}/pxr/imaging/hgiVulkan/spirv_reflect.cpp"
"${SOURCE_PATH}/pxr/imaging/hgiVulkan/spirv_reflect.h"
)
2024-11-14 18:56:53 +08:00
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
materialx PXR_ENABLE_MATERIALX_SUPPORT
metal PXR_ENABLE_METAL_SUPPORT
openimageio PXR_BUILD_OPENIMAGEIO_PLUGIN
vulkan PXR_ENABLE_VULKAN_SUPPORT
)
if (PXR_ENABLE_MATERIALX_SUPPORT)
list(APPEND FEATURE_OPTIONS "-DMaterialX_DIR=${CURRENT_INSTALLED_DIR}/share/materialx")
endif()
# hgiInterop Metal and Vulkan backend requires garch which is only enabled if PXR_ENABLE_GL_SUPPORT is ON
if(PXR_ENABLE_VULKAN_SUPPORT OR PXR_ENABLE_METAL_SUPPORT)
list(APPEND FEATURE_OPTIONS "-DPXR_ENABLE_GL_SUPPORT:BOOL=ON")
else()
list(APPEND FEATURE_OPTIONS "-DPXR_ENABLE_GL_SUPPORT:BOOL=OFF")
2023-05-11 02:16:12 +08:00
endif()
2022-10-06 05:59:14 +08:00
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
2024-11-14 18:56:53 +08:00
OPTIONS ${FEATURE_OPTIONS}
-DPXR_BUILD_DOCUMENTATION:BOOL=OFF
-DPXR_BUILD_EXAMPLES:BOOL=OFF
2024-11-14 18:56:53 +08:00
-DPXR_BUILD_TESTS:BOOL=OFF
-DPXR_BUILD_TUTORIALS:BOOL=OFF
-DPXR_BUILD_USD_TOOLS:BOOL=OFF
2024-11-14 18:56:53 +08:00
-DPXR_BUILD_ALEMBIC_PLUGIN:BOOL=OFF
-DPXR_BUILD_DRACO_PLUGIN:BOOL=OFF
-DPXR_BUILD_EMBREE_PLUGIN:BOOL=OFF
-DPXR_BUILD_PRMAN_PLUGIN:BOOL=OFF
2024-11-14 18:56:53 +08:00
-DPXR_BUILD_IMAGING:BOOL=ON
-DPXR_BUILD_USD_IMAGING:BOOL=ON
2024-11-14 18:56:53 +08:00
-DPXR_ENABLE_OPENVDB_SUPPORT:BOOL=OFF
-DPXR_ENABLE_PTEX_SUPPORT:BOOL=OFF
2024-11-14 18:56:53 +08:00
-DPXR_PREFER_SAFETY_OVER_SPEED:BOOL=ON
2024-11-14 18:56:53 +08:00
-DPXR_ENABLE_PRECOMPILED_HEADERS:BOOL=OFF
2024-11-14 18:56:53 +08:00
-DPXR_ENABLE_PYTHON_SUPPORT:BOOL=OFF
-DPXR_USE_DEBUG_PYTHON:BOOL=OFF
MAYBE_UNUSED_VARIABLES
PXR_USE_PYTHON_3
PYTHON_EXECUTABLE
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
# Handle debug path for USD plugins
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(GLOB_RECURSE debug_targets
"${CURRENT_PACKAGES_DIR}/debug/share/pxr/*-debug.cmake"
)
foreach(debug_target IN LISTS debug_targets)
file(READ "${debug_target}" contents)
string(REPLACE "\${_IMPORT_PREFIX}/usd" "\${_IMPORT_PREFIX}/debug/usd" contents "${contents}")
string(REPLACE "\${_IMPORT_PREFIX}/plugin" "\${_IMPORT_PREFIX}/debug/plugin" contents "${contents}")
file(WRITE "${debug_target}" "${contents}")
endforeach()
endif()
vcpkg_cmake_config_fixup(PACKAGE_NAME "pxr")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
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()
# 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()
2024-11-14 18:56:53 +08:00
# Handle copyright
vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/LICENSE.txt)