From 2f427c795fcfb9f4d8fab4157eca6f316166be65 Mon Sep 17 00:00:00 2001 From: moraaar Date: Fri, 18 Nov 2022 20:16:36 +0000 Subject: [PATCH 1/6] Android platform support for PhysX 5.1 Signed-off-by: moraaar --- physx/.gitignore | 2 + physx/buildtools/cmake_generate_projects.py | 26 +++- .../presets/public/android-arm64-v8a.xml | 13 ++ physx/include/foundation/PxAlloca.h | 2 +- physx/include/foundation/PxIntrinsics.h | 2 +- physx/include/foundation/PxMathIntrinsics.h | 2 +- physx/include/foundation/PxPreprocessor.h | 13 +- physx/include/foundation/PxThread.h | 2 +- physx/include/foundation/PxTime.h | 4 +- physx/include/foundation/PxUtilities.h | 2 + physx/include/foundation/PxVecMath.h | 2 + .../foundation/unix/PxUnixIntrinsics.h | 21 ++- .../foundation/unix/PxUnixMathIntrinsics.h | 2 +- .../unix/neon/PxUnixNeonInlineAoS.h | 8 +- physx/snippets/compiler/cmake/CMakeLists.txt | 2 +- .../compiler/cmake/PhysXExtensions.cmake | 4 +- .../compiler/cmake/android/CMakeLists.txt | 122 ++++++++++++++++++ .../compiler/cmake/android/FastXml.cmake | 41 ++++++ .../compiler/cmake/android/LowLevel.cmake | 52 ++++++++ .../compiler/cmake/android/LowLevelAABB.cmake | 51 ++++++++ .../cmake/android/LowLevelDynamics.cmake | 48 +++++++ .../source/compiler/cmake/android/PhysX.cmake | 67 ++++++++++ .../android/PhysXCharacterKinematic.cmake | 43 ++++++ .../compiler/cmake/android/PhysXCommon.cmake | 69 ++++++++++ .../compiler/cmake/android/PhysXCooking.cmake | 60 +++++++++ .../cmake/android/PhysXExtensions.cmake | 53 ++++++++ .../cmake/android/PhysXFoundation.cmake | 91 +++++++++++++ .../compiler/cmake/android/PhysXPvdSDK.cmake | 41 ++++++ .../compiler/cmake/android/PhysXTask.cmake | 41 ++++++ .../compiler/cmake/android/PhysXVehicle.cmake | 42 ++++++ .../cmake/android/PhysXVehicle2.cmake | 42 ++++++ .../compiler/cmake/android/SceneQuery.cmake | 46 +++++++ .../cmake/android/SimulationController.cmake | 47 +++++++ physx/source/foundation/unix/FdUnixFPU.cpp | 6 +- .../foundation/unix/FdUnixPrintString.cpp | 8 ++ physx/source/foundation/unix/FdUnixThread.cpp | 26 +++- .../src/serialization/SnSerialUtils.cpp | 10 +- .../include/PxVehicleMetaDataObjects.h | 4 +- .../pvd/include/PxProfileAllocatorWrapper.h | 2 +- 39 files changed, 1090 insertions(+), 29 deletions(-) create mode 100644 physx/buildtools/presets/public/android-arm64-v8a.xml create mode 100644 physx/source/compiler/cmake/android/CMakeLists.txt create mode 100644 physx/source/compiler/cmake/android/FastXml.cmake create mode 100644 physx/source/compiler/cmake/android/LowLevel.cmake create mode 100644 physx/source/compiler/cmake/android/LowLevelAABB.cmake create mode 100644 physx/source/compiler/cmake/android/LowLevelDynamics.cmake create mode 100644 physx/source/compiler/cmake/android/PhysX.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXCharacterKinematic.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXCommon.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXCooking.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXExtensions.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXFoundation.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXPvdSDK.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXTask.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXVehicle.cmake create mode 100644 physx/source/compiler/cmake/android/PhysXVehicle2.cmake create mode 100644 physx/source/compiler/cmake/android/SceneQuery.cmake create mode 100644 physx/source/compiler/cmake/android/SimulationController.cmake diff --git a/physx/.gitignore b/physx/.gitignore index dc0d38c20..56e9b539d 100644 --- a/physx/.gitignore +++ b/physx/.gitignore @@ -1,4 +1,6 @@ bin/ compiler/linux-* compiler/vc* +compiler/android* include/PxConfig.h +install/ \ No newline at end of file diff --git a/physx/buildtools/cmake_generate_projects.py b/physx/buildtools/cmake_generate_projects.py index de9114de5..e43ad5792 100644 --- a/physx/buildtools/cmake_generate_projects.py +++ b/physx/buildtools/cmake_generate_projects.py @@ -20,7 +20,7 @@ def cmakeExt(): def filterPreset(presetName): - winPresetFilter = ['win','switch','crosscompile'] + winPresetFilter = ['win','switch','crosscompile','android'] if sys.platform == 'win32': if any(presetName.find(elem) != -1 for elem in winPresetFilter): return True @@ -101,6 +101,10 @@ def __init__(self, presetName): cmParam = '-D' + cmakeParam.attrib['name'] + '=\"' + \ os.environ['PHYSX_ROOT_DIR'] + '/' + \ cmakeParam.attrib['value'] + '\"' + elif cmakeParam.attrib['name'] == 'ANDROID_ABI': + cmParam = '-D' + \ + cmakeParam.attrib['name'] + '=\"' + \ + cmakeParam.attrib['value'] + '\"' else: cmParam = '-D' + \ cmakeParam.attrib['name'] + '=' + \ @@ -113,6 +117,8 @@ def isMultiConfigPlatform(self): return False elif self.targetPlatform == 'linuxAarch64': return False + elif self.targetPlatform == 'android': + return False return True def getCMakeSwitches(self): @@ -152,6 +158,8 @@ def getPlatformCMakeParams(self): outString = outString + '-G \"Visual Studio 16 2019\"' elif self.compiler == 'xcode': outString = outString + '-G Xcode' + elif self.targetPlatform == 'android': + outString = outString + '-G \"MinGW Makefiles\"' elif self.targetPlatform == 'linux': outString = outString + '-G \"Unix Makefiles\"' elif self.targetPlatform == 'linuxAarch64': @@ -181,6 +189,22 @@ def getPlatformCMakeParams(self): '/switch/NX64Toolchain.txt' outString = outString + ' -DCMAKE_GENERATOR_PLATFORM=NX64' return outString + elif self.targetPlatform == 'android': + outString = outString + ' -DTARGET_BUILD_PLATFORM=android' + if os.environ.get('ANDROID_NDK_HOME') is None: + print('Please provide path to android NDK in environment variable ANDROID_NDK_HOME.') + exit(-1) + else: + outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \ + os.environ['ANDROID_NDK_HOME'] + \ + '/build/cmake/android.toolchain.cmake' + outString = outString + ' -DANDROID_STL=\"c++_static\"' + outString = outString + ' -DCM_ANDROID_FP=\"softfp\"' + outString = outString + ' -DANDROID_NDK=' + \ + os.environ['ANDROID_NDK_HOME'] + outString = outString + ' -DCMAKE_MAKE_PROGRAM=\"' + \ + os.environ['ANDROID_NDK_HOME'] + '\\prebuilt\\windows-x86_64\\bin\\make.exe\"' + return outString elif self.targetPlatform == 'linux': outString = outString + ' -DTARGET_BUILD_PLATFORM=linux' outString = outString + ' -DPX_OUTPUT_ARCH=x86' diff --git a/physx/buildtools/presets/public/android-arm64-v8a.xml b/physx/buildtools/presets/public/android-arm64-v8a.xml new file mode 100644 index 000000000..d9611259f --- /dev/null +++ b/physx/buildtools/presets/public/android-arm64-v8a.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/physx/include/foundation/PxAlloca.h b/physx/include/foundation/PxAlloca.h index 5f037e2dd..bc64124d0 100644 --- a/physx/include/foundation/PxAlloca.h +++ b/physx/include/foundation/PxAlloca.h @@ -62,7 +62,7 @@ class PxScopedPointer : private Alloc #if PX_WINDOWS_FAMILY #include #define PxAlloca(x) _alloca(x) -#elif PX_LINUX +#elif PX_LINUX || PX_ANDROID #include #define PxAlloca(x) alloca(x) #elif PX_APPLE_FAMILY diff --git a/physx/include/foundation/PxIntrinsics.h b/physx/include/foundation/PxIntrinsics.h index 8d09c2644..179bb8162 100644 --- a/physx/include/foundation/PxIntrinsics.h +++ b/physx/include/foundation/PxIntrinsics.h @@ -33,7 +33,7 @@ #if PX_WINDOWS_FAMILY #include "windows/PxWindowsIntrinsics.h" -#elif(PX_LINUX || PX_APPLE_FAMILY) +#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY) #include "unix/PxUnixIntrinsics.h" #elif PX_SWITCH #include "switch/PxSwitchIntrinsics.h" diff --git a/physx/include/foundation/PxMathIntrinsics.h b/physx/include/foundation/PxMathIntrinsics.h index 1211b8e42..53ce64caf 100644 --- a/physx/include/foundation/PxMathIntrinsics.h +++ b/physx/include/foundation/PxMathIntrinsics.h @@ -33,7 +33,7 @@ #if PX_WINDOWS_FAMILY #include "foundation/windows/PxWindowsMathIntrinsics.h" -#elif(PX_LINUX || PX_APPLE_FAMILY) +#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY) #include "foundation/unix/PxUnixMathIntrinsics.h" #elif PX_SWITCH #include "foundation/switch/PxSwitchMathIntrinsics.h" diff --git a/physx/include/foundation/PxPreprocessor.h b/physx/include/foundation/PxPreprocessor.h index e2b644c0d..f5d0df2f2 100644 --- a/physx/include/foundation/PxPreprocessor.h +++ b/physx/include/foundation/PxPreprocessor.h @@ -95,7 +95,9 @@ Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSyst #define PX_WIN64 1 #elif defined(_WIN32) // note: _M_PPC implies _WIN32 #define PX_WIN32 1 -#elif defined(__linux__) || defined (__EMSCRIPTEN__) +#elif defined(__ANDROID__) + #define PX_ANDROID 1 +#elif defined(__linux__) || defined (__EMSCRIPTEN__) // note: __ANDROID__ implies __linux__ #define PX_LINUX 1 #elif defined(__APPLE__) #define PX_OSX 1 @@ -155,6 +157,9 @@ define anything not defined on this platform to 0 #ifndef PX_WIN32 #define PX_WIN32 0 #endif +#ifndef PX_ANDROID + #define PX_ANDROID 0 +#endif #ifndef PX_LINUX #define PX_LINUX 0 #endif @@ -218,7 +223,7 @@ family shortcuts #define PX_GCC_FAMILY (PX_CLANG || PX_GCC) // os #define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64) -#define PX_LINUX_FAMILY PX_LINUX +#define PX_LINUX_FAMILY (PX_LINUX || PX_ANDROID) #define PX_APPLE_FAMILY PX_OSX // equivalent to #if __APPLE__ #define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY) // shortcut for unix/posix platforms #if defined(__EMSCRIPTEN__) @@ -461,7 +466,7 @@ PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const&) char _; long a; }; -#elif PX_CLANG && PX_ARM +#elif PX_ANDROID || (PX_CLANG && PX_ARM) struct PxPackValidation { char _; @@ -512,7 +517,7 @@ protected: \ #endif #ifndef PX_SUPPORT_EXTERN_TEMPLATE - #define PX_SUPPORT_EXTERN_TEMPLATE (PX_VC != 11) + #define PX_SUPPORT_EXTERN_TEMPLATE ((!PX_ANDROID) && (PX_VC != 11)) #else #define PX_SUPPORT_EXTERN_TEMPLATE 0 #endif diff --git a/physx/include/foundation/PxThread.h b/physx/include/foundation/PxThread.h index 0a1fd0c96..a38e4e4cf 100644 --- a/physx/include/foundation/PxThread.h +++ b/physx/include/foundation/PxThread.h @@ -36,7 +36,7 @@ #if PX_WINDOWS_FAMILY #define PxSpinLockPause() __asm pause -#elif PX_LINUX || PX_APPLE_FAMILY || PX_SWITCH +#elif PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_SWITCH #define PxSpinLockPause() asm("nop") #else #error "Platform not supported!" diff --git a/physx/include/foundation/PxTime.h b/physx/include/foundation/PxTime.h index 44a2352f4..199c46ad3 100644 --- a/physx/include/foundation/PxTime.h +++ b/physx/include/foundation/PxTime.h @@ -32,7 +32,7 @@ #include "foundation/PxSimpleTypes.h" #include "foundation/PxFoundationConfig.h" -#if PX_LINUX +#if PX_LINUX || PX_ANDROID #include #endif @@ -83,7 +83,7 @@ class PX_FOUNDATION_API PxTime Second getLastTime() const; private: -#if PX_LINUX || PX_APPLE_FAMILY +#if PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY Second mLastTime; #else PxI64 mTickCount; diff --git a/physx/include/foundation/PxUtilities.h b/physx/include/foundation/PxUtilities.h index 48bfb0a20..79365b557 100644 --- a/physx/include/foundation/PxUtilities.h +++ b/physx/include/foundation/PxUtilities.h @@ -129,6 +129,8 @@ __attribute__((noreturn)) { #if PX_WINDOWS __debugbreak(); +#elif PX_ANDROID + raise(SIGTRAP); // works better than __builtin_trap. Proper call stack and can be continued. #elif PX_LINUX __builtin_trap(); #elif PX_GCC_FAMILY diff --git a/physx/include/foundation/PxVecMath.h b/physx/include/foundation/PxVecMath.h index 9f98f507f..a9df20d9a 100644 --- a/physx/include/foundation/PxVecMath.h +++ b/physx/include/foundation/PxVecMath.h @@ -49,6 +49,8 @@ #if !defined(PX_SIMD_DISABLED) #if PX_INTEL_FAMILY && (!defined(__EMSCRIPTEN__) || defined(__SSE2__)) #define COMPILE_VECTOR_INTRINSICS 1 +#elif PX_ANDROID && PX_NEON + #define COMPILE_VECTOR_INTRINSICS 1 #elif PX_SWITCH #define COMPILE_VECTOR_INTRINSICS 1 #else diff --git a/physx/include/foundation/unix/PxUnixIntrinsics.h b/physx/include/foundation/unix/PxUnixIntrinsics.h index 42b340f2a..3b5353fd0 100644 --- a/physx/include/foundation/unix/PxUnixIntrinsics.h +++ b/physx/include/foundation/unix/PxUnixIntrinsics.h @@ -32,10 +32,14 @@ #include "foundation/PxAssert.h" #include +#if PX_ANDROID +#include // for PxDebugBreak() { raise(SIGTRAP); } +#endif + // this file is for internal intrinsics - that is, intrinsics that are used in // cross platform code but do not appear in the API -#if !(PX_LINUX || PX_APPLE_FAMILY) +#if !(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY) #error "This file should only be included by unix builds!!" #endif @@ -88,6 +92,20 @@ PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) /*! Prefetch \c count bytes starting at \c ptr. */ +#if PX_ANDROID +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = static_cast(ptr); + size_t p = reinterpret_cast(ptr); + uint32_t startLine = uint32_t(p >> 5), endLine = uint32_t((p + count - 1) >> 5); + uint32_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 32; + } while(--lines); +} +#else PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) { const char* cp = reinterpret_cast(ptr); @@ -100,6 +118,7 @@ PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) cp += 64; } while(--lines); } +#endif #if !PX_DOXYGEN } // namespace physx diff --git a/physx/include/foundation/unix/PxUnixMathIntrinsics.h b/physx/include/foundation/unix/PxUnixMathIntrinsics.h index 044c0e57e..6dad058bf 100644 --- a/physx/include/foundation/unix/PxUnixMathIntrinsics.h +++ b/physx/include/foundation/unix/PxUnixMathIntrinsics.h @@ -32,7 +32,7 @@ #include "foundation/Px.h" #include "foundation/PxAssert.h" -#if !(PX_LINUX || PX_APPLE_FAMILY) +#if !(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY) #error "This file should only be included by Unix builds!!" #endif diff --git a/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h b/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h index 2fa177f4a..628000ed2 100644 --- a/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h +++ b/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h @@ -3530,9 +3530,13 @@ template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<3>(VecU32V a) { return vdu template PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) { - if(index < 2) + if(index == 0) + { + return vdupq_lane_f32(vget_low_f32(a), 0); + } + else if (index == 1) { - return vdupq_lane_f32(vget_low_f32(a), index); + return vdupq_lane_f32(vget_low_f32(a), 1); } else if(index == 2) { diff --git a/physx/snippets/compiler/cmake/CMakeLists.txt b/physx/snippets/compiler/cmake/CMakeLists.txt index b6af51eb8..b4f4ee85f 100644 --- a/physx/snippets/compiler/cmake/CMakeLists.txt +++ b/physx/snippets/compiler/cmake/CMakeLists.txt @@ -100,7 +100,7 @@ IF(NOT PUBLIC_RELEASE AND NOT PX_GENERATE_SOURCE_DISTRO) ENDIF() #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) LIST(APPEND SNIPPETS_LIST ${GPU_SNIPPET_LIST}) ENDIF() diff --git a/physx/source/compiler/cmake/PhysXExtensions.cmake b/physx/source/compiler/cmake/PhysXExtensions.cmake index 77d919e9a..e114d3dcf 100644 --- a/physx/source/compiler/cmake/PhysXExtensions.cmake +++ b/physx/source/compiler/cmake/PhysXExtensions.cmake @@ -78,7 +78,7 @@ SET(PHYSX_EXTENSIONS_SOURCE ) #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleExt.cpp") LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleClothCooker.cpp") ENDIF() @@ -199,7 +199,7 @@ SET(PHYSX_EXTENSIONS_HEADERS ) #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) LIST(APPEND PHYSX_EXTENSIONS_HEADERS "${PHYSX_ROOT_DIR}/include/extensions/PxParticleClothCooker.h") LIST(APPEND PHYSX_EXTENSIONS_HEADERS "${PHYSX_ROOT_DIR}/include/extensions/PxParticleExt.h") ENDIF() diff --git a/physx/source/compiler/cmake/android/CMakeLists.txt b/physx/source/compiler/cmake/android/CMakeLists.txt new file mode 100644 index 000000000..723dc84d3 --- /dev/null +++ b/physx/source/compiler/cmake/android/CMakeLists.txt @@ -0,0 +1,122 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# We define the CXX flags for this CMakeLists and all others that are included afterwards. This is a GLOBAL setting. +# If/when the solutions go standalone (say, samples and visual tests) - those CMakeLists will need to be fixed. + +STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) + +SET(PHYSX_WARNING_DISABLES "-Wno-invalid-offsetof -Wno-invalid-noreturn -Wno-unused-private-field -Wno-deprecated-copy -Wno-unused-variable -Wno-variadic-macros -Wno-array-bounds -Wno-strict-aliasing") + +IF(${ANDROID_ABI} STREQUAL "armeabi-v7a") + SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -fno-strict-aliasing -fstack-protector ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX") +ELSEIF(${ANDROID_ABI} STREQUAL "armeabi-v7a with NEON") + SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -fno-strict-aliasing -fstack-protector ${PHYSX_WARNING_DISABLES}" CACHE INTERNAL "PhysX CXX") +ELSEIF(${ANDROID_ABI} STREQUAL "arm64-v8a") + SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections ${PHYSX_WARNING_DISABLES} " CACHE INTERNAL "PhysX CXX") +ELSEIF(${ANDROID_ABI} STREQUAL "x86") + SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections ${PHYSX_WARNING_DISABLES} -fpack-struct=8 -malign-double " CACHE INTERNAL "PhysX CXX") +ELSEIF(${ANDROID_ABI} STREQUAL "x86_64") + SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections ${PHYSX_WARNING_DISABLES} -mstackrealign -msse3 " CACHE INTERNAL "PhysX CXX") +ENDIF() + +# Build debug info for all configurations +SET(PHYSX_CXX_FLAGS_DEBUG "-O0 -g" CACHE INTERNAL "PhysX Debug CXX Flags") +SET(PHYSX_CXX_FLAGS_CHECKED "-O3 -g" CACHE INTERNAL "PhysX Checked CXX Flags") +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 +SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS}) + +SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG}) +SET(CMAKE_CXX_FLAGS_CHECKED ${PHYSX_CXX_FLAGS_CHECKED}) +SET(CMAKE_CXX_FLAGS_PROFILE ${PHYSX_CXX_FLAGS_PROFILE}) +SET(CMAKE_CXX_FLAGS_RELEASE ${PHYSX_CXX_FLAGS_RELEASE}) + +IF(PUBLIC_RELEASE) + SET(PUBLIC_RELEASE_FLAG "PX_PUBLIC_RELEASE=1") +ELSE() + SET(PUBLIC_RELEASE_FLAG "PX_PUBLIC_RELEASE=0") +ENDIF() + +# Controls PX_NVTX for all projects +SET(NVTX_FLAG "PX_NVTX=0") + +IF(PX_SCALAR_MATH) + SET(SCALAR_MATH_FLAG "PX_SIMD_DISABLED") +ENDIF() + +# Disable cuda and dx for all projects on Android +SET(PX_SUPPORT_OMNI_PVD_FLAG "PX_SUPPORT_OMNI_PVD=0") +SET(PHYSX_ANDROID_COMPILE_DEFS "__STDC_LIMIT_MACROS;${SCALAR_MATH_FLAG};${PHYSX_AUTOBUILD};${PUBLIC_RELEASE_FLAG};${FEATURES_UNDER_CONSTRUCTION_FLAG}" CACHE INTERNAL "Base PhysX preprocessor definitions") +SET(PHYSX_ANDROID_DEBUG_COMPILE_DEFS "_DEBUG;PX_DEBUG=1;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1;${PX_SUPPORT_OMNI_PVD_FLAG}" CACHE INTERNAL "Debug PhysX preprocessor definitions") +SET(PHYSX_ANDROID_CHECKED_COMPILE_DEFS "NDEBUG;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1;${PX_SUPPORT_OMNI_PVD_FLAG}" CACHE INTERNAL "Checked PhysX preprocessor definitions") +SET(PHYSX_ANDROID_PROFILE_COMPILE_DEFS "NDEBUG;PX_PROFILE=1;${NVTX_FLAG};PX_SUPPORT_PVD=1;${PX_SUPPORT_OMNI_PVD_FLAG}" CACHE INTERNAL "Profile PhysX preprocessor definitions") +SET(PHYSX_ANDROID_RELEASE_COMPILE_DEFS "NDEBUG;PX_SUPPORT_PVD=0;PX_SUPPORT_OMNI_PVD=0" CACHE INTERNAL "Release PhysX preprocessor definitions") + +SET(CMAKE_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") +SET(CMAKE_PROFILE_POSTFIX "${CMAKE_PROFILE_POSTFIX}") +SET(CMAKE_CHECKED_POSTFIX "${CMAKE_CHECKED_POSTFIX}") +SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}") + + +# Include all of the projects +INCLUDE(PhysXFoundation.cmake) +INCLUDE(LowLevel.cmake) +INCLUDE(LowLevelAABB.cmake) +INCLUDE(LowLevelDynamics.cmake) +INCLUDE(PhysX.cmake) +INCLUDE(PhysXCharacterKinematic.cmake) +INCLUDE(PhysXCommon.cmake) +INCLUDE(PhysXCooking.cmake) +INCLUDE(PhysXExtensions.cmake) +INCLUDE(PhysXVehicle.cmake) +INCLUDE(PhysXVehicle2.cmake) +INCLUDE(PhysXPvdSDK.cmake) +INCLUDE(PhysXTask.cmake) +INCLUDE(SceneQuery.cmake) +INCLUDE(SimulationController.cmake) +INCLUDE(FastXml.cmake) + +# Set folder PhysX SDK to all common SDK source projects +SET_PROPERTY(TARGET PhysX PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXCharacterKinematic PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXCommon PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXCooking PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXExtensions PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXVehicle PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXVehicle2 PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET LowLevel PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET LowLevelAABB PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET LowLevelDynamics PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET SceneQuery PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET SimulationController PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET FastXml PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXPvdSDK PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXTask PROPERTY FOLDER "PhysX SDK") +SET_PROPERTY(TARGET PhysXFoundation PROPERTY FOLDER "PhysX SDK") \ No newline at end of file diff --git a/physx/source/compiler/cmake/android/FastXml.cmake b/physx/source/compiler/cmake/android/FastXml.cmake new file mode 100644 index 000000000..3a3fb8c72 --- /dev/null +++ b/physx/source/compiler/cmake/android/FastXml.cmake @@ -0,0 +1,41 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build FastXml +# + +SET(FASTXML_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS}; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(FASTXML_LIBTYPE OBJECT) \ No newline at end of file diff --git a/physx/source/compiler/cmake/android/LowLevel.cmake b/physx/source/compiler/cmake/android/LowLevel.cmake new file mode 100644 index 000000000..ad6e2e11c --- /dev/null +++ b/physx/source/compiler/cmake/android/LowLevel.cmake @@ -0,0 +1,52 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build LowLevel +# + +SET(LOWLEVEL_PLATFORM_INCLUDES + ${PHYSX_SOURCE_DIR}/Common/src/linux + ${PHYSX_SOURCE_DIR}/LowLevel/software/include/linux + ${PHYSX_SOURCE_DIR}/LowLevelDynamics/include/linux + ${PHYSX_SOURCE_DIR}/LowLevel/common/include/pipeline/linux +) + +SET(LOWLEVEL_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(LOWLEVEL_LIBTYPE OBJECT) + +SET(LOWLEVEL_PLATFORM_LINK_FLAGS "/MAP") + + diff --git a/physx/source/compiler/cmake/android/LowLevelAABB.cmake b/physx/source/compiler/cmake/android/LowLevelAABB.cmake new file mode 100644 index 000000000..05c42317c --- /dev/null +++ b/physx/source/compiler/cmake/android/LowLevelAABB.cmake @@ -0,0 +1,51 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build LowLevelAABB +# + + +SET(LOWLEVELAABB_PLATFORM_INCLUDES + ${PHYSX_SOURCE_DIR}/Common/src/linux + ${PHYSX_SOURCE_DIR}/LowLevelAABB/linux/include + ${PHYSX_SOURCE_DIR}/GpuBroadPhase/include + ${PHYSX_SOURCE_DIR}/GpuBroadPhase/src +) + +SET(LOWLEVELAABB_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(LOWLEVELAABB_LIBTYPE OBJECT) + +SET(LOWLEVELAABB_PLATFORM_LINK_FLAGS "/MAP") diff --git a/physx/source/compiler/cmake/android/LowLevelDynamics.cmake b/physx/source/compiler/cmake/android/LowLevelDynamics.cmake new file mode 100644 index 000000000..9c6b7d25e --- /dev/null +++ b/physx/source/compiler/cmake/android/LowLevelDynamics.cmake @@ -0,0 +1,48 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build LowLevelDynamics +# + +SET(LOWLEVELDYNAMICS_PLATFORM_INCLUDES + ${PHYSX_SOURCE_DIR}/common/src/linux + ${PHYSX_SOURCE_DIR}/lowlevel/software/include/linux + ${PHYSX_SOURCE_DIR}/lowleveldynamics/include/linux + ${PHYSX_SOURCE_DIR}/lowlevel/common/include/pipeline/linux +) + +SET(LOWLEVELDYNAMICS_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(LOWLEVELDYNAMICS_LIBTYPE OBJECT) diff --git a/physx/source/compiler/cmake/android/PhysX.cmake b/physx/source/compiler/cmake/android/PhysX.cmake new file mode 100644 index 000000000..0f18b1ca9 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysX.cmake @@ -0,0 +1,67 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysX (PROJECT not SOLUTION) +# + +SET(PHYSX_PLATFORM_INCLUDES + ${NVTOOLSEXT_INCLUDE_DIRS} +) + +SET(PHYSX_PLATFORM_OBJECT_FILES + $ + $ + $ + $ + $ + $ +) + +SET(PHYSX_PLATFORM_SRC_FILES + ${PX_SOURCE_DIR}/device/linux/PhysXIndicatorLinux.cpp + ${PX_SOURCE_DIR}/gpu/PxGpu.cpp + ${PX_SOURCE_DIR}/gpu/PxPhysXGpuModuleLoader.cpp + + ${PHYSX_PLATFORM_OBJECT_FILES} +) + +SET(PHYSX_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_CORE_EXPORTS + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +IF(PX_GENERATE_STATIC_LIBRARIES) + SET(PHYSX_LIBTYPE STATIC) +ELSE() + SET(PHYSX_LIBTYPE SHARED) +ENDIF() + diff --git a/physx/source/compiler/cmake/android/PhysXCharacterKinematic.cmake b/physx/source/compiler/cmake/android/PhysXCharacterKinematic.cmake new file mode 100644 index 000000000..81f8d9e3d --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXCharacterKinematic.cmake @@ -0,0 +1,43 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXCharacterKinematic +# + +SET(PHYSXCHARACTERKINEMATICS_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + + +SET(PHYSXCHARACTERKINEMATIC_LIBTYPE STATIC) + diff --git a/physx/source/compiler/cmake/android/PhysXCommon.cmake b/physx/source/compiler/cmake/android/PhysXCommon.cmake new file mode 100644 index 000000000..7f62715f7 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXCommon.cmake @@ -0,0 +1,69 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXCommon +# + + +SET(PXCOMMON_PLATFORM_SRC_FILES +) + +SET(PXCOMMON_PLATFORM_INCLUDES + ${PHYSX_SOURCE_DIR}/common/src/linux +) + +IF(PX_GENERATE_STATIC_LIBRARIES) +SET(PXCOMMON_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS}> +) +ELSE() + SET(PXCOMMON_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_COMMON_EXPORTS; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS}> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS}> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS}> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS}> + ) +ENDIF() + + + +IF(PX_GENERATE_STATIC_LIBRARIES) + SET(PHYSXCOMMON_LIBTYPE STATIC) +ELSE() + SET(PHYSXCOMMON_LIBTYPE SHARED) +ENDIF() + +SET(PXCOMMON_PLATFORM_LINK_FLAGS " ") diff --git a/physx/source/compiler/cmake/android/PhysXCooking.cmake b/physx/source/compiler/cmake/android/PhysXCooking.cmake new file mode 100644 index 000000000..ba264b575 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXCooking.cmake @@ -0,0 +1,60 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXCooking +# + +IF(NOT PX_GENERATE_STATIC_LIBRARIES) + SET(PXCOOKING_LIBTYPE_DEFS + PX_PHYSX_FOUNDATION_EXPORTS;PX_PHYSX_COMMON_EXPORTS;PX_PHYSX_COOKING_EXPORTS;PX_PHYSX_LOADER_EXPORTS;PX_PHYSX_CORE_EXPORTS + ) +ELSE() + SET(PXCOOKING_LIBTYPE_DEFS + PX_PHYSX_STATIC_LIB + ) +ENDIF() + +SET(PHYSXCOOKING_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};${PXCOOKING_LIBTYPE_DEFS};PX_COOKING; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXCOOKING_PLATFORM_SRC_FILES +) + +IF(PX_GENERATE_STATIC_LIBRARIES) + SET(PHYSXCOOKING_LIBTYPE STATIC) +ELSE() + SET(PHYSXCOOKING_LIBTYPE SHARED) +ENDIF() + +SET(PHYSXCOOKING_LINK_FLAGS " ") diff --git a/physx/source/compiler/cmake/android/PhysXExtensions.cmake b/physx/source/compiler/cmake/android/PhysXExtensions.cmake new file mode 100644 index 000000000..8d756789e --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXExtensions.cmake @@ -0,0 +1,53 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXExtensions +# + +SET(PHYSXEXTENSIONS_PLATFORM_INCLUDES + PRIVATE ${PHYSX_SOURCE_DIR}/Common/src/linux +) + +SET(PHYSXEXTENSIONS_PLATFORM_OBJECT_FILES + $ +) + +SET(PHYSXEXTENSIONS_PLATFORM_SRC_FILES + ${PHYSXEXTENSIONS_PLATFORM_OBJECT_FILES} +) + +SET(PHYSXEXTENSIONS_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXEXTENSIONS_LIBTYPE STATIC) diff --git a/physx/source/compiler/cmake/android/PhysXFoundation.cmake b/physx/source/compiler/cmake/android/PhysXFoundation.cmake new file mode 100644 index 000000000..8a4267f9a --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXFoundation.cmake @@ -0,0 +1,91 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXFoundation +# + +IF(PX_GENERATE_STATIC_LIBRARIES) + SET(PHYSXFOUNDATION_LIBTYPE STATIC) +ELSE() + SET(PHYSXFOUNDATION_LIBTYPE SHARED) + SET(PXFOUNDATION_LIBTYPE_DEFS PX_PHYSX_FOUNDATION_EXPORTS) +ENDIF() + +SET(PHYSXFOUNDATION_PLATFORM_HEADERS + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixMathIntrinsics.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixIntrinsics.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixAoS.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixInlineAoS.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixTrigConstants.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/PxUnixFPU.h +) +SOURCE_GROUP(include\\unix FILES ${PHYSXFOUNDATION_PLATFORM_HEADERS}) + +SET(PHYSXFOUNDATION_PLATFORM_SOURCE + ${LL_SOURCE_DIR}/unix/FdUnixAtomic.cpp + ${LL_SOURCE_DIR}/unix/FdUnixFPU.cpp + ${LL_SOURCE_DIR}/unix/FdUnixMutex.cpp + ${LL_SOURCE_DIR}/unix/FdUnixPrintString.cpp + ${LL_SOURCE_DIR}/unix/FdUnixSList.cpp + ${LL_SOURCE_DIR}/unix/FdUnixSocket.cpp + ${LL_SOURCE_DIR}/unix/FdUnixSync.cpp + ${LL_SOURCE_DIR}/unix/FdUnixThread.cpp + ${LL_SOURCE_DIR}/unix/FdUnixTime.cpp + ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c +) +SOURCE_GROUP("src\\src\\unix" FILES ${PHYSXFOUNDATION_PLATFORM_SOURCE}) + +SET(PHYSXFOUNDATION_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};${PXFOUNDATION_LIBTYPE_DEFS}; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXFOUNDATION_NEON_FILES + ${PHYSX_ROOT_DIR}/include/foundation/unix/neon/PxUnixNeonAoS.h + ${PHYSX_ROOT_DIR}/include/foundation/unix/neon/PxUnixNeonInlineAoS.h +) + +INSTALL(FILES ${PHYSXFOUNDATION_NEON_FILES} DESTINATION include/foundation/unix/neon) +INSTALL(FILES ${PHYSXFOUNDATION_PLATFORM_HEADERS} DESTINATION include/foundation/unix) + +SET(PHYSXFOUNDATION_PLATFORM_FILES + ${PHYSXFOUNDATION_PLATFORM_SOURCE} + ${PHYSXFOUNDATION_PLATFORM_HEADERS} + ${PHYSXFOUNDATION_NEON_FILES} +) + +SET(PHYSXFOUNDATION_PLATFORM_INCLUDES + ${PHYSX_ROOT_DIR}/include/foundation/linux + ${ANDROID_NDK}/sources/android/cpufeatures +) + +SET(PHYSXFOUNDATION_PLATFORM_LINKED_LIBS log) diff --git a/physx/source/compiler/cmake/android/PhysXPvdSDK.cmake b/physx/source/compiler/cmake/android/PhysXPvdSDK.cmake new file mode 100644 index 000000000..3e6a7c869 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXPvdSDK.cmake @@ -0,0 +1,41 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXPvdSDK +# + +SET(PHYSXPVDSDK_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS}; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXPVDSDK_LIBTYPE STATIC) diff --git a/physx/source/compiler/cmake/android/PhysXTask.cmake b/physx/source/compiler/cmake/android/PhysXTask.cmake new file mode 100644 index 000000000..595362da5 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXTask.cmake @@ -0,0 +1,41 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXTask +# + +SET(PHYSXTASK_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS}; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXTASK_LIBTYPE OBJECT) diff --git a/physx/source/compiler/cmake/android/PhysXVehicle.cmake b/physx/source/compiler/cmake/android/PhysXVehicle.cmake new file mode 100644 index 000000000..243be8b24 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXVehicle.cmake @@ -0,0 +1,42 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXVehicle +# + +SET(PHYSXVEHICLE_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXVEHICLE_LIBTYPE STATIC) + diff --git a/physx/source/compiler/cmake/android/PhysXVehicle2.cmake b/physx/source/compiler/cmake/android/PhysXVehicle2.cmake new file mode 100644 index 000000000..03d56c805 --- /dev/null +++ b/physx/source/compiler/cmake/android/PhysXVehicle2.cmake @@ -0,0 +1,42 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build PhysXVehicle2 +# + +SET(PHYSXVEHICLE2_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(PHYSXVEHICLE2_LIBTYPE STATIC) + diff --git a/physx/source/compiler/cmake/android/SceneQuery.cmake b/physx/source/compiler/cmake/android/SceneQuery.cmake new file mode 100644 index 000000000..1bd25ad45 --- /dev/null +++ b/physx/source/compiler/cmake/android/SceneQuery.cmake @@ -0,0 +1,46 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build SceneQuery +# + +SET(SCENEQUERY_PLATFORM_INCLUDES + PRIVATE ${PHYSX_SOURCE_DIR}/Common/src/linux +) + +SET(SCENEQUERY_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(SCENEQUERY_LIBTYPE OBJECT) + diff --git a/physx/source/compiler/cmake/android/SimulationController.cmake b/physx/source/compiler/cmake/android/SimulationController.cmake new file mode 100644 index 000000000..d134ff9af --- /dev/null +++ b/physx/source/compiler/cmake/android/SimulationController.cmake @@ -0,0 +1,47 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved. + +# +# Build SimulationController +# + +SET(SIMULATIONCONTROLLER_PLATFORM_INCLUDES + ${PHYSX_SOURCE_DIR}/Common/src/linux + ${PHYSX_SOURCE_DIR}/LowLevel/linux/include +) + +SET(SIMULATIONCONTROLLER_COMPILE_DEFS + # Common to all configurations + ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_STATIC_LIB; + + $<$:${PHYSX_ANDROID_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_ANDROID_RELEASE_COMPILE_DEFS};> +) + +SET(SIMULATIONCONTROLLER_LIBTYPE OBJECT) + diff --git a/physx/source/foundation/unix/FdUnixFPU.cpp b/physx/source/foundation/unix/FdUnixFPU.cpp index 49a113a02..dda3df5ce 100644 --- a/physx/source/foundation/unix/FdUnixFPU.cpp +++ b/physx/source/foundation/unix/FdUnixFPU.cpp @@ -27,7 +27,7 @@ // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #include "foundation/PxFPU.h" -#if !defined(__CYGWIN__) +#if !(defined(__CYGWIN__) || PX_ANDROID) #include PX_COMPILE_TIME_ASSERT(8 * sizeof(uint32_t) >= sizeof(fenv_t)); #endif @@ -41,6 +41,8 @@ physx::PxFPUGuard::PxFPUGuard() { #if defined(__CYGWIN__) #pragma message "FPUGuard::FPUGuard() is not implemented" +#elif PX_ANDROID +// not supported unless ARM_HARD_FLOAT is enabled. #elif PX_OSX mControlWords[0] = _mm_getcsr(); // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) @@ -66,6 +68,8 @@ physx::PxFPUGuard::~PxFPUGuard() { #if defined(__CYGWIN__) #pragma message "PxFPUGuard::~PxFPUGuard() is not implemented" +#elif PX_ANDROID +// not supported unless ARM_HARD_FLOAT is enabled. #elif PX_OSX // restore control word and clear exception flags // (setting exception state flags cause exceptions on the first following fp operation) diff --git a/physx/source/foundation/unix/FdUnixPrintString.cpp b/physx/source/foundation/unix/FdUnixPrintString.cpp index 80cc4d1b6..767ccb22a 100644 --- a/physx/source/foundation/unix/FdUnixPrintString.cpp +++ b/physx/source/foundation/unix/FdUnixPrintString.cpp @@ -29,12 +29,20 @@ #include "foundation/PxString.h" #include +#if PX_ANDROID +#include +#endif + namespace physx { void PxPrintString(const char* str) { +#if PX_ANDROID + __android_log_print(ANDROID_LOG_INFO, "PsPrintString", "%s", str); +#else puts(str); +#endif } } // namespace physx diff --git a/physx/source/foundation/unix/FdUnixThread.cpp b/physx/source/foundation/unix/FdUnixThread.cpp index db56ec0ab..cfe0d6a5b 100644 --- a/physx/source/foundation/unix/FdUnixThread.cpp +++ b/physx/source/foundation/unix/FdUnixThread.cpp @@ -32,7 +32,7 @@ #include "foundation/PxThread.h" #include -#if !PX_APPLE_FAMILY && !defined(__CYGWIN__) && !PX_EMSCRIPTEN +#if !PX_APPLE_FAMILY && !PX_ANDROID && !defined(__CYGWIN__) && !PX_EMSCRIPTEN #include // PTHREAD_STACK_MIN #endif #include @@ -51,6 +51,13 @@ #include #endif +// fwd +#if PX_ANDROID +extern "C" { +int android_getCpuCount(void); +} +#endif + #define PxSpinLockPause() asm("nop") namespace physx @@ -172,7 +179,7 @@ void PxThreadImpl::start(uint32_t stackSize, PxRunnable* runnable) if(stackSize == 0) stackSize = getDefaultStackSize(); -#if defined(PTHREAD_STACK_MIN) +#if defined(PTHREAD_STACK_MIN) && !PX_ANDROID if(stackSize < PTHREAD_STACK_MIN) { PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, @@ -244,9 +251,14 @@ __attribute__((noreturn)) void PxThreadImpl::kill() { - if(getThread(this)->state == ePxThreadStarted) +#if !PX_ANDROID + if(getThread(this)->state == _PxThreadStarted) pthread_cancel(getThread(this)->thread); - getThread(this)->state = ePxThreadStopped; + getThread(this)->state = _PxThreadStopped; +#else + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "ThreadImpl::kill() called, but is not implemented"); +#endif } void PxThreadImpl::sleep(uint32_t ms) @@ -308,6 +320,9 @@ void PxThreadImpl::setName(const char* name) if (getThread(this)->state == ePxThreadStarted) { +#if PX_ANDROID && (__ANDROID_API__ > 8) + pthread_setname_np(getThread(this)->thread, name); +#else // not implemented because most unix APIs expect setName() // to be called from the thread's context. Example see next comment: @@ -315,6 +330,7 @@ void PxThreadImpl::setName(const char* name) // the main process if used in the wrong context: // prctl(PR_SET_NAME, reinterpret_cast(name) ,0,0,0); PX_UNUSED(name); +#endif } } @@ -389,6 +405,8 @@ uint32_t PxThreadImpl::getNbPhysicalCores() int count; size_t size = sizeof(count); return sysctlbyname("hw.physicalcpu", &count, &size, NULL, 0) ? 0 : count; +#elif PX_ANDROID + return android_getCpuCount(); #else // Linux exposes CPU topology using /sys/devices/system/cpu // https://www.kernel.org/doc/Documentation/cputopology.txt diff --git a/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp b/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp index 3be6265b8..a43574933 100644 --- a/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp +++ b/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp @@ -38,7 +38,7 @@ using namespace physx; namespace { -#define SN_NUM_BINARY_PLATFORMS 9 +#define SN_NUM_BINARY_PLATFORMS 10 const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] = { PX_MAKE_FOURCC('W','_','3','2'), @@ -49,7 +49,8 @@ const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] = PX_MAKE_FOURCC('M','_','6','4'), PX_MAKE_FOURCC('N','X','3','2'), PX_MAKE_FOURCC('N','X','6','4'), - PX_MAKE_FOURCC('L','A','6','4') + PX_MAKE_FOURCC('L','A','6','4'), + PX_MAKE_FOURCC('A','N','D','R') }; const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] = @@ -62,7 +63,8 @@ const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] = "mac64", "switch32", "switch64", - "linuxaarch64" + "linuxaarch64", + "android" }; } @@ -89,6 +91,8 @@ PxU32 getBinaryPlatformTag() return sBinaryPlatformTags[7]; #elif PX_LINUX && PX_A64 return sBinaryPlatformTags[8]; +#elif PX_ANDROID + return sBinaryPlatformTags[9]; #else #error Unknown binary platform #endif diff --git a/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h b/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h index 8af6de293..5716c98a8 100644 --- a/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h +++ b/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h @@ -76,7 +76,7 @@ struct MTorqueCurveProperty : public PxFixedSizeLookupTablePropertyInfo Date: Mon, 21 Nov 2022 20:26:24 +0000 Subject: [PATCH 2/6] Add CudaTypes header to androind since it's needed. Signed-off-by: moraaar --- physx/snippets/compiler/cmake/CMakeLists.txt | 2 +- physx/source/compiler/cmake/PhysXExtensions.cmake | 4 ++-- physx/source/compiler/cmake/android/PhysX.cmake | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/physx/snippets/compiler/cmake/CMakeLists.txt b/physx/snippets/compiler/cmake/CMakeLists.txt index b4f4ee85f..4e3f69bde 100644 --- a/physx/snippets/compiler/cmake/CMakeLists.txt +++ b/physx/snippets/compiler/cmake/CMakeLists.txt @@ -100,7 +100,7 @@ IF(NOT PUBLIC_RELEASE AND NOT PX_GENERATE_SOURCE_DISTRO) ENDIF() #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (TARGET_BUILD_PLATFORM STREQUAL "windows" OR TARGET_BUILD_PLATFORM STREQUAL "linux")) LIST(APPEND SNIPPETS_LIST ${GPU_SNIPPET_LIST}) ENDIF() diff --git a/physx/source/compiler/cmake/PhysXExtensions.cmake b/physx/source/compiler/cmake/PhysXExtensions.cmake index e114d3dcf..4de2026c1 100644 --- a/physx/source/compiler/cmake/PhysXExtensions.cmake +++ b/physx/source/compiler/cmake/PhysXExtensions.cmake @@ -78,7 +78,7 @@ SET(PHYSX_EXTENSIONS_SOURCE ) #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (TARGET_BUILD_PLATFORM STREQUAL "windows" OR TARGET_BUILD_PLATFORM STREQUAL "linux")) LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleExt.cpp") LIST(APPEND PHYSX_EXTENSIONS_SOURCE "${LL_SOURCE_DIR}/ExtParticleClothCooker.cpp") ENDIF() @@ -199,7 +199,7 @@ SET(PHYSX_EXTENSIONS_HEADERS ) #TODO, create a propper define for whether GPU features are enabled or not! -IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (NOT "${TARGET_BUILD_PLATFORM}" STREQUAL "android")) +IF ((PUBLIC_RELEASE OR PX_GENERATE_GPU_PROJECTS) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (TARGET_BUILD_PLATFORM STREQUAL "windows" OR TARGET_BUILD_PLATFORM STREQUAL "linux")) LIST(APPEND PHYSX_EXTENSIONS_HEADERS "${PHYSX_ROOT_DIR}/include/extensions/PxParticleClothCooker.h") LIST(APPEND PHYSX_EXTENSIONS_HEADERS "${PHYSX_ROOT_DIR}/include/extensions/PxParticleExt.h") ENDIF() diff --git a/physx/source/compiler/cmake/android/PhysX.cmake b/physx/source/compiler/cmake/android/PhysX.cmake index 0f18b1ca9..4bd220bb2 100644 --- a/physx/source/compiler/cmake/android/PhysX.cmake +++ b/physx/source/compiler/cmake/android/PhysX.cmake @@ -41,14 +41,24 @@ SET(PHYSX_PLATFORM_OBJECT_FILES $ ) +# Required for some callbacks taking CUstream as an argument even when building with PX_SUPPORT_GPU_PHYSX = 0 +SET(PHYSX_CUDATYPES_GPU_HEADERS + ${PHYSX_ROOT_DIR}/include/cudamanager/PxCudaTypes.h +) +SOURCE_GROUP(include\\cudamanager FILES ${PHYSX_CUDATYPES_GPU_HEADERS}) + SET(PHYSX_PLATFORM_SRC_FILES ${PX_SOURCE_DIR}/device/linux/PhysXIndicatorLinux.cpp ${PX_SOURCE_DIR}/gpu/PxGpu.cpp ${PX_SOURCE_DIR}/gpu/PxPhysXGpuModuleLoader.cpp + ${PHYSX_CUDATYPES_GPU_HEADERS} + ${PHYSX_PLATFORM_OBJECT_FILES} ) +INSTALL(FILES ${PHYSX_CUDATYPES_GPU_HEADERS} DESTINATION include/cudamanager) + SET(PHYSX_COMPILE_DEFS # Common to all configurations ${PHYSX_ANDROID_COMPILE_DEFS};PX_PHYSX_CORE_EXPORTS From 5f1e58d9ae65c9f00c5f3cd46bb6dbeef3078095 Mon Sep 17 00:00:00 2001 From: moraaar Date: Tue, 22 Nov 2022 13:34:54 +0000 Subject: [PATCH 3/6] Add android platform readme. Signed-off-by: moraaar --- .../presets/public/android-arm64-v8a.xml | 1 - .../platformreadme/android/README_ANDROID.md | 34 +++++++++++++++++++ .../compiler/cmake/android/CMakeLists.txt | 3 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 physx/documentation/platformreadme/android/README_ANDROID.md diff --git a/physx/buildtools/presets/public/android-arm64-v8a.xml b/physx/buildtools/presets/public/android-arm64-v8a.xml index d9611259f..b2593e0dd 100644 --- a/physx/buildtools/presets/public/android-arm64-v8a.xml +++ b/physx/buildtools/presets/public/android-arm64-v8a.xml @@ -2,7 +2,6 @@ - diff --git a/physx/documentation/platformreadme/android/README_ANDROID.md b/physx/documentation/platformreadme/android/README_ANDROID.md new file mode 100644 index 000000000..21e900805 --- /dev/null +++ b/physx/documentation/platformreadme/android/README_ANDROID.md @@ -0,0 +1,34 @@ +# NVIDIA PhysX SDK for Android + +## Location of Binaries: + +* SDK libraries: bin/android.arm64-v8a + + +## Required packages to generate projects: + +* CMake, minimum version 3.14 +* Python, minimum version 3.5 +* Android SDK, minimum version 29 +* Android NDK, minimum version 22 + + +## Generating Makefiles: + +* Set the environment variable ANDROID_NDK_HOME to the path to Android NDK. +* Makefiles are generated through a script in physx root directory: generate_projects.bat +* Script generate_projects.bat expects a preset name as a parameter, if a parameter is not provided it does list the available presets and you can select one. +* Supported preset for android platform is: android-arm64-v8a. +* Generated solutions are in folder compiler/android-arm64-v8a-debug, compiler/android-arm64-v8a-checked, compiler/android-arm64-v8a-profile, compiler/android-arm64-v8a-release. + + +## Building SDK: + +* Makefiles are in compiler/android-arm64-v8a-debug, etc. +* Build solution: cmake --build . + +## Limitations: + +* PhysX Snippets are not supported. +* PhysX Systems that require a CUDA capable GPU are not supported, for example particle system or cloth simulation. +* Omniverse Visual Debugger (OmniPVD) is not supported. diff --git a/physx/source/compiler/cmake/android/CMakeLists.txt b/physx/source/compiler/cmake/android/CMakeLists.txt index 723dc84d3..5162c948a 100644 --- a/physx/source/compiler/cmake/android/CMakeLists.txt +++ b/physx/source/compiler/cmake/android/CMakeLists.txt @@ -71,8 +71,9 @@ IF(PX_SCALAR_MATH) SET(SCALAR_MATH_FLAG "PX_SIMD_DISABLED") ENDIF() -# Disable cuda and dx for all projects on Android +# Disable OmniPVD for all projects on Android SET(PX_SUPPORT_OMNI_PVD_FLAG "PX_SUPPORT_OMNI_PVD=0") + SET(PHYSX_ANDROID_COMPILE_DEFS "__STDC_LIMIT_MACROS;${SCALAR_MATH_FLAG};${PHYSX_AUTOBUILD};${PUBLIC_RELEASE_FLAG};${FEATURES_UNDER_CONSTRUCTION_FLAG}" CACHE INTERNAL "Base PhysX preprocessor definitions") SET(PHYSX_ANDROID_DEBUG_COMPILE_DEFS "_DEBUG;PX_DEBUG=1;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1;${PX_SUPPORT_OMNI_PVD_FLAG}" CACHE INTERNAL "Debug PhysX preprocessor definitions") SET(PHYSX_ANDROID_CHECKED_COMPILE_DEFS "NDEBUG;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1;${PX_SUPPORT_OMNI_PVD_FLAG}" CACHE INTERNAL "Checked PhysX preprocessor definitions") From 068eae92f4805d672a085b364c8cf8c73ba0cdef Mon Sep 17 00:00:00 2001 From: moraaar Date: Wed, 23 Nov 2022 18:31:01 +0000 Subject: [PATCH 4/6] Added end of line in .gitignore file Signed-off-by: moraaar --- physx/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physx/.gitignore b/physx/.gitignore index 56e9b539d..d58e02493 100644 --- a/physx/.gitignore +++ b/physx/.gitignore @@ -3,4 +3,4 @@ compiler/linux-* compiler/vc* compiler/android* include/PxConfig.h -install/ \ No newline at end of file +install/ From 7125f6de46ba78d2584ecff02e9427cf356b45b3 Mon Sep 17 00:00:00 2001 From: moraaar Date: Thu, 24 Nov 2022 14:39:16 +0000 Subject: [PATCH 5/6] Fixed PxThreadImpl::kill Signed-off-by: moraaar --- physx/source/foundation/unix/FdUnixThread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/physx/source/foundation/unix/FdUnixThread.cpp b/physx/source/foundation/unix/FdUnixThread.cpp index cfe0d6a5b..7fc406cd7 100644 --- a/physx/source/foundation/unix/FdUnixThread.cpp +++ b/physx/source/foundation/unix/FdUnixThread.cpp @@ -252,9 +252,9 @@ __attribute__((noreturn)) void PxThreadImpl::kill() { #if !PX_ANDROID - if(getThread(this)->state == _PxThreadStarted) + if(getThread(this)->state == ePxThreadStarted) pthread_cancel(getThread(this)->thread); - getThread(this)->state = _PxThreadStopped; + getThread(this)->state = ePxThreadStopped; #else PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "ThreadImpl::kill() called, but is not implemented"); From 8ac3e3601d1333ae2a967995f49b338d4e188215 Mon Sep 17 00:00:00 2001 From: moraaar Date: Tue, 6 Dec 2022 16:26:48 +0000 Subject: [PATCH 6/6] Setting PX_OUTPUT_ARCH for android, which was missing. This causes the libraries to be correctly named with the suffix _64, the same as all the other platforms. Signed-off-by: moraaar --- physx/buildtools/cmake_generate_projects.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/physx/buildtools/cmake_generate_projects.py b/physx/buildtools/cmake_generate_projects.py index e43ad5792..6e75b7522 100644 --- a/physx/buildtools/cmake_generate_projects.py +++ b/physx/buildtools/cmake_generate_projects.py @@ -105,6 +105,10 @@ def __init__(self, presetName): cmParam = '-D' + \ cmakeParam.attrib['name'] + '=\"' + \ cmakeParam.attrib['value'] + '\"' + if cmakeParam.attrib['value'].startswith('arm'): + cmParam = cmParam + ' -DPX_OUTPUT_ARCH=arm' + elif cmakeParam.attrib['value'].startswith('x86'): + cmParam = cmParam + ' -DPX_OUTPUT_ARCH=x86' else: cmParam = '-D' + \ cmakeParam.attrib['name'] + '=' + \