[physx] Update to 5.x (#32568)

This commit is contained in:
Billy O'Neal 2023-07-17 13:01:51 -07:00 committed by GitHub
parent fba81a6a54
commit d512dc8197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 283 additions and 589 deletions

View File

@ -1,311 +0,0 @@
###############################################################################################################
# Port for Omniverse PhysX 5 - NVIDIA Corporation
# Written by Marco Alesiani <malesiani@nvidia.com>
# Note: this port is NOT officially supported by NVIDIA.
# This port is also not a replacement for the 'physx' port: the newest Omniverse PhysX dropped support
# for many platforms so the old one will continue to be community maintained to support all previous platforms.
###############################################################################################################
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO NVIDIA-Omniverse/PhysX
REF 105.0-physx-5.2.1 # newest tag
SHA512 d1c27d79d9c54a6ea0a79f5fa3ccd0b7821a48116c765b185442809d21fdd20086e2bfd6408d8a87e1507e0b951f1d9efb794f33d53bc05ab017fa50a41ba770
HEAD_REF main
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(VCPKG_BUILD_STATIC_LIBS TRUE)
else()
set(VCPKG_BUILD_STATIC_LIBS FALSE)
endif()
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(VCPKG_LINK_CRT_STATICALLY TRUE)
else()
set(VCPKG_LINK_CRT_STATICALLY FALSE)
endif()
# Target platform detection for packman (the NVIDIA dependency downloader) and CMake options settings
if(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
)
set(targetPlatform "linux")
elseif(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
)
set(targetPlatform "linuxAarch64")
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
-DNV_USE_STATIC_WINCRT=${VCPKG_LINK_CRT_STATICALLY}
-DPX_FLOAT_POINT_PRECISE_MATH=OFF
)
# Note: it would have been more correct to specify "win64" here, but we specify this so that packman can download
# the right dependencies on windows (see the "platforms" field in the dependencies.xml), that will also later
# set up the correct PM_xxx environment variables that we can pass to the cmake generation invocation to find
# whatever the PhysX project needs. Note that vc17(2022) is not required: the latest repo is guaranteed to work
# with vc15, vc16 and vc17 on x64 Windows. The binaries for these platforms downloaded by packman should be the same.
set(targetPlatform "vc17win64")
else()
message(FATAL_ERROR "Unsupported platform/architecture combination")
endif()
######################## Download required deps ##############################
set($ENV{PM_PATHS} "")
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/PhysXGpu%40105.0-5.2.498.33012328-public-signed.7z"
FILENAME "PhysXGpu.7z"
SHA512 b834d4e0ed7d015d33d03862e30ad8296974e605bd4de49d9cfa168958d8e3b67a9b52cc1f2169f25c32211e1880de1ff7f76edae4d4a1b1f12dc6d1873c2d8e
)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_find_acquire_program(7Z)
set(ENV{PM_PhysXGpu_PATH} "${CURRENT_BUILDTREES_DIR}/PhysXGpu_dep")
file(MAKE_DIRECTORY "$ENV{PM_PhysXGpu_PATH}")
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_PhysXGpu_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_PhysXGpu_PATH}"
LOGNAME "extract-PhysXGpu"
)
else()
vcpkg_extract_source_archive(PHYSXGPU_SOURCE_PATH
NO_REMOVE_ONE_LEVEL
ARCHIVE "${ARCHIVE}"
BASE_DIRECTORY PhysXGpu_dep
)
set(ENV{PM_PhysXGpu_PATH} "${PHYSXGPU_SOURCE_PATH}")
endif()
message(STATUS "Extracted dependency to $ENV{PM_PhysXGpu_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_PhysXGpu_PATH})
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/PhysXDevice%4018.12.7.4.7z"
FILENAME "PhysXDevice.7z"
SHA512 c20eb2f1e0dcb9d692cb718ca7e3a332291e72a09614f37080f101e5ebc1591033029f0f1e6fba33a17d4c9f59f13e561f3fc81cee34cd53d50b579c01dd3f3c
)
if(VCPKG_TARGET_IS_WINDOWS)
set(ENV{PM_PhysXDevice_PATH} "${CURRENT_BUILDTREES_DIR}/PhysXDevice_dep")
file(MAKE_DIRECTORY "$ENV{PM_PhysXDevice_PATH}")
vcpkg_find_acquire_program(7Z)
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_PhysXDevice_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_PhysXDevice_PATH}"
LOGNAME "extract-PhysXDevice"
)
else()
vcpkg_extract_source_archive(PHYSXDEVICE_SOURCE_PATH
NO_REMOVE_ONE_LEVEL
ARCHIVE "${ARCHIVE}"
BASE_DIRECTORY PhysXDevice_dep
)
set(ENV{PM_PhysXDevice_PATH} "${PHYSXDEVICE_SOURCE_PATH}")
endif()
message(STATUS "Extracted dependency to $ENV{PM_PhysXDevice_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_PhysXDevice_PATH})
if(targetPlatform STREQUAL "vc17win64")
set(ENV{PM_freeglut_PATH} "${CURRENT_BUILDTREES_DIR}/freeglut_dep")
file(MAKE_DIRECTORY "$ENV{PM_freeglut_PATH}")
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/freeglut-windows%403.4_1.1.7z"
FILENAME "freeglut.7z"
SHA512 c01cb75dd466d6889a72d7236669bfce841cc6da9e0edb4208c4affb5ca939f28d64bc3d988bc85d98c589b0b42ac3464f606c89f6c113106669fc9fe84000e5
)
vcpkg_find_acquire_program(7Z)
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_freeglut_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_freeglut_PATH}"
LOGNAME "extract-freeglut"
)
message(STATUS "Extracted dependency to $ENV{PM_freeglut_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_freeglut_PATH})
endif()
######################## Now generate ALL cmake parameters according to our distribution ##############################
set(PHYSX_ROOT_DIR "${SOURCE_PATH}/physx")
# Set common parameters
set(common_params -DCMAKE_PREFIX_PATH=$ENV{PM_PATHS} -DPHYSX_ROOT_DIR=${PHYSX_ROOT_DIR} -DPX_OUTPUT_LIB_DIR=${PHYSX_ROOT_DIR} -DPX_OUTPUT_BIN_DIR=${PHYSX_ROOT_DIR})
# Set platform and compiler specific parameters
if(targetPlatform STREQUAL "linuxAarch64")
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/linux-aarch64/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=linux -DPX_OUTPUT_ARCH=arm)
elseif(targetPlatform STREQUAL "linux")
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/linux/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=linux -DPX_OUTPUT_ARCH=x86)
elseif(targetPlatform STREQUAL "vc17win64") # Again: this will work for any Win64
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/vc17win64/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=windows -DPX_OUTPUT_ARCH=x86)
endif()
# Also make sure the packman-downloaded GPU driver is found as a binary
list(APPEND platformCMakeParams -DPHYSX_PHYSXGPU_PATH=${PM_PhysXGpu_PATH}/bin)
# Anyway the above only works for clang, see
# source/compiler/cmake/linux/CMakeLists.txt:164
# to avoid problems, we copy _immediately_ the extra binaries
if(targetPlatform STREQUAL "linuxAarch64")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.aarch64/checked/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.aarch64/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.aarch64/release/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.aarch64/release")
elseif(targetPlatform STREQUAL "linux")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.clang/checked/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.clang/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.clang/release/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.clang/release")
elseif(targetPlatform STREQUAL "vc17win64")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/win.x86_64.vc141.mt/checked/PhysXGpu_64.dll" DESTINATION "${SOURCE_PATH}/physx/bin/vc17win64/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/win.x86_64.vc141.mt/release/PhysXGpu_64.dll" DESTINATION "${SOURCE_PATH}/physx/bin/vc17win64/release")
endif()
set(cmakeParams ${platformCMakeParams} ${common_params} ${cmakeParams})
# Finally invoke cmake to configure the PhysX project
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/physx/compiler/public"
GENERATOR "${generator}"
WINDOWS_USE_MSBUILD
OPTIONS
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}
${PLATFORM_OPTIONS}
-DPHYSX_ROOT_DIR=${PHYSX_ROOT_DIR}
${cmakeParams}
OPTIONS_DEBUG
-DNV_USE_DEBUG_WINCRT=TRUE
DISABLE_PARALLEL_CONFIGURE
MAYBE_UNUSED_VARIABLES
PX_OUTPUT_ARCH
PHYSX_PHYSXGPU_PATH
)
# Compile and install in vcpkg's final installation directories all of the include headers and binaries for debug/release
vcpkg_cmake_install()
######################## Extract to final vcpkg install locations and fixup artifacts in wrong dirs ##############################
message("[PHYSX BUILD COMPLETED] Extracting build artifacts to vcpkg installation locations..")
# Artifacts paths are similar to <compiler>/<configuration>/[artifact] however vcpkg expects
# libraries, binaries and headers to be respectively in ${CURRENT_PACKAGES_DIR}/lib or ${CURRENT_PACKAGES_DIR}/debug/lib,
# ${CURRENT_PACKAGES_DIR}/bin or ${CURRENT_PACKAGES_DIR}/debug/bin and ${CURRENT_PACKAGES_DIR}/include.
# This function accepts a DIRECTORY named variable specifying the 'lib' or 'bin' destination directory and a SUFFIXES named
# variable which specifies a list of suffixes to extract in that folder (e.g. all the .lib or .pdb)
function(copy_in_vcpkg_destination_folder_physx_artifacts)
macro(_copy_up _IN_DIRECTORY _OUT_DIRECTORY)
foreach(_SUFFIX IN LISTS _fpa_SUFFIXES)
file(GLOB_RECURSE _ARTIFACTS
LIST_DIRECTORIES false
"${SOURCE_PATH}/physx/${_IN_DIRECTORY}/*${_SUFFIX}"
)
if(_ARTIFACTS)
file(COPY ${_ARTIFACTS} DESTINATION "${CURRENT_PACKAGES_DIR}/${_OUT_DIRECTORY}")
endif()
endforeach()
endmacro()
cmake_parse_arguments(_fpa "" "DIRECTORY" "SUFFIXES" ${ARGN})
_copy_up("bin/*/release" "${_fpa_DIRECTORY}") # could be physx/bin/linux.clang/release or physx/bin/win.x86_64.vc142.mt/release
_copy_up("bin/*/debug" "debug/${_fpa_DIRECTORY}")
endfunction()
# Create output directories
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib")
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Packman also downloads the Gpu driver shared library, so we'll place it in bin and debug/bin
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
copy_in_vcpkg_destination_folder_physx_artifacts(
DIRECTORY "lib"
SUFFIXES ${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX} ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}
)
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Also copy whatever .so/.dll were built. Remember that there should be NO /bin directory (nor debug/bin)
# when using static linkage
copy_in_vcpkg_destination_folder_physx_artifacts(
DIRECTORY "bin"
SUFFIXES ${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX} ".pdb"
)
endif()
# Special treatment is reserved for the PhysXGpu_64 shared library (downloaded by packman).
# This is a 3rd party "optional functionality" dependency.
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools")
set(GPULIBNAMES "")
if(targetPlatform STREQUAL "linuxAarch64" OR targetPlatform STREQUAL "linux")
list(APPEND GPULIBNAMES "libPhysXGpu_64.so" "libPhysXDevice64.so")
elseif(targetPlatform STREQUAL "vc17win64") # Again: this will work for any Win64
list(APPEND GPULIBNAMES "PhysXGpu_64.dll" "PhysXDevice64.dll")
endif()
function(_copy_single_files_from_dir_to_destdir _IN_FILES _IN_DIR _OUT_DIR)
file(GLOB_RECURSE _ARTIFACTS
LIST_DIRECTORIES false
"${_IN_DIR}"
)
foreach(_ARTIFACT IN LISTS _ARTIFACTS)
foreach(_FILE IN LISTS _IN_FILES)
if("${_ARTIFACT}" MATCHES "${_FILE}")
file(COPY "${_ARTIFACT}" DESTINATION "${_OUT_DIR}")
endif()
endforeach()
endforeach()
endfunction()
# Put it in binary directories, it's an optional component (only release binaries should go in tools/)
_copy_single_files_from_dir_to_destdir("${GPULIBNAMES}" "${SOURCE_PATH}/physx/bin/*/release/*" "${CURRENT_PACKAGES_DIR}/tools")
# Copy headers to port's destination folder
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
# Renaming trick to finally have final folder structure as ${CURRENT_PACKAGES_DIR}/include/physx
file(RENAME "${SOURCE_PATH}/physx/include" "${SOURCE_PATH}/physx/physx")
file(COPY "${SOURCE_PATH}/physx/physx" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
# Remove useless build directories
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/source"
"${CURRENT_PACKAGES_DIR}/source"
)
# Install the cmake config that users will use, replace -if any- only @variables@
configure_file("${CMAKE_CURRENT_LIST_DIR}/omniverse-physx-sdk-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/unofficial-omniverse-physx-sdk-config.cmake" @ONLY)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/share")
file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/share/")
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-omniverse-physx-sdk
CONFIG_PATH share/omniverse-physx-sdk)
# Remove fixup wrong directories
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/share"
)
if(targetPlatform STREQUAL "vc17win64")
# Remove freeglut (cannot be skipped in public release builds, but unnecessary)
file(REMOVE
"${CURRENT_PACKAGES_DIR}/bin/freeglut.dll"
"${CURRENT_PACKAGES_DIR}/debug/bin/freeglutd.dll"
)
endif()
# Install license and usage file
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
message("[VCPKG Omniverse PhysX port execution completed]")

View File

@ -1,22 +0,0 @@
{
"name": "omniverse-physx-sdk",
"version": "5.2.1",
"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. This is the latest NVIDIA official version of the PhysX engine which also directly integrates into Omniverse. This port differs from the other 'physx' port (pointing to a repo no longer officially supported by NVIDIA) in supported platforms. It guarantees support only for Omniverse supported platforms. This port is NOT officially supported by NVIDIA.",
"homepage": "https://github.com/NVIDIA-Omniverse/PhysX",
"license": "BSD-3-Clause",
"supports": "(windows & x64 & !mingw & !uwp) | (linux & x64) | (linux & arm64)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true
}
]
}

View File

@ -1,75 +0,0 @@
diff --git a/physx/compiler/public/CMakeLists.txt b/physx/compiler/public/CMakeLists.txt
index 77776ca7..bd7b496d 100644
--- a/physx/compiler/public/CMakeLists.txt
+++ b/physx/compiler/public/CMakeLists.txt
@@ -33,6 +33,8 @@ ENDIF()
project(PhysXSDK C CXX)
+SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "PhysX Debug CXX Flags")
+
OPTION(PX_BUILDSNIPPETS "Generate the snippets" OFF)
OPTION(PX_BUILDPUBLICSAMPLES "Generate the samples" OFF)
OPTION(PX_CMAKE_SUPPRESS_REGENERATION "Disable zero_check projects" OFF)
diff --git a/physx/source/compiler/cmake/uwp/CMakeLists.txt b/physx/source/compiler/cmake/uwp/CMakeLists.txt
index 20dcb6ae..c7e03c3e 100644
--- a/physx/source/compiler/cmake/uwp/CMakeLists.txt
+++ b/physx/source/compiler/cmake/uwp/CMakeLists.txt
@@ -39,11 +39,13 @@ ELSE()
ENDIF()
# Cache the CXX flags so the other CMakeLists.txt can use them if needed
-SET(PHYSX_CXX_FLAGS "/Wall /d2Zi+ /MP /WX /W4 /GF /GS- /GR- /Gd ${PHYSX_FP_MODE} ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
+SET(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS} ${PHYSX_FP_MODE} ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
+if(FALSE)
SET(PHYSX_CXX_FLAGS_DEBUG "/Od ${WINCRT_DEBUG} /Zi" CACHE INTERNAL "PhysX Debug CXX Flags")
SET(PHYSX_CXX_FLAGS_CHECKED "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Checked CXX Flags")
SET(PHYSX_CXX_FLAGS_PROFILE "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Profile CXX Flags")
SET(PHYSX_CXX_FLAGS_RELEASE "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Release CXX Flags")
+endif()
# These flags are local to the directory the CMakeLists.txt is in, so don't get carried over to OTHER CMakeLists.txt (thus the CACHE variables above)
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS})
diff --git a/physx/source/compiler/cmake/windows/CMakeLists.txt b/physx/source/compiler/cmake/windows/CMakeLists.txt
index a1ab3596..dbd20fb0 100644
--- a/physx/source/compiler/cmake/windows/CMakeLists.txt
+++ b/physx/source/compiler/cmake/windows/CMakeLists.txt
@@ -41,17 +41,19 @@ ELSE()
SET(PHYSX_FP_MODE "/fp:fast")
ENDIF()
IF(CMAKE_CL_64)
- SET(PHYSX_CXX_FLAGS "/d2Zi+ /MP /WX /W4 /GF /GS- /GR- /Gd ${PHYSX_FP_MODE} /Oy ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
+ SET(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS} ${PHYSX_FP_MODE} ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
ELSE()
- SET(PHYSX_CXX_FLAGS "/arch:SSE2 /d2Zi+ /MP /WX /W4 /GF /GS- /GR- /Gd ${PHYSX_FP_MODE} /Oy ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
+ SET(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS} /arch:SSE2 ${PHYSX_FP_MODE} ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX")
ENDIF()
+if(FALSE)
SET(PHYSX_CXX_FLAGS_DEBUG "/Od ${WINCRT_DEBUG} /RTCu /Zi" CACHE INTERNAL "PhysX Debug CXX Flags")
# PT: changed /Ox to /O2 because "the /Ox compiler option enables only a subset of the speed optimization options enabled by /O2."
# See https://docs.microsoft.com/en-us/cpp/build/reference/ox-full-optimization?view=vs-2019
SET(PHYSX_CXX_FLAGS_CHECKED "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Checked CXX Flags")
SET(PHYSX_CXX_FLAGS_PROFILE "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Profile CXX Flags")
SET(PHYSX_CXX_FLAGS_RELEASE "/O2 ${WINCRT_NDEBUG} /Zi" CACHE INTERNAL "PhysX Release CXX Flags")
+endif()
# cache lib type defs
IF(PX_GENERATE_STATIC_LIBRARIES)
diff --git a/physx/source/compiler/cmake/linux/CMakeLists.txt b/physx/source/compiler/cmake/linux/CMakeLists.txt
index 6246e488..7bf0cc30 100644
--- a/physx/source/compiler/cmake/linux/CMakeLists.txt
+++ b/physx/source/compiler/cmake/linux/CMakeLists.txt
@@ -36,6 +36,11 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -fstrict-aliasing ${CLANG_WARNINGS}" CACHE INTERNAL "PhysX CXX")
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -fno-strict-aliasing ${GCC_WARNINGS}" CACHE INTERNAL "PhysX CXX")
+
+ # Enable SSE2 and fix double alignment for 32-bit x86 builds
+ IF (CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
+ STRING(APPEND PHYSX_CXX_FLAGS " -malign-double -msse2")
+ ENDIF()
ENDIF()
# Build debug info for all configurations

View File

@ -1,123 +1,212 @@
vcpkg_download_distfile(
patch1
URLS "https://github.com/NVIDIAGameWorks/PhysX/commit/ada4fccf04e5a5832af1353d6d1f91de691aa47d.patch"
FILENAME "physx-PR569-ada4fccf.patch"
SHA512 ec2fc2fce0b5aab4d42b77f21373bf067f129543e672516477513419241c56b99f2d663b992cb29d296933440e7e7cc31a57198f6fcc78d6eac26b7706c1e937
)
vcpkg_download_distfile(
patch2
URLS "https://github.com/NVIDIAGameWorks/PhysX/commit/d590c88e3cbf0fb682726abf7d7c16417855084f.patch"
FILENAME "physx-PR569-d590c88e.patch"
SHA512 4eb7630db1cb10b2372220c3706dfe255075f466c6b2b12654c9fbc3b17c4df69d7b91e6f0d798c92a4cb8806e1c34b66bb52b46d9358d643ca62ec0de321fd2
)
vcpkg_download_distfile(
patch3
URLS "https://github.com/NVIDIAGameWorks/PhysX/commit/cdbfc0f1283829c71b07e332ddd6ce2e5aa7d467.patch"
FILENAME "physx-PR569-cdbfc0f.patch"
SHA512 2d9d4d30d923b0e006ae1a5c413993325bb4ce5c130fe655242611e87dab945cb220776f112b6cf96b1f06c83a6cec475314a11649bf03304083f5068e282ef2
)
###############################################################################################################
# Port for Omniverse PhysX 5 - NVIDIA Corporation
# Written by Marco Alesiani <malesiani@nvidia.com>
# Note: this port is NOT officially supported by NVIDIA.
# This port is also not a replacement for the 'physx' port: the newest Omniverse PhysX dropped support
# for many platforms so the old one will continue to be community maintained to support all previous platforms.
###############################################################################################################
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO NVIDIAGameWorks/PhysX
REF 93c6dd21b545605185f2febc8eeacebe49a99479
SHA512 c9f50255ca9e0f1ebdb9926992315a62b77e2eea3addd4e65217283490714e71e24f2f687717dd8eb155078a1a6b25c9fadc123ce8bc4c5615f7ac66cd6b11aa
HEAD_REF master
PATCHES
fix-compiler-flag.patch
"${patch1}"
"${patch2}"
"${patch3}"
remove-werror.patch
REPO NVIDIA-Omniverse/PhysX
REF 105.0-physx-5.2.1 # newest tag
SHA512 d1c27d79d9c54a6ea0a79f5fa3ccd0b7821a48116c765b185442809d21fdd20086e2bfd6408d8a87e1507e0b951f1d9efb794f33d53bc05ab017fa50a41ba770
HEAD_REF main
)
if(NOT DEFINED RELEASE_CONFIGURATION)
set(RELEASE_CONFIGURATION "release")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(VCPKG_BUILD_STATIC_LIBS TRUE)
else()
set(VCPKG_BUILD_STATIC_LIBS FALSE)
endif()
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(VCPKG_LINK_CRT_STATICALLY TRUE)
else()
set(VCPKG_LINK_CRT_STATICALLY FALSE)
endif()
set(DEBUG_CONFIGURATION "debug")
set(OPTIONS
"-DPHYSX_ROOT_DIR=${SOURCE_PATH}/physx"
"-DPXSHARED_PATH=${SOURCE_PATH}/pxshared"
"-DPXSHARED_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}"
"-DCMAKEMODULES_PATH=${SOURCE_PATH}/externals/cmakemodules"
"-DCMAKEMODULES_NAME=CMakeModules"
"-DCMAKE_MODULES_VERSION=1.27"
"-DPX_BUILDSNIPPETS=OFF"
"-DPX_BUILDPUBLICSAMPLES=OFF"
"-DPX_FLOAT_POINT_PRECISE_MATH=OFF"
"-DPX_COPY_EXTERNAL_DLL=OFF"
"-DGPU_DLL_COPIED=ON"
# Target platform detection for packman (the NVIDIA dependency downloader) and CMake options settings
if(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
)
set(targetPlatform "linux")
elseif(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
)
set(targetPlatform "linuxAarch64")
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM_OPTIONS
-DPX_BUILDSNIPPETS=OFF
-DPX_BUILDPVDRUNTIME=OFF
-DPX_GENERATE_STATIC_LIBRARIES=${VCPKG_BUILD_STATIC_LIBS}
-DNV_USE_STATIC_WINCRT=${VCPKG_LINK_CRT_STATICALLY}
-DPX_FLOAT_POINT_PRECISE_MATH=OFF
)
# Note: it would have been more correct to specify "win64" here, but we specify this so that packman can download
# the right dependencies on windows (see the "platforms" field in the dependencies.xml), that will also later
# set up the correct PM_xxx environment variables that we can pass to the cmake generation invocation to find
# whatever the PhysX project needs. Note that vc17(2022) is not required: the latest repo is guaranteed to work
# with vc15, vc16 and vc17 on x64 Windows. The binaries for these platforms downloaded by packman should be the same.
set(targetPlatform "vc17win64")
else()
message(FATAL_ERROR "Unsupported platform/architecture combination")
endif()
######################## Download required deps ##############################
set($ENV{PM_PATHS} "")
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/PhysXGpu%40105.0-5.2.498.33012328-public-signed.7z"
FILENAME "PhysXGpu.7z"
SHA512 b834d4e0ed7d015d33d03862e30ad8296974e605bd4de49d9cfa168958d8e3b67a9b52cc1f2169f25c32211e1880de1ff7f76edae4d4a1b1f12dc6d1873c2d8e
)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_find_acquire_program(7Z)
set(ENV{PM_PhysXGpu_PATH} "${CURRENT_BUILDTREES_DIR}/PhysXGpu_dep")
file(MAKE_DIRECTORY "$ENV{PM_PhysXGpu_PATH}")
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_PhysXGpu_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_PhysXGpu_PATH}"
LOGNAME "extract-PhysXGpu"
)
else()
vcpkg_extract_source_archive(PHYSXGPU_SOURCE_PATH
NO_REMOVE_ONE_LEVEL
ARCHIVE "${ARCHIVE}"
BASE_DIRECTORY PhysXGpu_dep
)
set(ENV{PM_PhysXGpu_PATH} "${PHYSXGPU_SOURCE_PATH}")
endif()
message(STATUS "Extracted dependency to $ENV{PM_PhysXGpu_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_PhysXGpu_PATH})
set(OPTIONS_RELEASE
"-DPX_OUTPUT_BIN_DIR=${CURRENT_PACKAGES_DIR}"
"-DPX_OUTPUT_LIB_DIR=${CURRENT_PACKAGES_DIR}"
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/PhysXDevice%4018.12.7.4.7z"
FILENAME "PhysXDevice.7z"
SHA512 c20eb2f1e0dcb9d692cb718ca7e3a332291e72a09614f37080f101e5ebc1591033029f0f1e6fba33a17d4c9f59f13e561f3fc81cee34cd53d50b579c01dd3f3c
)
set(OPTIONS_DEBUG
"-DPX_OUTPUT_BIN_DIR=${CURRENT_PACKAGES_DIR}/debug"
"-DPX_OUTPUT_LIB_DIR=${CURRENT_PACKAGES_DIR}/debug"
"-DNV_USE_DEBUG_WINCRT=ON"
)
if(VCPKG_TARGET_IS_UWP)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=uwp")
set(configure_options WINDOWS_USE_MSBUILD)
elseif(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=windows")
elseif(VCPKG_TARGET_IS_OSX)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=mac")
elseif(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_FREEBSD)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=linux")
elseif(VCPKG_TARGET_IS_ANDROID)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=android")
if(VCPKG_TARGET_IS_WINDOWS)
set(ENV{PM_PhysXDevice_PATH} "${CURRENT_BUILDTREES_DIR}/PhysXDevice_dep")
file(MAKE_DIRECTORY "$ENV{PM_PhysXDevice_PATH}")
vcpkg_find_acquire_program(7Z)
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_PhysXDevice_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_PhysXDevice_PATH}"
LOGNAME "extract-PhysXDevice"
)
else()
message(FATAL_ERROR "Unhandled or unsupported target platform.")
vcpkg_extract_source_archive(PHYSXDEVICE_SOURCE_PATH
NO_REMOVE_ONE_LEVEL
ARCHIVE "${ARCHIVE}"
BASE_DIRECTORY PhysXDevice_dep
)
set(ENV{PM_PhysXDevice_PATH} "${PHYSXDEVICE_SOURCE_PATH}")
endif()
message(STATUS "Extracted dependency to $ENV{PM_PhysXDevice_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_PhysXDevice_PATH})
if(targetPlatform STREQUAL "vc17win64")
set(ENV{PM_freeglut_PATH} "${CURRENT_BUILDTREES_DIR}/freeglut_dep")
file(MAKE_DIRECTORY "$ENV{PM_freeglut_PATH}")
vcpkg_download_distfile(ARCHIVE
URLS "https://d4i3qtqj3r0z5.cloudfront.net/freeglut-windows%403.4_1.1.7z"
FILENAME "freeglut.7z"
SHA512 c01cb75dd466d6889a72d7236669bfce841cc6da9e0edb4208c4affb5ca939f28d64bc3d988bc85d98c589b0b42ac3464f606c89f6c113106669fc9fe84000e5
)
vcpkg_find_acquire_program(7Z)
vcpkg_execute_required_process(
COMMAND "${7Z}" x "${ARCHIVE}" "-o$ENV{PM_freeglut_PATH}" "-y" "-bso0" "-bsp0"
WORKING_DIRECTORY "$ENV{PM_freeglut_PATH}"
LOGNAME "extract-freeglut"
)
message(STATUS "Extracted dependency to $ENV{PM_freeglut_PATH}")
list(APPEND ENV{PM_PATHS} $ENV{PM_freeglut_PATH})
endif()
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
list(APPEND OPTIONS "-DNV_FORCE_64BIT_SUFFIX=ON" "-DNV_FORCE_32BIT_SUFFIX=OFF")
######################## Now generate ALL cmake parameters according to our distribution ##############################
set(PHYSX_ROOT_DIR "${SOURCE_PATH}/physx")
# Set common parameters
set(common_params -DCMAKE_PREFIX_PATH=$ENV{PM_PATHS} -DPHYSX_ROOT_DIR=${PHYSX_ROOT_DIR} -DPX_OUTPUT_LIB_DIR=${PHYSX_ROOT_DIR} -DPX_OUTPUT_BIN_DIR=${PHYSX_ROOT_DIR})
# Set platform and compiler specific parameters
if(targetPlatform STREQUAL "linuxAarch64")
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/linux-aarch64/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=linux -DPX_OUTPUT_ARCH=arm)
elseif(targetPlatform STREQUAL "linux")
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/linux/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=linux -DPX_OUTPUT_ARCH=x86)
elseif(targetPlatform STREQUAL "vc17win64") # Again: this will work for any Win64
set(cmakeParams -DCMAKE_INSTALL_PREFIX=${PHYSX_ROOT_DIR}/install/vc17win64/PhysX)
set(platformCMakeParams -DTARGET_BUILD_PLATFORM=windows -DPX_OUTPUT_ARCH=x86)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
list(APPEND OPTIONS "-DPX_GENERATE_STATIC_LIBRARIES=OFF")
else()
list(APPEND OPTIONS "-DPX_GENERATE_STATIC_LIBRARIES=ON")
# Also make sure the packman-downloaded GPU driver is found as a binary
list(APPEND platformCMakeParams -DPHYSX_PHYSXGPU_PATH=${PM_PhysXGpu_PATH}/bin)
# Anyway the above only works for clang, see
# source/compiler/cmake/linux/CMakeLists.txt:164
# to avoid problems, we copy _immediately_ the extra binaries
if(targetPlatform STREQUAL "linuxAarch64")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.aarch64/checked/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.aarch64/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.aarch64/release/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.aarch64/release")
elseif(targetPlatform STREQUAL "linux")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.clang/checked/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.clang/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/linux.clang/release/libPhysXGpu_64.so" DESTINATION "${SOURCE_PATH}/physx/bin/linux.clang/release")
elseif(targetPlatform STREQUAL "vc17win64")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/win.x86_64.vc141.mt/checked/PhysXGpu_64.dll" DESTINATION "${SOURCE_PATH}/physx/bin/vc17win64/debug")
file(COPY "$ENV{PM_PhysXGpu_PATH}/bin/win.x86_64.vc141.mt/release/PhysXGpu_64.dll" DESTINATION "${SOURCE_PATH}/physx/bin/vc17win64/release")
endif()
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
list(APPEND OPTIONS "-DNV_USE_STATIC_WINCRT=OFF")
else()
list(APPEND OPTIONS "-DNV_USE_STATIC_WINCRT=ON")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
list(APPEND OPTIONS "-DPX_OUTPUT_ARCH=arm")
else()
list(APPEND OPTIONS "-DPX_OUTPUT_ARCH=x86")
endif()
set(cmakeParams ${platformCMakeParams} ${common_params} ${cmakeParams})
# Finally invoke cmake to configure the PhysX project
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/physx/compiler/public"
${configure_options}
GENERATOR "${generator}"
WINDOWS_USE_MSBUILD
OPTIONS
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}
${PLATFORM_OPTIONS}
-DPHYSX_ROOT_DIR=${PHYSX_ROOT_DIR}
${cmakeParams}
OPTIONS_DEBUG
-DNV_USE_DEBUG_WINCRT=TRUE
DISABLE_PARALLEL_CONFIGURE
OPTIONS ${OPTIONS}
OPTIONS_DEBUG ${OPTIONS_DEBUG}
OPTIONS_RELEASE ${OPTIONS_RELEASE}
MAYBE_UNUSED_VARIABLES
PX_OUTPUT_ARCH
PHYSX_PHYSXGPU_PATH
)
# Compile and install in vcpkg's final installation directories all of the include headers and binaries for debug/release
vcpkg_cmake_install()
# NVIDIA Gameworks release structure is generally something like <compiler>/<configuration>/[artifact]
# It would be nice to patch this out, but that directory structure is hardcoded over many cmake files.
# So, we have this helpful helper to copy the bins and libs out.
function(fixup_physx_artifacts)
macro(_fixup _IN_DIRECTORY _OUT_DIRECTORY)
######################## Extract to final vcpkg install locations and fixup artifacts in wrong dirs ##############################
message("[PHYSX BUILD COMPLETED] Extracting build artifacts to vcpkg installation locations..")
# Artifacts paths are similar to <compiler>/<configuration>/[artifact] however vcpkg expects
# libraries, binaries and headers to be respectively in ${CURRENT_PACKAGES_DIR}/lib or ${CURRENT_PACKAGES_DIR}/debug/lib,
# ${CURRENT_PACKAGES_DIR}/bin or ${CURRENT_PACKAGES_DIR}/debug/bin and ${CURRENT_PACKAGES_DIR}/include.
# This function accepts a DIRECTORY named variable specifying the 'lib' or 'bin' destination directory and a SUFFIXES named
# variable which specifies a list of suffixes to extract in that folder (e.g. all the .lib or .pdb)
function(copy_in_vcpkg_destination_folder_physx_artifacts)
macro(_copy_up _IN_DIRECTORY _OUT_DIRECTORY)
foreach(_SUFFIX IN LISTS _fpa_SUFFIXES)
file(GLOB_RECURSE _ARTIFACTS
LIST_DIRECTORIES false
"${CURRENT_PACKAGES_DIR}/${_IN_DIRECTORY}/*${_SUFFIX}"
"${SOURCE_PATH}/physx/${_IN_DIRECTORY}/*${_SUFFIX}"
)
if(_ARTIFACTS)
file(COPY ${_ARTIFACTS} DESTINATION "${CURRENT_PACKAGES_DIR}/${_OUT_DIRECTORY}")
@ -126,40 +215,97 @@ function(fixup_physx_artifacts)
endmacro()
cmake_parse_arguments(_fpa "" "DIRECTORY" "SUFFIXES" ${ARGN})
_fixup("bin" ${_fpa_DIRECTORY})
_fixup("debug/bin" "debug/${_fpa_DIRECTORY}")
_copy_up("bin/*/release" "${_fpa_DIRECTORY}") # could be physx/bin/linux.clang/release or physx/bin/win.x86_64.vc142.mt/release
_copy_up("bin/*/debug" "debug/${_fpa_DIRECTORY}")
endfunction()
fixup_physx_artifacts(
# Create output directories
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib")
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Packman also downloads the Gpu driver shared library, so we'll place it in bin and debug/bin
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
copy_in_vcpkg_destination_folder_physx_artifacts(
DIRECTORY "lib"
SUFFIXES ${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX} ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}
)
fixup_physx_artifacts(
DIRECTORY "bin"
SUFFIXES ${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX} ".pdb"
)
# Remove compiler directory and descendents.
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/bin/"
"${CURRENT_PACKAGES_DIR}/debug/bin/"
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Also copy whatever .so/.dll were built. Remember that there should be NO /bin directory (nor debug/bin)
# when using static linkage
copy_in_vcpkg_destination_folder_physx_artifacts(
DIRECTORY "bin"
SUFFIXES ${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX} ".pdb"
)
else()
file(GLOB PHYSX_ARTIFACTS LIST_DIRECTORIES true
"${CURRENT_PACKAGES_DIR}/bin/*"
"${CURRENT_PACKAGES_DIR}/debug/bin/*"
)
foreach(_ARTIFACT IN LISTS PHYSX_ARTIFACTS)
if(IS_DIRECTORY ${_ARTIFACT})
file(REMOVE_RECURSE ${_ARTIFACT})
endif()
endforeach()
endif()
# Special treatment is reserved for the PhysXGpu_64 shared library (downloaded by packman).
# This is a 3rd party "optional functionality" dependency.
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools")
set(GPULIBNAMES "")
if(targetPlatform STREQUAL "linuxAarch64" OR targetPlatform STREQUAL "linux")
list(APPEND GPULIBNAMES "libPhysXGpu_64.so" "libPhysXDevice64.so")
elseif(targetPlatform STREQUAL "vc17win64") # Again: this will work for any Win64
list(APPEND GPULIBNAMES "PhysXGpu_64.dll" "PhysXDevice64.dll")
endif()
function(_copy_single_files_from_dir_to_destdir _IN_FILES _IN_DIR _OUT_DIR)
file(GLOB_RECURSE _ARTIFACTS
LIST_DIRECTORIES false
"${_IN_DIR}"
)
foreach(_ARTIFACT IN LISTS _ARTIFACTS)
foreach(_FILE IN LISTS _IN_FILES)
if("${_ARTIFACT}" MATCHES "${_FILE}")
file(COPY "${_ARTIFACT}" DESTINATION "${_OUT_DIR}")
endif()
endforeach()
endforeach()
endfunction()
# Put it in binary directories, it's an optional component (only release binaries should go in tools/)
_copy_single_files_from_dir_to_destdir("${GPULIBNAMES}" "${SOURCE_PATH}/physx/bin/*/release/*" "${CURRENT_PACKAGES_DIR}/tools")
# Copy headers to port's destination folder
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
# Renaming trick to finally have final folder structure as ${CURRENT_PACKAGES_DIR}/include/physx
file(RENAME "${SOURCE_PATH}/physx/include" "${SOURCE_PATH}/physx/physx")
file(COPY "${SOURCE_PATH}/physx/physx" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
# Remove useless build directories
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/source"
"${CURRENT_PACKAGES_DIR}/source"
)
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
# Install the cmake config that users will use, replace -if any- only @variables@
configure_file("${CMAKE_CURRENT_LIST_DIR}/omniverse-physx-sdk-config.cmake" "${CURRENT_PACKAGES_DIR}/share/omniverse-physx-sdk/unofficial-omniverse-physx-sdk-config.cmake" @ONLY)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/share")
file(COPY "${CURRENT_PACKAGES_DIR}/share/omniverse-physx-sdk" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/share/")
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-omniverse-physx-sdk
CONFIG_PATH share/omniverse-physx-sdk)
# Remove fixup wrong directories
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/share"
)
if(targetPlatform STREQUAL "vc17win64")
# Remove freeglut (cannot be skipped in public release builds, but unnecessary)
file(REMOVE
"${CURRENT_PACKAGES_DIR}/bin/freeglut.dll"
"${CURRENT_PACKAGES_DIR}/debug/bin/freeglutd.dll"
)
endif()
# Install license and usage file
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
message("[VCPKG Omniverse PhysX port execution completed]")

View File

@ -1,52 +0,0 @@
diff --git a/physx/source/compiler/cmake/android/CMakeLists.txt b/physx/source/compiler/cmake/android/CMakeLists.txt
index 06e0d98..2e5454d 100644
--- a/physx/source/compiler/cmake/android/CMakeLists.txt
+++ b/physx/source/compiler/cmake/android/CMakeLists.txt
@@ -52,6 +52,8 @@ SET(PHYSX_CXX_FLAGS_RELEASE "-O3 -g" CACHE INTERNAL "PhysX Release CXX Flags")
# These flags are local to the directory the CMakeLists.txt is in
+string(REPLACE " -Werror " " " PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}")
+set(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}" CACHE INTERNAL "PhysX CXX")
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG})
diff --git a/physx/source/compiler/cmake/ios/CMakeLists.txt b/physx/source/compiler/cmake/ios/CMakeLists.txt
index 5605e9a..b40500b 100644
--- a/physx/source/compiler/cmake/ios/CMakeLists.txt
+++ b/physx/source/compiler/cmake/ios/CMakeLists.txt
@@ -39,6 +39,8 @@ SET(PHYSX_CXX_FLAGS_PROFILE "-O3 -g" CACHE INTERNAL "PhysX Profile CXX Flags")
SET(PHYSX_CXX_FLAGS_RELEASE "-O3 -g" CACHE INTERNAL "PhysX Release CXX Flags")
# These flags are local to the directory the CMakeLists.txt is in
+string(REPLACE " -Werror " " " PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}")
+set(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}" CACHE INTERNAL "PhysX CXX")
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG})
diff --git a/physx/source/compiler/cmake/linux/CMakeLists.txt b/physx/source/compiler/cmake/linux/CMakeLists.txt
index aba5336..fd5f813 100644
--- a/physx/source/compiler/cmake/linux/CMakeLists.txt
+++ b/physx/source/compiler/cmake/linux/CMakeLists.txt
@@ -45,6 +45,8 @@ SET(PHYSX_CXX_FLAGS_PROFILE "-O3" CACHE INTERNAL "PhysX Profile CXX Flags")
SET(PHYSX_CXX_FLAGS_RELEASE "-O3" CACHE INTERNAL "PhysX Release CXX Flags")
# These flags are local to the directory the CMakeLists.txt is in, so don't get carried over to OTHER CMakeLists.txt (thus the CACHE variables above)
+string(REPLACE " -Werror " " " PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}")
+set(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}" CACHE INTERNAL "PhysX CXX")
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG})
diff --git a/physx/source/compiler/cmake/mac/CMakeLists.txt b/physx/source/compiler/cmake/mac/CMakeLists.txt
index bfd1357..cffb090 100644
--- a/physx/source/compiler/cmake/mac/CMakeLists.txt
+++ b/physx/source/compiler/cmake/mac/CMakeLists.txt
@@ -49,6 +49,8 @@ SET(PHYSX_CXX_FLAGS_PROFILE "-O3 -g" CACHE INTERNAL "PhysX Profile CXX Flags")
SET(PHYSX_CXX_FLAGS_RELEASE "-O3 -g" CACHE INTERNAL "PhysX Release CXX Flags")
# These flags are local to the directory the CMakeLists.txt is in
+string(REPLACE " -Werror " " " PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}")
+set(PHYSX_CXX_FLAGS "${PHYSX_CXX_FLAGS}" CACHE INTERNAL "PhysX CXX")
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG})

View File

@ -1,5 +1,5 @@
[Sample port usage]
omniverse-physx-sdk provides CMake targets:
physx provides CMake targets:
cmake_minimum_required(VERSION 3.15)

View File

@ -1,15 +1,22 @@
{
"name": "physx",
"version": "4.1.2",
"port-version": 6,
"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",
"homepage": "https://github.com/NVIDIAGameWorks/PhysX",
"license": null,
"supports": "!mingw & !(windows & arm)",
"version": "5.2.1",
"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. This is the latest NVIDIA official version of the PhysX engine which also directly integrates into Omniverse. This port is NOT officially supported by NVIDIA.",
"homepage": "https://github.com/NVIDIA-Omniverse/PhysX",
"license": "BSD-3-Clause",
"supports": "(windows & x64 & !mingw & !uwp) | (linux & x64) | (linux & arm64)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true
}
]
}

View File

@ -5872,10 +5872,6 @@
"baseline": "4.3.0",
"port-version": 1
},
"omniverse-physx-sdk": {
"baseline": "5.2.1",
"port-version": 0
},
"ompl": {
"baseline": "1.5.1",
"port-version": 5
@ -6297,8 +6293,8 @@
"port-version": 1
},
"physx": {
"baseline": "4.1.2",
"port-version": 6
"baseline": "5.2.1",
"port-version": 0
},
"picojson": {
"baseline": "1.3.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "9663323fd4b0d5ff6623bad944b8f60ea2455821",
"version": "5.2.1",
"port-version": 0
},
{
"git-tree": "038801f9419a356c7082b1501620bdef60da6d66",
"version": "4.1.2",