[physx] Added UWP support (#8658)

This commit is contained in:
RT222 2019-10-18 21:18:10 +02:00 committed by Curtis J Bezault
parent 2aaf7fd8b3
commit 764eed78d9
3 changed files with 161 additions and 130 deletions

View File

@ -1,3 +1,3 @@
Source: physx Source: physx
Version: 4.1.1-2 Version: 4.1.1-3
Description: The NVIDIA PhysX SDK is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs Description: The NVIDIA PhysX SDK is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs

View File

@ -1,123 +1,154 @@
include(vcpkg_common_functions) include(vcpkg_common_functions)
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
message(FATAL_ERROR "Error: UWP builds not supported.") set(SYSTEM_PLATFORM "32")
endif() set(SYSTEM_PLATFORM_PATH "x86_32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(SYSTEM_PLATFORM "64")
set(WINDOWS_PLATFORM "32") set(SYSTEM_PLATFORM_PATH "x86_64")
set(MSBUILD_PLATFORM "Win32") elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") set(SYSTEM_PLATFORM "arm32")
set(WINDOWS_PLATFORM "64") set(SYSTEM_PLATFORM_PATH "arm_32")
set(MSBUILD_PLATFORM "x64") elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
else() set(SYSTEM_PLATFORM "arm64")
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") set(SYSTEM_PLATFORM_PATH "arm_64")
endif() else()
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140") endif()
set(MSVC_VERSION "14")
set(TOOLSET_VERSION "140") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141") set(GENERATE_STATIC_LIBRARIES "True")
set(MSVC_VERSION "15") elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(TOOLSET_VERSION "141") set(GENERATE_STATIC_LIBRARIES "False")
elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142") endif()
set(MSVC_VERSION "16")
set(TOOLSET_VERSION "142") if("${VCPKG_CMAKE_SYSTEM_NAME}" STREQUAL "" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
else() if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
message(FATAL_ERROR "Unsupported platform toolset.") set(MSBUILD_PLATFORM "Win32")
endif() elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(MSBUILD_PLATFORM "x64")
vcpkg_from_github( elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
OUT_SOURCE_PATH SOURCE_PATH if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
REPO NVIDIAGameWorks/PhysX set(MSBUILD_PLATFORM "ARM")
REF ae80dede0546d652040ae6260a810e53e20a06fa elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
SHA512 f3a690039cf39fe2db9a728b82af0d39eaa02340a853bdad4b5152d63532367eb24fc7033a614882168049b80d803b6225fc60ed2900a9d0deab847f220540be set(MSBUILD_PLATFORM "ARM64")
HEAD_REF master else()
PATCHES message(FATAL_ERROR "Unsupported UWP architecture: ${VCPKG_TARGET_ARCHITECTURE}")
msvc_142_bug_workaround.patch endif()
vs16_3_typeinfo_header_fix.patch else()
) message(FATAL_ERROR "Unsupported Windows architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
set(BUILD_SNIPPETS "False")
set(BUILD_PUBLIC_SAMPLES "False") if(VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(FLOAT_POINT_PRECISE_MATH "False") set(MSVC_VERSION "14")
set(TOOLSET_VERSION "140")
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") elseif(VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(GENERATE_STATIC_LIBRARIES "True") set(MSVC_VERSION "15")
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(TOOLSET_VERSION "141")
set(GENERATE_STATIC_LIBRARIES "False") elseif(VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
endif() set(MSVC_VERSION "16")
set(TOOLSET_VERSION "142")
if (VCPKG_CRT_LINKAGE STREQUAL "dynamic") else()
set(USE_STATIC_WINCRT "False") message(FATAL_ERROR "Unsupported platform toolset.")
set(RUNTIME_LIBRARY_LINKAGE "md") endif()
elseif (VCPKG_CRT_LINKAGE STREQUAL "static")
set(USE_STATIC_WINCRT "True") set(FLOAT_POINT_PRECISE_MATH "False")
set(RUNTIME_LIBRARY_LINKAGE "mt") set(BUILD_SNIPPETS "False")
endif() set(BUILD_PUBLIC_SAMPLES "False")
set(VC_VERSION "vc${MSVC_VERSION}win${WINDOWS_PLATFORM}") if("${VCPKG_CMAKE_SYSTEM_NAME}" STREQUAL "")
set(SYSTEM "win")
set(PRESET_FILE ${VC_VERSION}-${RUNTIME_LIBRARY_LINKAGE}-${VCPKG_LIBRARY_LINKAGE}) if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
file(REMOVE ${SOURCE_PATH}/physx/buildtools/presets/public/${PRESET_FILE}.xml) set(USE_STATIC_WINCRT "False")
configure_file(${CMAKE_CURRENT_LIST_DIR}/preset.xml.in ${SOURCE_PATH}/physx/buildtools/presets/public/${PRESET_FILE}.xml) set(RUNTIME_LIBRARY_LINKAGE "md")
elseif(VCPKG_CRT_LINKAGE STREQUAL "static")
vcpkg_find_acquire_program(PYTHON3) set(USE_STATIC_WINCRT "True")
get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) set(RUNTIME_LIBRARY_LINKAGE "mt")
vcpkg_add_to_path(${PYTHON3_DIR}) endif()
set(USE_DEBUG_CRT "True")
get_filename_component(CMAKE_DIR ${CMAKE_COMMAND} DIRECTORY) set(COMPILER "vc${MSVC_VERSION}${SYSTEM}${SYSTEM_PLATFORM}")
# If cmake is not installed then adding it to the end of the path set(PRESET_FILE ${COMPILER}-${RUNTIME_LIBRARY_LINKAGE}-${VCPKG_LIBRARY_LINKAGE})
# will allow generate_projects.bat to find the cmake used by vcpkg. set(BUILD_PATH "${SYSTEM}.${SYSTEM_PLATFORM_PATH}.vc${TOOLSET_VERSION}.${RUNTIME_LIBRARY_LINKAGE}")
vcpkg_add_to_path(${CMAKE_DIR}) elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(SYSTEM "uwp")
vcpkg_execute_required_process( set(USE_STATIC_WINCRT "False")
COMMAND ${SOURCE_PATH}/physx/generate_projects.bat ${PRESET_FILE} set(USE_DEBUG_CRT "False")
WORKING_DIRECTORY ${SOURCE_PATH}/physx set(COMPILER "vc${MSVC_VERSION}${SYSTEM}${SYSTEM_PLATFORM}")
LOGNAME build-${TARGET_TRIPLET} set(PRESET_FILE ${COMPILER}-${VCPKG_LIBRARY_LINKAGE})
) set(BUILD_PATH "${SYSTEM}.${SYSTEM_PLATFORM_PATH}.vc${TOOLSET_VERSION}")
endif()
set(RELEASE_CONFIGURATION "release") else()
set(DEBUG_CONFIGURATION "debug") message(FATAL_ERROR "Unsupported platform: ${VCPKG_CMAKE_SYSTEM_NAME}")
endif()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/physx/compiler/${VC_VERSION}/PhysXSDK.sln vcpkg_from_github(
RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION} OUT_SOURCE_PATH SOURCE_PATH
DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION} REPO NVIDIAGameWorks/PhysX
PLATFORM ${MSBUILD_PLATFORM} REF ae80dede0546d652040ae6260a810e53e20a06fa
) SHA512 f3a690039cf39fe2db9a728b82af0d39eaa02340a853bdad4b5152d63532367eb24fc7033a614882168049b80d803b6225fc60ed2900a9d0deab847f220540be
HEAD_REF master
set(BUILD_PATH "win.x86_${WINDOWS_PLATFORM}.vc${TOOLSET_VERSION}.${RUNTIME_LIBRARY_LINKAGE}") PATCHES
msvc_142_bug_workaround.patch
file(INSTALL ${SOURCE_PATH}/physx/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}/) vs16_3_typeinfo_header_fix.patch
file(INSTALL ${SOURCE_PATH}/pxshared/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}/) )
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(REMOVE ${SOURCE_PATH}/physx/buildtools/presets/public/${PRESET_FILE}.xml)
file(GLOB RELEASE_BINS ${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.dll) configure_file(${CMAKE_CURRENT_LIST_DIR}/preset.xml.in ${SOURCE_PATH}/physx/buildtools/presets/public/${PRESET_FILE}.xml)
file(INSTALL ${RELEASE_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
vcpkg_find_acquire_program(PYTHON3)
file(GLOB DEBUG_BINS ${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.dll) get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY)
file(INSTALL ${DEBUG_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) vcpkg_add_to_path(${PYTHON3_DIR})
vcpkg_copy_pdbs() get_filename_component(CMAKE_DIR ${CMAKE_COMMAND} DIRECTORY)
endif() # If cmake is not installed then adding it to the end of the path
# will allow generate_projects.bat to find the cmake used by vcpkg.
file( vcpkg_add_to_path(${CMAKE_DIR})
GLOB
RELEASE_LIBS vcpkg_execute_required_process(
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.lib COMMAND ${SOURCE_PATH}/physx/generate_projects.bat ${PRESET_FILE}
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.pdb WORKING_DIRECTORY ${SOURCE_PATH}/physx
${SOURCE_PATH}/physx/compiler/${VC_VERSION}/sdk_source_bin/${RELEASE_CONFIGURATION}/*.pdb LOGNAME build-${TARGET_TRIPLET}
) )
file(INSTALL ${RELEASE_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
set(RELEASE_CONFIGURATION "release")
file( set(DEBUG_CONFIGURATION "debug")
GLOB
DEBUG_LIBS vcpkg_build_msbuild(
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.lib PROJECT_PATH ${SOURCE_PATH}/physx/compiler/${COMPILER}/PhysXSDK.sln
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.pdb RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION}
${SOURCE_PATH}/physx/compiler/${VC_VERSION}/sdk_source_bin/${DEBUG_CONFIGURATION}/*.pdb DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION}
) PLATFORM ${MSBUILD_PLATFORM}
file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) )
file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) file(INSTALL ${SOURCE_PATH}/physx/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}/)
file(INSTALL ${SOURCE_PATH}/pxshared/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}/)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(GLOB RELEASE_BINS ${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.dll)
file(INSTALL ${RELEASE_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(GLOB DEBUG_BINS ${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.dll)
file(INSTALL ${DEBUG_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
vcpkg_copy_pdbs()
endif()
file(
GLOB
RELEASE_LIBS
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.lib
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${RELEASE_CONFIGURATION}/*.pdb
${SOURCE_PATH}/physx/compiler/${COMPILER}/sdk_source_bin/${RELEASE_CONFIGURATION}/*.pdb
)
file(INSTALL ${RELEASE_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(
GLOB
DEBUG_LIBS
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.lib
${SOURCE_PATH}/physx/bin/${BUILD_PATH}/${DEBUG_CONFIGURATION}/*.pdb
${SOURCE_PATH}/physx/compiler/${COMPILER}/sdk_source_bin/${DEBUG_CONFIGURATION}/*.pdb
)
file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<preset name="vc${MSVC_VERSION}win${WINDOWS_PLATFORM}" comment="VC${MSVC_VERSION} Win${WINDOWS_PLATFORM} PhysX general settings"> <preset name="vc${MSVC_VERSION}${SYSTEM}${SYSTEM_PLATFORM}" comment="VC${MSVC_VERSION} ${SYSTEM}${SYSTEM_PLATFORM} PhysX general settings">
<platform targetPlatform="win${WINDOWS_PLATFORM}" compiler="vc${MSVC_VERSION}" /> <platform targetPlatform="${SYSTEM}${SYSTEM_PLATFORM}" compiler="vc${MSVC_VERSION}" />
<CMakeSwitches> <CMakeSwitches>
<cmakeSwitch name="PX_BUILDSNIPPETS" value="${BUILD_SNIPPETS}" comment="Generate the snippets" /> <cmakeSwitch name="PX_BUILDSNIPPETS" value="${BUILD_SNIPPETS}" comment="Generate the snippets" />
<cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="${BUILD_PUBLIC_SAMPLES}" comment="Generate the samples projects" /> <cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="${BUILD_PUBLIC_SAMPLES}" comment="Generate the samples projects" />
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="${GENERATE_STATIC_LIBRARIES}" comment="Generate static libraries" /> <cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="${GENERATE_STATIC_LIBRARIES}" comment="Generate static libraries" />
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="${USE_STATIC_WINCRT}" comment="Use the statically linked windows CRT" /> <cmakeSwitch name="NV_USE_STATIC_WINCRT" value="${USE_STATIC_WINCRT}" comment="Use the statically linked windows CRT" />
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" /> <cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="${USE_DEBUG_CRT}" comment="Use the debug version of the CRT" />
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="${FLOAT_POINT_PRECISE_MATH}" comment="Float point precise math" /> <cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="${FLOAT_POINT_PRECISE_MATH}" comment="Float point precise math" />
</CMakeSwitches> </CMakeSwitches>
<CMakeParams> <CMakeParams>
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc${MSVC_VERSION}win${WINDOWS_PLATFORM}/PhysX" comment="Install path relative to PhysX SDK root" /> <cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc${MSVC_VERSION}${SYSTEM}${SYSTEM_PLATFORM}/PhysX" comment="Install path relative to PhysX SDK root" />
</CMakeParams> </CMakeParams>
</preset> </preset>