Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 205 additions & 0 deletions ports/physx/fix-mac-arm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
diff --git a/externals/cmakemodules/GetCompilerAndPlatform.cmake b/externals/cmakemodules/GetCompilerAndPlatform.cmake
index 3ab5cfbfa..ace464b01 100644
--- a/externals/cmakemodules/GetCompilerAndPlatform.cmake
+++ b/externals/cmakemodules/GetCompilerAndPlatform.cmake
@@ -103,7 +103,13 @@ FUNCTION (GetPlatformBinName PLATFORM_BIN_NAME LIBPATH_SUFFIX)
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "uwp")
SET(RETVAL "uwp.${PX_OUTPUT_ARCH}_${LIBPATH_SUFFIX}.${COMPILER}")
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "mac")
- SET(RETVAL "mac.x86_${LIBPATH_SUFFIX}")
+ IF(PX_OUTPUT_ARCH STREQUAL "x86")
+ SET(RETVAL "mac.x86_${LIBPATH_SUFFIX}")
+ ELSEIF(PX_OUTPUT_ARCH STREQUAL "arm")
+ SET(RETVAL "mac.arm_${LIBPATH_SUFFIX}")
+ ELSE()
+ SET(RETVAL "mac.universal")
+ ENDIF()
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "ios")
SET(RETVAL "ios.arm_${LIBPATH_SUFFIX}")
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "ps4")
diff --git a/externals/cmakemodules/NvidiaBuildOptions.cmake b/externals/cmakemodules/NvidiaBuildOptions.cmake
index 46cb7d637..8ca7cbe97 100644
--- a/externals/cmakemodules/NvidiaBuildOptions.cmake
+++ b/externals/cmakemodules/NvidiaBuildOptions.cmake
@@ -102,7 +102,8 @@ IF(NV_USE_GAMEWORKS_OUTPUT_DIRS)
SET(PX_ROOT_LIB_DIR "bin/${PLATFORM_BIN_NAME}" CACHE INTERNAL "Relative root of the lib output directory")
SET(PX_ROOT_EXE_DIR "bin/${PLATFORM_BIN_NAME}" CACHE INTERNAL "Relative root dir of the exe output directory")

- IF (NOT DEFINED PX_OUTPUT_ARCH) # platforms with fixed arch like ps4 dont need to have arch defined
+ # platforms with fixed arch like ps4 dont need to have arch defined
+ IF (NOT DEFINED PX_OUTPUT_ARCH AND NOT (NV_FORCE_64BIT_SUFFIX OR NV_FORCE_32BIT_SUFFIX))
SET(EXE_SUFFIX "")
ENDIF()

@@ -201,7 +202,8 @@ IF(NV_APPEND_CONFIG_NAME)
SET(CMAKE_CHECKED_POSTFIX "CHECKED_${LIBPATH_SUFFIX}")
SET(CMAKE_RELEASE_POSTFIX "_${LIBPATH_SUFFIX}")
ELSE()
- IF (DEFINED PX_OUTPUT_ARCH) # platforms with fixed arch like ps4 dont need to have arch defined, then dont add bitness
+ # platforms with fixed arch like ps4 dont need to have arch defined, then dont add bitness
+ IF (DEFINED PX_OUTPUT_ARCH OR NV_FORCE_64BIT_SUFFIX OR NV_FORCE_32BIT_SUFFIX)
SET(CMAKE_DEBUG_POSTFIX "_${LIBPATH_SUFFIX}")
SET(CMAKE_PROFILE_POSTFIX "_${LIBPATH_SUFFIX}")
SET(CMAKE_CHECKED_POSTFIX "_${LIBPATH_SUFFIX}")
diff --git a/physx/source/compiler/cmake/mac/CMakeLists.txt b/physx/source/compiler/cmake/mac/CMakeLists.txt
index 36799700b..bfd135769 100644
--- a/physx/source/compiler/cmake/mac/CMakeLists.txt
+++ b/physx/source/compiler/cmake/mac/CMakeLists.txt
@@ -25,10 +25,18 @@
##
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.

-SET(OSX_BITNESS "-arch x86_64")
-SET(CMAKE_OSX_ARCHITECTURES "x86_64")
+IF(PX_OUTPUT_ARCH STREQUAL "x86")
+ SET(OSX_BITNESS "-arch x86_64 -msse2")
+ SET(CMAKE_OSX_ARCHITECTURES "x86_64")
+ELSEIF(PX_OUTPUT_ARCH STREQUAL "arm")
+ SET(OSX_BITNESS "-arch arm64")
+ SET(CMAKE_OSX_ARCHITECTURES "arm64")
+ELSE()
+ SET(OSX_BITNESS "-arch x86_64 -arch arm64 -msse2")
+ SET(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
+ENDIF()

-SET(PHYSX_CXX_FLAGS "${OSX_BITNESS} -msse2 -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-unknown-warning-option -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-reinterpret-cast -Wno-invalid-offsetof -Wno-zero-as-null-pointer-constant -Wno-atomic-implicit-seq-cst -gdwarf-2" CACHE INTERNAL "PhysX CXX")
Comment thread
Hoikas marked this conversation as resolved.
Outdated
+SET(PHYSX_CXX_FLAGS "${OSX_BITNESS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-unknown-warning-option -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-reinterpret-cast -Wno-invalid-offsetof -Wno-zero-as-null-pointer-constant -Wno-atomic-implicit-seq-cst -gdwarf-2" CACHE INTERNAL "PhysX CXX")

SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "")
diff --git a/physx/source/foundation/include/PsVecMath.h b/physx/source/foundation/include/PsVecMath.h
index 2718de2a8..03949acb1 100644
--- a/physx/source/foundation/include/PsVecMath.h
+++ b/physx/source/foundation/include/PsVecMath.h
@@ -56,6 +56,8 @@
#define COMPILE_VECTOR_INTRINSICS 1
#elif PX_IOS && PX_NEON
#define COMPILE_VECTOR_INTRINSICS 1
+#elif PX_OSX && PX_NEON
+#define COMPILE_VECTOR_INTRINSICS 1
#elif PX_SWITCH
#define COMPILE_VECTOR_INTRINSICS 1
#else
diff --git a/physx/source/foundation/src/unix/PsUnixFPU.cpp b/physx/source/foundation/src/unix/PsUnixFPU.cpp
index eb2cd0506..5a223a107 100644
--- a/physx/source/foundation/src/unix/PsUnixFPU.cpp
+++ b/physx/source/foundation/src/unix/PsUnixFPU.cpp
@@ -33,7 +33,7 @@
PX_COMPILE_TIME_ASSERT(8 * sizeof(uint32_t) >= sizeof(fenv_t));
#endif

-#if PX_OSX
+#if PX_OSX && (PX_X86 || PX_X64)
// osx defines SIMD as standard for floating point operations.
#include <xmmintrin.h>
#endif
@@ -47,7 +47,7 @@ physx::shdfnd::FPUGuard::FPUGuard()
#elif PX_PS4
// not supported
PX_UNUSED(mControlWords);
-#elif PX_OSX
+#elif PX_OSX && (PX_X86 || PX_X64)
mControlWords[0] = _mm_getcsr();
// set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6))
_mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6));
@@ -76,7 +76,7 @@ physx::shdfnd::FPUGuard::~FPUGuard()
// not supported unless ARM_HARD_FLOAT is enabled.
#elif PX_PS4
// not supported
-#elif PX_OSX
+#elif PX_OSX && (PX_X86 || PX_X64)
// restore control word and clear exception flags
// (setting exception state flags cause exceptions on the first following fp operation)
_mm_setcsr(mControlWords[0] & ~_MM_EXCEPT_MASK);
@@ -92,7 +92,7 @@ PX_FOUNDATION_API void physx::shdfnd::enableFPExceptions()
#if PX_LINUX && !defined(__EMSCRIPTEN__)
feclearexcept(FE_ALL_EXCEPT);
feenableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
-#elif PX_OSX
+#elif PX_OSX && (PX_X86 || PX_X64)
// clear any pending exceptions
// (setting exception state flags cause exceptions on the first following fp operation)
uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK;
@@ -108,7 +108,7 @@ PX_FOUNDATION_API void physx::shdfnd::disableFPExceptions()
{
#if PX_LINUX && !defined(__EMSCRIPTEN__)
fedisableexcept(FE_ALL_EXCEPT);
-#elif PX_OSX
+#elif PX_OSX && (PX_X86 || PX_X64)
// clear any pending exceptions
// (setting exception state flags cause exceptions on the first following fp operation)
uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK;
diff --git a/physx/source/geomutils/include/GuSIMDHelpers.h b/physx/source/geomutils/include/GuSIMDHelpers.h
index caa8e5a6d..733eca34c 100644
--- a/physx/source/geomutils/include/GuSIMDHelpers.h
+++ b/physx/source/geomutils/include/GuSIMDHelpers.h
@@ -72,7 +72,7 @@ namespace Gu
const QuatV qV = V4LoadU(&q.x);
Vec3V column0V, column1V, column2V;
QuatGetMat33V(qV, column0V, column1V, column2V);
-#if defined(PX_SIMD_DISABLED) || PX_ANDROID || (PX_LINUX && (PX_ARM || PX_A64)) || (PX_UWP && (PX_ARM || PX_A64))
+#if defined(PX_SIMD_DISABLED) || PX_ANDROID || (PX_LINUX && (PX_ARM || PX_A64)) || (PX_UWP && (PX_ARM || PX_A64)) || (PX_OSX && PX_A64)
V3StoreU(column0V, column0);
V3StoreU(column1V, column1);
V3StoreU(column2V, column2);
diff --git a/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp b/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp
index 282b9810b..6fdfd8f66 100644
--- a/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp
+++ b/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp
@@ -39,7 +39,7 @@ using namespace physx;
namespace
{

-#define SN_NUM_BINARY_PLATFORMS 16
+#define SN_NUM_BINARY_PLATFORMS 17
const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] =
{
PX_MAKE_FOURCC('W','_','3','2'),
@@ -58,6 +58,7 @@ const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] =
PX_MAKE_FOURCC('L','A','6','4'),
PX_MAKE_FOURCC('W','A','3','2'),
PX_MAKE_FOURCC('W','A','6','4'),
+ PX_MAKE_FOURCC('M','A','6','4'),
};

const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] =
@@ -78,6 +79,7 @@ const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] =
"linuxaarch64",
"uwparm",
"uwparm64",
+ "macaarch64"
};

}
@@ -118,6 +120,8 @@ PxU32 getBinaryPlatformTag()
return sBinaryPlatformTags[14];
#elif PX_UWP && PX_A64
return sBinaryPlatformTags[15];
+#elif PX_OSX && PX_A64
+ return sBinaryPlatformTags[16];
#else
#error Unknown binary platform
#endif
diff --git a/pxshared/include/foundation/PxPreprocessor.h b/pxshared/include/foundation/PxPreprocessor.h
index 12d6147f1..4a7d0e93c 100644
--- a/pxshared/include/foundation/PxPreprocessor.h
+++ b/pxshared/include/foundation/PxPreprocessor.h
@@ -100,10 +100,15 @@ Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSyst
#define PX_ANDROID 1
#elif defined(__linux__) || defined (__EMSCRIPTEN__) // note: __ANDROID__ implies __linux__
#define PX_LINUX 1
-#elif defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
-#define PX_IOS 1
#elif defined(__APPLE__)
-#define PX_OSX 1
+ #include <TargetConditionals.h>
+ #if TARGET_OS_IPHONE && TARGET_OS_MACCATALYST
+ #define PX_OSX 1
+ #elif TARGET_OS_IPHONE
+ #define PX_IOS 1
+ #else
+ #define PX_OSX 1
+ #endif
#elif defined(__ORBIS__)
#define PX_PS4 1
#elif defined(__NX__)
1 change: 1 addition & 0 deletions ports/physx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vcpkg_from_github(
PATCHES
fix-compiler-flag.patch
remove-werror.patch
fix-mac-arm.patch
)

if(NOT DEFINED RELEASE_CONFIGURATION)
Expand Down
2 changes: 1 addition & 1 deletion ports/physx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "physx",
"version": "4.1.2",
"port-version": 3,
"port-version": 4,
"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,
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5430,7 +5430,7 @@
},
"physx": {
"baseline": "4.1.2",
"port-version": 3
"port-version": 4
},
"picojson": {
"baseline": "1.3.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/physx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bb279a90b2ea0a7ebc7468ddcfbab22f39f4d304",
"version": "4.1.2",
"port-version": 4
},
{
"git-tree": "304769b6a45107c9a8abf12fad9b9d82bac22c3b",
"version": "4.1.2",
Expand Down