From 4a918c66c048a42f417c885886b0eb57ea4c15c9 Mon Sep 17 00:00:00 2001 From: Nicholas Lawson <70027408+nick-l-o3de@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:58:44 -0700 Subject: [PATCH 1/5] temp commit - for testing latest physx Signed-off-by: Nicholas Lawson <70027408+nick-l-o3de@users.noreply.github.com> --- package-system/PhysX5/build_package_image.py | 92 +++++++++++++------- package_build_list_host_windows.json | 10 ++- 2 files changed, 67 insertions(+), 35 deletions(-) diff --git a/package-system/PhysX5/build_package_image.py b/package-system/PhysX5/build_package_image.py index 66f8bc4e..77f7784e 100644 --- a/package-system/PhysX5/build_package_image.py +++ b/package-system/PhysX5/build_package_image.py @@ -23,9 +23,10 @@ import builders.monkeypatch_tempdir_cleanup class PhysXBuilder(object): - def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, targetPlatform: str): + def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, targetPlatform: str, enable_GPU: bool = False): self._workingDir = workingDir self._packageSystemDir = basePackageSystemDir + self._enable_GPU = enable_GPU self._platform = targetPlatform self._hostPlatformLower = platform.system().lower() self._env = dict(os.environ) @@ -33,21 +34,30 @@ def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, GW_DEPS_ROOT=str(workingDir), ) + if self.enable_GPU: + if self._env.get("PM_CUDA_PATH") is None: + if self._env.get('CUDA_PATH') is None and self._env.get('CUDA_PATH_V12_8') is None: + print("Could not find CUDA_PATH or CUDA_PATH_V12_8 environment variable. Cannot build PhysX with GPU support.") + print("CUDA_PATH should point to the root of a CUDA installation, recommend v12.8, for example on Windows, this would be something like") + print(" set CUDA_PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.8") + raise Exception("CUDA_PATH or CUDA_PATH_V12_8 environment variable must be set to build PhysX with GPU support. Recommend v12.8") + self._env['PM_CUDA_PATH'] = self._env.get('CUDA_PATH_V12_8', self._env.get('CUDA_PATH')) + self.check_call = functools.partial(subprocess.check_call, cwd=self.workingDir, env=self.env ) - # nVidia CMakeModules (downloaded while building PhysX) do not cover ios or android + # nVidia CMakeModules (downloaded while building PhysX) do not cover ios # bin folder names yet, so they appear as UNKNOWN. self.platform_params = { - # system-name : (build preset, bin folder name, install folder name, is multiconfig) - 'windows' : ('vc16win64', 'win.x86_64.vc142.md', 'vc16win64', True), - 'linux' : ('linux', 'linux.clang', 'linux', False), - 'linux-aarch64' : ('linux-aarch64', 'linux.aarch64', 'linux-aarch64', False), - 'mac' : ('mac64', 'mac.x86_64', 'mac64', True), - 'ios' : ('ios64', 'UNKNOWN', 'ios64', True), - 'android' : ('android-arm64-v8a', 'UNKNOWN', "android-29", False) + # system-name : (preset, can use CUDA, bin folder name, install folder name, is multiconfig) + 'windows' : ('vc16win64', True, 'win.x86_64.vc142.md', 'vc16win64', True), + 'linux' : ('linux', True, 'linux.clang', 'linux', False), + 'linux-aarch64' : ('linux-aarch64', True, 'linux.aarch64', 'linux-aarch64', False), + 'mac' : ('mac64', False, 'mac.x86_64', 'mac64', True), + 'ios' : ('ios64', False, 'UNKNOWN', 'ios64', True), + 'android' : ('android-arm64-v8a', False, "android.arm64-v8a", 'android-29', False) } @property @@ -65,6 +75,10 @@ def platform(self): @property def env(self): return self._env + + @property + def enable_GPU(self): + return self._enable_GPU def readFile(self, file): f = open(file, 'r') @@ -83,7 +97,7 @@ def clone(self, lockToCommit: str): ['git', 'init',], ) self.check_call( - ['git', 'remote', 'add', 'origin', 'https://github.com/NVIDIA-Omniverse/PhysX',], + ['git', 'remote', 'add', 'origin', 'https://github.com/nick-l-o3de/o3de-physx.git',], ) self.check_call( @@ -92,15 +106,20 @@ def clone(self, lockToCommit: str): self.check_call( ['git', 'checkout', lockToCommit,], ) - if self.platform in ['ios', 'mac']: - self.check_call( - ['git', 'apply', '--whitespace=fix', (pathlib.Path(__file__).parent / 'build_fix.patch').absolute()] - ) - def preparePreset(self, buildAsStaticLibs, config): - preset_index = 0 - preset_file = self.workingDir / 'physx' / 'buildtools' / 'presets' / 'public' / f'{self.platform_params[self.platform][preset_index]}.xml' + + preset_name = self.platform_params[self.platform][0] + supports_gpu_builds = self.platform_params[self.platform][1] + + if (self.enable_GPU and not supports_gpu_builds): + raise Exception(f"Platform {self.platform} does not support GPU builds, but --enable_GPU was specified.") + + # if we're turning GPU off, and we support GPU builds, use the cpu-only preset. Otherwise such a preset will not exist: + if not self.enable_GPU and supports_gpu_builds: + preset_name += "-cpu-only" + + preset_file = self.workingDir / 'physx' / 'buildtools' / 'presets' / 'public' / f'{preset_name}.xml' content = self.readFile(preset_file) content = re.sub('name="PX_GENERATE_STATIC_LIBRARIES" value="(True|False)"', f'name="PX_GENERATE_STATIC_LIBRARIES" value="{buildAsStaticLibs}"', content, flags = re.M) @@ -177,7 +196,12 @@ def build(self, buildAsStaticLibs): update_pacman_call = [ str(packman_dir / 'packman'), 'update', '-y'] check_call_packman_update(update_pacman_call) - preset, bin_folder, install_folder, is_multiconfig = self.platform_params[self.platform] + preset, supports_gpu, bin_folder, install_folder, is_multiconfig = self.platform_params[self.platform] + + # if we are turning the GPU support off, and we are in a preset that supports GPU, we have to append wart to the end of the name + if not self.enable_GPU and supports_gpu: + preset += "-cpu-only" + install_folder += "-cpu-only" if self._hostPlatformLower == 'windows': generate_projects_cmd = str(physx_dir / 'generate_projects.bat') @@ -192,7 +216,6 @@ def build(self, buildAsStaticLibs): for config in ('release', 'profile', 'checked', 'debug'): self.preparePreset(buildAsStaticLibs, config); - # Generate generate_call =[generate_projects_cmd, preset,] print(generate_call) check_call_physx_dir(generate_call) @@ -202,16 +225,16 @@ def build(self, buildAsStaticLibs): build_dir = os.path.join(physx_dir, 'compiler', preset) if config == 'release': # Build install target on release to produce the install folder where all the headers will be generated - cmake_build_call =['cmake', '--build', build_dir, '--config', config, '--target', 'install'] + cmake_build_call =['cmake', '--build', build_dir, '--config', config, '--target', 'install', '--parallel'] else: - cmake_build_call =['cmake', '--build', build_dir, '--config', config] + cmake_build_call =['cmake', '--build', build_dir, '--config', config, '--parallel'] else: build_dir = os.path.join(physx_dir, 'compiler', f'{preset}-{config}') if config == 'release': # Build install target on release to produce the install folder where all the headers will be generated - cmake_build_call =['cmake', '--build', build_dir, '--target', 'install'] + cmake_build_call =['cmake', '--build', build_dir, '--target', 'install', '--parallel'] else: - cmake_build_call =['cmake', '--build', build_dir] + cmake_build_call =['cmake', '--build', build_dir, '--parallel'] print(cmake_build_call) self.check_call(cmake_build_call) @@ -279,7 +302,7 @@ def writeCMakeFindFile(self, packageDir: pathlib.Path, cmakeFindFile): src=cmakeFindFile, dst=dst ) - + extraLibsPerPlatform = { 'windows': [ ['\\${EXTRA_SHARED_LIBS}', @@ -338,6 +361,12 @@ def main(): dest='platformName', choices=['windows', 'linux', 'linux-aarch64', 'android', 'mac', 'ios'], ) + + parser.add_argument( + '--enable-gpu', + action='store_true' + ) + args = parser.parse_args() if args.platformName == 'mac' or args.platformName == 'ios': @@ -360,20 +389,21 @@ def main(): # Package Name packageName = f'{args.package_name}-{args.package_rev}-{args.platformName}' - # Version 5.1.1 commits + # Version 5.6.1 commits if args.platformName == 'mac': - commit = 'bbf7c0de9738c99046c9d6daf57779b4decf95ef' # Commit of PR 51 on top of 5.1.1 version + commit = '47c79b2936b7cfd34abeedf685b70730884afc37' elif args.platformName == 'ios': - commit = '5420931fd1e60aaa4df2688d07557722d021f034' # Commit of PR 49 on top of 5.1.1 version + commit = '47c79b2936b7cfd34abeedf685b70730884afc37' elif args.platformName == 'android': - commit = '8ac3e3601d1333ae2a967995f49b338d4e188215' # Commit of PR 40 on top of 5.1.1 version + commit = '47c79b2936b7cfd34abeedf685b70730884afc37' else: - commit = '0bbcff3d0c541325f4d14c36ee18f24e22e35e6e' # Commit for 5.1.1 version + commit = '47c79b2936b7cfd34abeedf685b70730884afc37' tempdir = Path(tempdir) builder = PhysXBuilder(workingDir=tempdir, basePackageSystemDir=packageSystemDir, - targetPlatform=args.platformName) + targetPlatform=args.platformName, + enable_GPU =args.enable_gpu) builder.clone(lockToCommit=commit) builder.build_all() @@ -384,7 +414,7 @@ def main(): packageRoot, settings={ 'PackageName': packageName, - 'URL': 'https://github.com/NVIDIA-Omniverse/PhysX', + 'URL': 'https://github.com/o3de/PhysX', 'License': 'BSD-3-Clause', 'LicenseFile': 'PhysX/LICENSE.md' }, diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index a70ad78b..d9ef4ac7 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -43,8 +43,9 @@ "OpenXR-1.1.41-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Windows --package-root ../../package-system/OpenXR/temp --clean", "PhysX-4.1.2.29882248-rev8-android": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform android", "PhysX-4.1.2.29882248-rev8-windows": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform windows", - "PhysX-5.1.1-rev4-android": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.1.1 --package-rev rev4 --platform android", - "PhysX-5.1.1-rev4-windows": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.1.1 --package-rev rev4 --platform windows", + "PhysX-5.6.1-rev1-android": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.6.1 --package-rev rev1 --platform android", + "PhysX-5.6.1-rev1-windows": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.6.1 --package-rev rev1 --platform windows", + "PhysX-5.6.1-gpu-rev1-windows": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.6.1-gpu --package-rev rev1 --platform windows --enable-gpu", "png-1.6.37-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Android --package-root ../../package-system/libpng/temp --clean", "png-1.6.37-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Windows --package-root ../../package-system/libpng/temp --clean", "poly2tri-7f0487a-rev1-windows": "package-system/poly2tri/build_package_image.py --platform-name windows", @@ -112,8 +113,9 @@ "OpenXR-1.1.41-rev2-windows": "package-system/OpenXR/temp/OpenXR-windows", "PhysX-4.1.2.29882248-rev8-android": "package-system/PhysX-android", "PhysX-4.1.2.29882248-rev8-windows": "package-system/PhysX-windows", - "PhysX-5.1.1-rev4-android": "package-system/PhysX5/temp/PhysX5-android", - "PhysX-5.1.1-rev4-windows": "package-system/PhysX5/temp/PhysX5-windows", + "PhysX-5.6.1-rev1-android": "package-system/PhysX5/temp/PhysX5-android", + "PhysX-5.6.1-rev1-windows": "package-system/PhysX5/temp/PhysX5-windows", + "PhysX-5.6.1-gpu-rev1-windows": "package-system/PhysX5/temp/PhysX5-windows", "png-1.6.37-rev2-android": "package-system/libpng/temp/png-android", "png-1.6.37-rev2-windows": "package-system/libpng/temp/png-windows", "poly2tri-7f0487a-rev1-windows": "package-system/poly2tri-windows", From 710cfde5e3f6aa2c7202fe9a60007446bd7d7c90 Mon Sep 17 00:00:00 2001 From: Nicholas Lawson <70027408+nick-l-o3de@users.noreply.github.com> Date: Fri, 3 Oct 2025 10:27:06 -0700 Subject: [PATCH 2/5] Support for physx latest on linux in the package system Signed-off-by: Nicholas Lawson <70027408+nick-l-o3de@users.noreply.github.com> --- package-system/PhysX5/FindPhysX5.cmake | 2 +- package-system/PhysX5/FindPhysX5_ios.cmake | 2 +- package-system/PhysX5/build_package_image.py | 141 ++++++++++++------- package_build_list_host_linux.json | 6 +- 4 files changed, 96 insertions(+), 55 deletions(-) diff --git a/package-system/PhysX5/FindPhysX5.cmake b/package-system/PhysX5/FindPhysX5.cmake index 03705afd..efc46b89 100644 --- a/package-system/PhysX5/FindPhysX5.cmake +++ b/package-system/PhysX5/FindPhysX5.cmake @@ -51,7 +51,7 @@ set(extra_shared_libs ${EXTRA_SHARED_LIBS}) set(IMPORTED_PHYSICS_LIBS_SUFFIX PhysX_static_64 PhysXPvdSDK_static_64 - PhysXVehicle_static_64 + PhysXVehicle2_static_64 PhysXCharacterKinematic_static_64 PhysXExtensions_static_64 PhysXCooking_static_64 diff --git a/package-system/PhysX5/FindPhysX5_ios.cmake b/package-system/PhysX5/FindPhysX5_ios.cmake index 946cc1c3..680e815f 100644 --- a/package-system/PhysX5/FindPhysX5_ios.cmake +++ b/package-system/PhysX5/FindPhysX5_ios.cmake @@ -34,7 +34,7 @@ set(PATH_TO_LIBS ${_PACKAGE_DIR}/bin/static/$,${PHYSX_PROFI set(${MY_NAME}_LIBRARIES ${PATH_TO_LIBS}/libPhysXCharacterKinematic_static_64.a - ${PATH_TO_LIBS}/libPhysXVehicle_static_64.a + ${PATH_TO_LIBS}/libPhysXVehicle2_static_64.a ${PATH_TO_LIBS}/libPhysXExtensions_static_64.a ${PATH_TO_LIBS}/libPhysXPvdSDK_static_64.a ${PATH_TO_LIBS}/libPhysX_static_64.a diff --git a/package-system/PhysX5/build_package_image.py b/package-system/PhysX5/build_package_image.py index 77f7784e..56e93f08 100644 --- a/package-system/PhysX5/build_package_image.py +++ b/package-system/PhysX5/build_package_image.py @@ -35,6 +35,9 @@ def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, ) if self.enable_GPU: + print(f"NOTE: Building PhysX with GPU support requires a CUDA installation, and has only been tested with CUDA v12.8.1") + + if self.enable_GPU and self._platform in ('windows'): if self._env.get("PM_CUDA_PATH") is None: if self._env.get('CUDA_PATH') is None and self._env.get('CUDA_PATH_V12_8') is None: print("Could not find CUDA_PATH or CUDA_PATH_V12_8 environment variable. Cannot build PhysX with GPU support.") @@ -51,13 +54,13 @@ def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, # nVidia CMakeModules (downloaded while building PhysX) do not cover ios # bin folder names yet, so they appear as UNKNOWN. self.platform_params = { - # system-name : (preset, can use CUDA, bin folder name, install folder name, is multiconfig) - 'windows' : ('vc16win64', True, 'win.x86_64.vc142.md', 'vc16win64', True), - 'linux' : ('linux', True, 'linux.clang', 'linux', False), - 'linux-aarch64' : ('linux-aarch64', True, 'linux.aarch64', 'linux-aarch64', False), - 'mac' : ('mac64', False, 'mac.x86_64', 'mac64', True), - 'ios' : ('ios64', False, 'UNKNOWN', 'ios64', True), - 'android' : ('android-arm64-v8a', False, "android.arm64-v8a", 'android-29', False) + # system-name : (preset, can use CUDA, bin folder name, install folder name, is multiconfig) + 'windows' : ('vc16win64', True, 'win.x86_64.vc142.md', 'vc16win64', True), + 'linux' : ('linux-clang', True, 'linux.x86_64', 'linux-clang', False), + 'linux-aarch64' : ('linux-aarch64-clang', True, 'linux.aarch64', 'linux-aarch64', False), + 'mac' : ('mac64', False, 'mac.x86_64', 'mac64', True), + 'ios' : ('ios64', False, 'UNKNOWN', 'ios64', True), + 'android' : ('android-arm64-v8a', False, "android.arm64-v8a", 'android-29', False) } @property @@ -125,7 +128,7 @@ def preparePreset(self, buildAsStaticLibs, config): if self.platform == 'windows': content = re.sub('name="PX_BUILDSNIPPETS" value="(True|False)"', f'name="PX_BUILDSNIPPETS" value="False"', content, flags = re.M) - content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="False"', content, flags = re.M) + content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="True"', content, flags = re.M) if config == 'debug': content = re.sub('name="NV_USE_DEBUG_WINCRT" value="(True|False)"', f'name="NV_USE_DEBUG_WINCRT" value="True"', content, flags = re.M) else: @@ -134,7 +137,7 @@ def preparePreset(self, buildAsStaticLibs, config): elif self.platform == 'linux' or self.platform == 'linux-aarch64': content = re.sub('name="PX_BUILDSNIPPETS" value="(True|False)"', f'name="PX_BUILDSNIPPETS" value="False"', content, flags = re.M) - content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="False"', content, flags = re.M) + content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="True"', content, flags = re.M) self.writeFile(preset_file, content) @@ -193,6 +196,7 @@ def build(self, buildAsStaticLibs): if self._hostPlatformLower == 'windows': update_pacman_call = [ str(packman_dir / 'packman.cmd'), 'update', '-y'] else: + os.chmod(packman_dir / 'packman', 0o755) # ensure packman is executable update_pacman_call = [ str(packman_dir / 'packman'), 'update', '-y'] check_call_packman_update(update_pacman_call) @@ -303,44 +307,79 @@ def writeCMakeFindFile(self, packageDir: pathlib.Path, cmakeFindFile): dst=dst ) - extraLibsPerPlatform = { - 'windows': [ - ['\\${EXTRA_SHARED_LIBS}', - ''.join(('\n', - '\t${PATH_TO_LIBS}/PhysXDevice64.dll\n', - '\t${PATH_TO_LIBS}/PhysXGpu_64.dll\n' - ))], - ['\\${EXTRA_STATIC_LIBS}', - ''.join(('\n', - '\t${PATH_TO_LIBS}/LowLevel_static_64.lib\n', - '\t${PATH_TO_LIBS}/LowLevelAABB_static_64.lib\n', - '\t${PATH_TO_LIBS}/LowLevelDynamics_static_64.lib\n', - '\t${PATH_TO_LIBS}/PhysXTask_static_64.lib\n', - '\t${PATH_TO_LIBS}/SceneQuery_static_64.lib\n', - '\t${PATH_TO_LIBS}/SimulationController_static_64.lib\n', - ))], - ], - 'linux': [ - ['\\${EXTRA_SHARED_LIBS}', '${PATH_TO_LIBS}/libPhysXGpu_64.so'], - ['\\${EXTRA_STATIC_LIBS}', ''], - ], - 'linux-aarch64': [ - ['\\${EXTRA_SHARED_LIBS}', '${PATH_TO_LIBS}/libPhysXGpu_64.so'], - ['\\${EXTRA_STATIC_LIBS}', ''], - ], - 'mac': [ - ['\\${EXTRA_SHARED_LIBS}', ''], - ['\\${EXTRA_STATIC_LIBS}', ''], - ], - # iOS has its own FindPhysX file where it doesn't need to do any adjustments. - 'ios': [ - ], - 'android': [ - ['\\${EXTRA_SHARED_LIBS}', ''], - ['\\${EXTRA_STATIC_LIBS}', ''], - ], - } - + # The GPU library is only necessary if PhysX is built with GPU support + extraLibsPerPlatform = {} + + if self.enable_GPU: + extraLibsPerPlatform = { + 'windows': [ + ['\\${EXTRA_SHARED_LIBS}', + ''.join(('\n', + '\t${PATH_TO_LIBS}/PhysXDevice64.dll\n', + '\t${PATH_TO_LIBS}/PhysXGpu_64.dll\n' + ))], + ['\\${EXTRA_STATIC_LIBS}', + ''.join(('\n', + '\t${PATH_TO_LIBS}/LowLevel_static_64.lib\n', + '\t${PATH_TO_LIBS}/LowLevelAABB_static_64.lib\n', + '\t${PATH_TO_LIBS}/LowLevelDynamics_static_64.lib\n', + '\t${PATH_TO_LIBS}/PhysXTask_static_64.lib\n', + '\t${PATH_TO_LIBS}/SceneQuery_static_64.lib\n', + '\t${PATH_TO_LIBS}/SimulationController_static_64.lib\n', + ))], + ], + 'linux': [ + ['\\${EXTRA_SHARED_LIBS}', '${PATH_TO_LIBS}/libPhysXGpu_64.so'], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + 'linux-aarch64': [ + ['\\${EXTRA_SHARED_LIBS}', '${PATH_TO_LIBS}/libPhysXGpu_64.so'], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + 'mac': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + # iOS has its own FindPhysX file where it doesn't need to do any adjustments. + 'ios': [ + ], + 'android': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + } + else: # only windows needs some extra files included in static lib mode: + extraLibsPerPlatform = { + 'windows': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', + ''.join(('\n', + '\t${PATH_TO_LIBS}/LowLevel_static_64.lib\n', + '\t${PATH_TO_LIBS}/LowLevelAABB_static_64.lib\n', + '\t${PATH_TO_LIBS}/LowLevelDynamics_static_64.lib\n', + '\t${PATH_TO_LIBS}/PhysXTask_static_64.lib\n', + '\t${PATH_TO_LIBS}/SceneQuery_static_64.lib\n', + '\t${PATH_TO_LIBS}/SimulationController_static_64.lib\n', + ))], + ], + 'linux': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + 'linux-aarch64': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + 'mac': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + 'ios': [], + 'android': [ + ['\\${EXTRA_SHARED_LIBS}', ''], + ['\\${EXTRA_STATIC_LIBS}', ''], + ], + } content = self.readFile(dst) for extraLibs in extraLibsPerPlatform[self.platform]: content = re.sub(extraLibs[0], extraLibs[1], content, flags = re.M) @@ -391,13 +430,13 @@ def main(): # Version 5.6.1 commits if args.platformName == 'mac': - commit = '47c79b2936b7cfd34abeedf685b70730884afc37' + commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' elif args.platformName == 'ios': - commit = '47c79b2936b7cfd34abeedf685b70730884afc37' + commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' elif args.platformName == 'android': - commit = '47c79b2936b7cfd34abeedf685b70730884afc37' + commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' else: - commit = '47c79b2936b7cfd34abeedf685b70730884afc37' + commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' tempdir = Path(tempdir) builder = PhysXBuilder(workingDir=tempdir, diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index d3474a7c..f31571a5 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -29,7 +29,8 @@ "OpenSSL-1.1.1t-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenSSL --platform-name Linux --clean", "OpenSSL-1.1.1t-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenSSL --platform-name Linux-aarch64 --clean", "PhysX-4.1.2.29882248-rev8-linux": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform-name linux", - "PhysX-5.1.1-rev4-linux": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.1.1 --package-rev rev4 --platform-name linux", + "PhysX-5.6.1-rev1-linux": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.6.1 --package-rev rev1 --platform-name linux", + "PhysX-5.6.1-gpu-rev1-linux": "package-system/PhysX5/build_package_image.py --package-name PhysX-5.6.1-gpu --package-rev rev1 --platform-name linux --enable-gpu", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-linux": "package-system/NvCloth/build_package_image.py --platform-name linux", "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri/build_package_image.py --platform-name linux", "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd/build_package_image.py --platform-name linux", @@ -90,7 +91,8 @@ "python-3.10.13-rev2-linux": "package-system/python/temp/python-linux", "python-3.10.13-rev2-linux-aarch64": "package-system/python/temp/python-linux-aarch64", "PhysX-4.1.2.29882248-rev8-linux": "package-system/PhysX-linux", - "PhysX-5.1.1-rev4-linux": "package-system/PhysX5/temp/PhysX5-linux", + "PhysX-5.6.1-rev1-linux": "package-system/PhysX5/temp/PhysX5-linux", + "PhysX-5.6.1-gpu-rev1-linux": "package-system/PhysX5/temp/PhysX5-linux", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-linux": "package-system/NvCloth-linux", "mikkelsen-1.0.0.4-linux": "package-system/mikkelsen-linux", "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri-linux", From 58d8204538101b29a6279c8f849ff9c75eadc4f0 Mon Sep 17 00:00:00 2001 From: Jason Q <119447878+iamjbq@users.noreply.github.com> Date: Sat, 28 Feb 2026 22:32:08 -0400 Subject: [PATCH 3/5] Updated package version and git tag, pointed remove back to o3de/PhysX --- package-system/PhysX5/build_config.json | 4 +- package-system/PhysX5/build_package_image.py | 56 ++++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/package-system/PhysX5/build_config.json b/package-system/PhysX5/build_config.json index dd25619a..8c0b97a9 100644 --- a/package-system/PhysX5/build_config.json +++ b/package-system/PhysX5/build_config.json @@ -1,6 +1,6 @@ { "git_url": "https://github.com/o3de/PhysX.git", - "git_tag": "release/104.1", + "git_tag": "update_to_release_107.3", "package_name": "PhysX", "package_url": "https://github.com/NVIDIA-Omniverse/PhysX", "package_license": "BSD-3-Clause", @@ -11,7 +11,7 @@ "Darwin": { "Mac-arm64": { "patch_file": "physx5_mac.patch", - "package_version": "5.1.1-rev4", + "package_version": "5.6.1-rev1", "custom_build_cmd": [ "./build-darwin-arm64.sh" ], diff --git a/package-system/PhysX5/build_package_image.py b/package-system/PhysX5/build_package_image.py index 56e93f08..474446ce 100644 --- a/package-system/PhysX5/build_package_image.py +++ b/package-system/PhysX5/build_package_image.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# +# # SPDX-License-Identifier: Apache-2.0 OR MIT # # @@ -50,10 +50,10 @@ def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, cwd=self.workingDir, env=self.env ) - + # nVidia CMakeModules (downloaded while building PhysX) do not cover ios # bin folder names yet, so they appear as UNKNOWN. - self.platform_params = { + self.platform_params = { # system-name : (preset, can use CUDA, bin folder name, install folder name, is multiconfig) 'windows' : ('vc16win64', True, 'win.x86_64.vc142.md', 'vc16win64', True), 'linux' : ('linux-clang', True, 'linux.x86_64', 'linux-clang', False), @@ -78,7 +78,7 @@ def platform(self): @property def env(self): return self._env - + @property def enable_GPU(self): return self._enable_GPU @@ -100,7 +100,7 @@ def clone(self, lockToCommit: str): ['git', 'init',], ) self.check_call( - ['git', 'remote', 'add', 'origin', 'https://github.com/nick-l-o3de/o3de-physx.git',], + ['git', 'remote', 'add', 'origin', 'https://github.com/o3de/PhysX',], ) self.check_call( @@ -111,13 +111,13 @@ def clone(self, lockToCommit: str): ) def preparePreset(self, buildAsStaticLibs, config): - + preset_name = self.platform_params[self.platform][0] supports_gpu_builds = self.platform_params[self.platform][1] if (self.enable_GPU and not supports_gpu_builds): raise Exception(f"Platform {self.platform} does not support GPU builds, but --enable_GPU was specified.") - + # if we're turning GPU off, and we support GPU builds, use the cpu-only preset. Otherwise such a preset will not exist: if not self.enable_GPU and supports_gpu_builds: preset_name += "-cpu-only" @@ -125,7 +125,7 @@ def preparePreset(self, buildAsStaticLibs, config): preset_file = self.workingDir / 'physx' / 'buildtools' / 'presets' / 'public' / f'{preset_name}.xml' content = self.readFile(preset_file) content = re.sub('name="PX_GENERATE_STATIC_LIBRARIES" value="(True|False)"', f'name="PX_GENERATE_STATIC_LIBRARIES" value="{buildAsStaticLibs}"', content, flags = re.M) - + if self.platform == 'windows': content = re.sub('name="PX_BUILDSNIPPETS" value="(True|False)"', f'name="PX_BUILDSNIPPETS" value="False"', content, flags = re.M) content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="True"', content, flags = re.M) @@ -134,25 +134,25 @@ def preparePreset(self, buildAsStaticLibs, config): else: content = re.sub('name="NV_USE_DEBUG_WINCRT" value="(True|False)"', f'name="NV_USE_DEBUG_WINCRT" value="False"', content, flags = re.M) content = re.sub('name="NV_USE_STATIC_WINCRT" value="(True|False)"', f'name="NV_USE_STATIC_WINCRT" value="False"', content, flags = re.M) # sets dynamic runtime usage - + elif self.platform == 'linux' or self.platform == 'linux-aarch64': content = re.sub('name="PX_BUILDSNIPPETS" value="(True|False)"', f'name="PX_BUILDSNIPPETS" value="False"', content, flags = re.M) content = re.sub('name="PX_BUILDPVDRUNTIME" value="(True|False)"', f'name="PX_BUILDPVDRUNTIME" value="True"', content, flags = re.M) - + self.writeFile(preset_file, content) - # Ignore poison-system-directories warning when building mac/ios caused + # Ignore poison-system-directories warning when building mac/ios caused # by running 'cmake --build' using python subprocess on Mac. if self.platform == 'mac' or self.platform == 'ios': cmake_file = self.workingDir / 'physx' / 'source' / 'compiler' / 'cmake' / self.platform / 'CMakeLists.txt' content = self.readFile(cmake_file) content = re.sub('-Werror', r'-Werror -Wno-poison-system-directories', content, flags = re.M) self.writeFile(cmake_file, content) - + def cleanUpLibs(self, buildAsStaticLibs): static_bin_dir = self.workingDir / 'physx' / 'bin' / 'static' shared_bin_dir = self.workingDir / 'physx' / 'bin' / 'shared' - + # Remove dynamic libraries, but copy some missing static libs from # the shared builds into the static lib folder. Also freeglut is not # necessary for PhysX. @@ -182,7 +182,7 @@ def cleanUpLibs(self, buildAsStaticLibs): os.remove(static_bin_dir / config / 'freeglut.dll') shutil.rmtree(shared_bin_dir) - + def build(self, buildAsStaticLibs): physx_dir = self.workingDir / 'physx' @@ -199,27 +199,27 @@ def build(self, buildAsStaticLibs): os.chmod(packman_dir / 'packman', 0o755) # ensure packman is executable update_pacman_call = [ str(packman_dir / 'packman'), 'update', '-y'] - check_call_packman_update(update_pacman_call) + check_call_packman_update(update_pacman_call) preset, supports_gpu, bin_folder, install_folder, is_multiconfig = self.platform_params[self.platform] # if we are turning the GPU support off, and we are in a preset that supports GPU, we have to append wart to the end of the name if not self.enable_GPU and supports_gpu: preset += "-cpu-only" install_folder += "-cpu-only" - + if self._hostPlatformLower == 'windows': generate_projects_cmd = str(physx_dir / 'generate_projects.bat') else: generate_projects_cmd = str(physx_dir / 'generate_projects.sh') - + check_call_physx_dir = functools.partial(subprocess.check_call, cwd=physx_dir, # generate_projects script will fail if not called from physx directory env=self.env ) - + for config in ('release', 'profile', 'checked', 'debug'): self.preparePreset(buildAsStaticLibs, config); - + generate_call =[generate_projects_cmd, preset,] print(generate_call) check_call_physx_dir(generate_call) @@ -241,12 +241,12 @@ def build(self, buildAsStaticLibs): cmake_build_call =['cmake', '--build', build_dir, '--parallel'] print(cmake_build_call) self.check_call(cmake_build_call) - + # Delete bin inside install folder if exists (we'll copy them later in copyBuildOutputTo) bin_install_folder = physx_dir / 'install' / install_folder / 'PhysX' / 'bin' if bin_install_folder.exists(): shutil.rmtree(bin_install_folder) - + # Rename bin output folder to static/shared, avoiding the platform name in bin folder makes the FindPhysX.cmake simpler. if buildAsStaticLibs: shutil.move(physx_dir / 'bin' / bin_folder, physx_dir / 'bin' / 'static') @@ -254,7 +254,7 @@ def build(self, buildAsStaticLibs): else: shutil.move(physx_dir / 'bin' / bin_folder, physx_dir / 'bin' / 'shared') shutil.move(physx_dir / 'install' / install_folder, physx_dir / 'install' / 'shared') - + self.cleanUpLibs(buildAsStaticLibs) def build_all(self): @@ -267,7 +267,7 @@ def build_all(self): def copyBuildOutputTo(self, packageDir: pathlib.Path): if packageDir.exists(): shutil.rmtree(packageDir) - + shutil.copytree( src=self.workingDir / 'physx' / 'install' / 'static' / 'PhysX', @@ -427,7 +427,7 @@ def main(): with TemporaryDirectory() as tempdir: # Package Name packageName = f'{args.package_name}-{args.package_rev}-{args.platformName}' - + # Version 5.6.1 commits if args.platformName == 'mac': commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' @@ -437,18 +437,18 @@ def main(): commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' else: commit = '0af1ce283240f8618a94456b6b819f97724cf6b7' - + tempdir = Path(tempdir) builder = PhysXBuilder(workingDir=tempdir, basePackageSystemDir=packageSystemDir, targetPlatform=args.platformName, enable_GPU =args.enable_gpu) builder.clone(lockToCommit=commit) - + builder.build_all() builder.copyBuildOutputTo(packageRoot/'PhysX') - + builder.writePackageInfoFile( packageRoot, settings={ @@ -458,7 +458,7 @@ def main(): 'LicenseFile': 'PhysX/LICENSE.md' }, ) - + builder.writeCMakeFindFile( packageRoot, cmakeFindFile From dde821647844ed2a78f62275128ed89053c054bd Mon Sep 17 00:00:00 2001 From: Jason Q <119447878+iamjbq@users.noreply.github.com> Date: Fri, 24 Apr 2026 14:14:22 -0300 Subject: [PATCH 4/5] Fix for DCO of previous commits I, iamjbq <119447878+iamjbq@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 7d83f8b I, iamjbq <119447878+iamjbq@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 58d8204 I, iamjbq <119447878+iamjbq@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 6e218bd I, iamjbq <119447878+iamjbq@users.noreply.github.com>, hereby add my Signed-off-by to this commit: de52f48 Signed-off-by: Jason Q <119447878+iamjbq@users.noreply.github.com> From 21b96264a8c7d75798b45ca32930bb75910053b6 Mon Sep 17 00:00:00 2001 From: Jason Q <119447878+iamjbq@users.noreply.github.com> Date: Wed, 6 May 2026 13:08:01 -0300 Subject: [PATCH 5/5] Added current CUDA version comment + DCO fix for missing sign-off DCO Remediation Commit for Jason Q <119447878+iamjbq@users.noreply.github.com> I, Jason Q <119447878+iamjbq@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 58d8204 Signed-off-by: Jason Q <119447878+iamjbq@users.noreply.github.com> --- package-system/PhysX5/build_package_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-system/PhysX5/build_package_image.py b/package-system/PhysX5/build_package_image.py index 474446ce..df179041 100644 --- a/package-system/PhysX5/build_package_image.py +++ b/package-system/PhysX5/build_package_image.py @@ -35,7 +35,7 @@ def __init__(self, workingDir: pathlib.Path, basePackageSystemDir: pathlib.Path, ) if self.enable_GPU: - print(f"NOTE: Building PhysX with GPU support requires a CUDA installation, and has only been tested with CUDA v12.8.1") + print(f"NOTE: Building PhysX with GPU support requires a CUDA installation, and has only been tested with CUDA v12.8.1") # Current CUDA version is 13.2 as of March 2026 if self.enable_GPU and self._platform in ('windows'): if self._env.get("PM_CUDA_PATH") is None: