From 72a06b5d359e955e63284a83986f58b208384f9a Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Wed, 10 Jan 2024 13:27:49 -0800 Subject: [PATCH 01/12] - Update 3P name from PhysX to PhysX4 - Update FindPhysX.cmake output to FindPhysX4.cmake - Update PhysX4 package for windows and android to rev6 Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- Scripts/builders/vcpkgbuilder.py | 4 ++-- package-system/PhysX/FindPhysX.cmake.template | 2 +- package-system/PhysX/FindPhysX_ios.cmake.template | 2 +- package-system/PhysX/build_package_image.py | 11 ++++++++++- package_build_list_host_windows.json | 8 ++++---- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Scripts/builders/vcpkgbuilder.py b/Scripts/builders/vcpkgbuilder.py index c77d8149..3f805903 100644 --- a/Scripts/builders/vcpkgbuilder.py +++ b/Scripts/builders/vcpkgbuilder.py @@ -226,7 +226,7 @@ def writePackageInfoFile(self, packageDir: pathlib.Path, settings: dict): with (packageDir / 'PackageInfo.json').open('w') as fh: json.dump(settings, fh, indent=4) - def writeCMakeFindFile(self, packageDir: pathlib.Path, template, templateEnv:dict): - cmakeFindFile = packageDir / f'Find{self.packageName}.cmake' + def writeCMakeFindFile(self, packageDir: pathlib.Path, template, templateEnv:dict, overwrite_find_file:str or None): + cmakeFindFile = packageDir / f'Find{overwrite_find_file or self.packageName}.cmake' cmakeFindFile.write_text(string.Template(template).substitute(templateEnv)) diff --git a/package-system/PhysX/FindPhysX.cmake.template b/package-system/PhysX/FindPhysX.cmake.template index 2eff3212..d12d2d98 100644 --- a/package-system/PhysX/FindPhysX.cmake.template +++ b/package-system/PhysX/FindPhysX.cmake.template @@ -6,7 +6,7 @@ # # -set(MY_NAME "PhysX") +set(MY_NAME "PhysX4") set(TARGET_WITH_NAMESPACE "3rdParty::$${MY_NAME}") if (TARGET $${TARGET_WITH_NAMESPACE}) return() diff --git a/package-system/PhysX/FindPhysX_ios.cmake.template b/package-system/PhysX/FindPhysX_ios.cmake.template index ed837353..4374257c 100644 --- a/package-system/PhysX/FindPhysX_ios.cmake.template +++ b/package-system/PhysX/FindPhysX_ios.cmake.template @@ -6,7 +6,7 @@ # # -set(MY_NAME "PhysX") +set(MY_NAME "PhysX4") set(TARGET_WITH_NAMESPACE "3rdParty::$${MY_NAME}") if (TARGET $${TARGET_WITH_NAMESPACE}) return() diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index 29bc3874..444527b2 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -20,6 +20,14 @@ def main(): parser = argparse.ArgumentParser() + parser.add_argument( + '--package-name', + required=True + ) + parser.add_argument( + '--package-rev', + required=True + ) parser.add_argument( '--platform-name', dest='platformName', @@ -119,7 +127,7 @@ def main(): builder.writePackageInfoFile( outputDir, settings={ - 'PackageName': f'PhysX-4.1.2.29882248-rev6-{args.platformName}', + 'PackageName': f'{args.package_name}-{args.package_rev}-{args.platformName}', 'URL': 'https://github.com/NVIDIAGameWorks/PhysX', 'License': 'BSD-3-Clause', 'LicenseFile': 'PhysX/LICENSE.md' @@ -130,6 +138,7 @@ def main(): outputDir, template=cmakeFindFileTemplate, templateEnv=extraLibsPerPlatform[vcpkg_platform], + overwrite_find_file='PhysX4' ) firstTime = False diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index 0746dd76..7bd2351e 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -41,8 +41,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/build_package_image.py", "OpenXR-1.0.22-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Android --package-root ../../package-system --clean", "OpenXR-1.0.22-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Windows --package-root ../../package-system --clean", - "PhysX-4.1.2.29882248-rev5-android": "package-system/PhysX/build_package_image.py --platform android", - "PhysX-4.1.2.29882248-rev5-windows": "package-system/PhysX/build_package_image.py --platform windows", + "PhysX-4.1.2.29882248-rev6-android": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev6 --platform android", + "PhysX-4.1.2.29882248-rev6-windows": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev6 --platform windows", "PhysX-5.1.1-rev1-android": "package-system/PhysX5/build_package_image.py --platform android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/build_package_image.py --platform windows", "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", @@ -110,8 +110,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/temp/OpenSSL-windows", "OpenXR-1.0.22-rev1-android": "package-system/OpenXR-android", "OpenXR-1.0.22-rev1-windows": "package-system/OpenXR-windows", - "PhysX-4.1.2.29882248-rev5-android": "package-system/PhysX-android", - "PhysX-4.1.2.29882248-rev5-windows": "package-system/PhysX-windows", + "PhysX-4.1.2.29882248-rev6-android": "package-system/PhysX-android", + "PhysX-4.1.2.29882248-rev6-windows": "package-system/PhysX-windows", "PhysX-5.1.1-rev1-android": "package-system/PhysX5/temp/PhysX5-android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/temp/PhysX5-windows", "png-1.6.37-rev2-android": "package-system/libpng/temp/png-android", From 93178b4a8b709c50cf39f1d782bf5b04c47208e8 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:50:03 -0800 Subject: [PATCH 02/12] Update rev for windows and android to 7 Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package_build_list_host_windows.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index 7bd2351e..a974b1ca 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -41,8 +41,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/build_package_image.py", "OpenXR-1.0.22-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Android --package-root ../../package-system --clean", "OpenXR-1.0.22-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Windows --package-root ../../package-system --clean", - "PhysX-4.1.2.29882248-rev6-android": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev6 --platform android", - "PhysX-4.1.2.29882248-rev6-windows": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev6 --platform windows", + "PhysX-4.1.2.29882248-rev7-android": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform android", + "PhysX-4.1.2.29882248-rev7-windows": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform windows", "PhysX-5.1.1-rev1-android": "package-system/PhysX5/build_package_image.py --platform android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/build_package_image.py --platform windows", "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", @@ -110,8 +110,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/temp/OpenSSL-windows", "OpenXR-1.0.22-rev1-android": "package-system/OpenXR-android", "OpenXR-1.0.22-rev1-windows": "package-system/OpenXR-windows", - "PhysX-4.1.2.29882248-rev6-android": "package-system/PhysX-android", - "PhysX-4.1.2.29882248-rev6-windows": "package-system/PhysX-windows", + "PhysX-4.1.2.29882248-rev7-android": "package-system/PhysX-android", + "PhysX-4.1.2.29882248-rev7-windows": "package-system/PhysX-windows", "PhysX-5.1.1-rev1-android": "package-system/PhysX5/temp/PhysX5-android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/temp/PhysX5-windows", "png-1.6.37-rev2-android": "package-system/libpng/temp/png-android", From 5795c995626edea7f11c7222c2bc6e85a32fddc2 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:00:41 -0800 Subject: [PATCH 03/12] Update Mac/iOS packages Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package_build_list_host_darwin.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package_build_list_host_darwin.json b/package_build_list_host_darwin.json index 127b68f1..a8a1d5fa 100644 --- a/package_build_list_host_darwin.json +++ b/package_build_list_host_darwin.json @@ -26,8 +26,8 @@ "OpenSSL-1.1.1o-rev1-ios": "package-system/OpenSSL/build_package_image.py --platform ios", "OpenEXR-3.1.3-rev4-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Mac --package-root ../../package-system/OpenEXR/temp --clean", "openimageio-opencolorio-2.3.17-rev3-mac": "package-system/openimageio-opencolorio/build_openimageio.py --package-name=openimageio-opencolorio-2.3.17-rev3-mac --clean", - "PhysX-4.1.2.29882248-rev5-mac": "package-system/PhysX/build_package_image.py --platform mac", - "PhysX-4.1.2.29882248-rev5-ios": "package-system/PhysX/build_package_image.py --platform ios", + "PhysX-4.1.2.29882248-rev7-mac": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform mac", + "PhysX-4.1.2.29882248-rev7-ios": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform ios", "PhysX-5.1.1-rev1-mac": "package-system/PhysX5/build_package_image.py --platform mac", "PhysX-5.1.1-rev1-ios": "package-system/PhysX5/build_package_image.py --platform ios", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-mac": "package-system/NvCloth/build_package_image.py --platform-name mac", @@ -81,8 +81,8 @@ "tiff-4.2.0.15-rev3-ios": "package-system/tiff-ios", "python-3.10.5-rev2-darwin": "package-system/python/darwin_x64/package", "asn1-0.9.27-rev2-ios": "package-system/asn1-ios", - "PhysX-4.1.2.29882248-rev5-mac": "package-system/PhysX-mac", - "PhysX-4.1.2.29882248-rev5-ios": "package-system/PhysX-ios", + "PhysX-4.1.2.29882248-rev7-mac": "package-system/PhysX-mac", + "PhysX-4.1.2.29882248-rev7-ios": "package-system/PhysX-ios", "PhysX-5.1.1-rev1-mac": "package-system/PhysX5/temp/PhysX5-mac", "PhysX-5.1.1-rev1-ios": "package-system/PhysX5/temp/PhysX5-ios", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-mac": "package-system/NvCloth-mac", From 997c12fe3a330bf88a337ff5764ad6d7379804c6 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:39:55 +0000 Subject: [PATCH 04/12] Update Linux x86_64 package Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package_build_list_host_linux.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index a40a438f..5e8b1aec 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -26,7 +26,7 @@ "openimageio-opencolorio-2.3.17-rev2-linux": "package-system/openimageio-opencolorio/build_openimageio.py --package-name=openimageio-opencolorio-2.3.17-rev2-linux --clean", "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-rev6-linux": "package-system/PhysX/build_package_image.py --platform-name linux", + "PhysX-4.1.2.29882248-rev7-linux": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform-name linux", "PhysX-5.1.1-rev1-linux": "package-system/PhysX5/build_package_image.py --platform-name linux", "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", @@ -84,7 +84,7 @@ "tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux", "python-3.10.5-rev4-linux": "package-system/python/temp/python-linux", "python-3.10.5-rev4-linux-aarch64": "package-system/python/temp/python-linux-aarch64", - "PhysX-4.1.2.29882248-rev6-linux": "package-system/PhysX-linux", + "PhysX-4.1.2.29882248-rev7-linux": "package-system/PhysX-linux", "PhysX-5.1.1-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", From f1ec4138774097e9ebddf974ea9630ef26228c73 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:12:47 +0000 Subject: [PATCH 05/12] Update Linux aarch64 package Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package_build_list_host_linux-aarch64.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_build_list_host_linux-aarch64.json b/package_build_list_host_linux-aarch64.json index 9fc93d15..25304e5c 100644 --- a/package_build_list_host_linux-aarch64.json +++ b/package_build_list_host_linux-aarch64.json @@ -28,7 +28,7 @@ "OpenMesh-8.1-rev3-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenMesh --platform-name Linux-aarch64 --clean", "OpenSSL-1.1.1t-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenSSL --platform-name Linux-aarch64 --clean", "OpenXR-1.0.22-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Linux-aarch64 --clean", - "PhysX-4.1.2.29882248-rev5-linux-aarch64": "package-system/PhysX/build_package_image.py --platform-name linux-aarch64", + "PhysX-4.1.2.29882248-rev7-linux-aarch64": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform-name linux-aarch64", "PhysX-5.1.1-rev1-linux-aarch64": "package-system/PhysX5/build_package_image.py --platform-name linux-aarch64", "png-1.6.37-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Linux-aarch64 --clean", "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri/build_package_image.py --platform-name linux-aarch64", @@ -69,7 +69,7 @@ "OpenMesh-8.1-rev3-linux-aarch64": "package-system/OpenMesh/temp/OpenMesh-linux-aarch64", "OpenSSL-1.1.1t-rev1-linux-aarch64": "package-system/OpenSSL/temp/OpenSSL-linux-aarch64", "OpenXR-1.0.22-rev2-linux-aarch64": "package-system/OpenXR/temp/OpenXR-linux-aarch64", - "PhysX-4.1.2.29882248-rev5-linux-aarch64": "package-system/PhysX-linux-aarch64", + "PhysX-4.1.2.29882248-rev7-linux-aarch64": "package-system/PhysX-linux-aarch64", "PhysX-5.1.1-rev1-linux-aarch64": "package-system/PhysX5/temp/PhysX5-linux-aarch64", "png-1.6.37-rev2-linux-aarch64": "package-system/libpng/temp/png-linux-aarch64", "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri-linux-aarch64", From 8bebc7fcd549ead03ea74c5a9559b4a1e13190e4 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Sun, 21 Jan 2024 20:19:35 -0800 Subject: [PATCH 06/12] Updates to support only building static libraries and no shared libraries Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/PhysX/FindPhysX.cmake.template | 117 +++++++++--------- package-system/PhysX/build_package_image.py | 10 +- package_build_list_host_linux.json | 4 +- 3 files changed, 63 insertions(+), 68 deletions(-) diff --git a/package-system/PhysX/FindPhysX.cmake.template b/package-system/PhysX/FindPhysX.cmake.template index d12d2d98..c90c2f90 100644 --- a/package-system/PhysX/FindPhysX.cmake.template +++ b/package-system/PhysX/FindPhysX.cmake.template @@ -12,7 +12,7 @@ if (TARGET $${TARGET_WITH_NAMESPACE}) return() endif() -set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/$$,static,shared>) +set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/static) set(_PACKAGE_DIR_SHARED $${CMAKE_CURRENT_LIST_DIR}/PhysX/shared) set($${MY_NAME}_INCLUDE_DIR @@ -21,7 +21,7 @@ set($${MY_NAME}_INCLUDE_DIR $${_PACKAGE_DIR}/include/geometry ) -set($${MY_NAME}_COMPILE_DEFINITIONS $$<$$:PX_PHYSX_STATIC_LIB>) +set($${MY_NAME}_COMPILE_DEFINITIONS PX_PHYSX_STATIC_LIB) # LY_PHYSX_PROFILE_USE_CHECKED_LIBS allows to override what PhysX configuration to use on O3DE profile. set(LY_PHYSX_PROFILE_USE_CHECKED_LIBS OFF CACHE BOOL "When ON it uses PhysX SDK checked libraries on O3DE profile configuration") @@ -44,78 +44,73 @@ else() set(import_lib_suffix $${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() -set($${MY_NAME}_LIBRARIES - $${PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}PhysXCharacterKinematic_static_64$${CMAKE_STATIC_LIBRARY_SUFFIX} - $${PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}PhysXVehicle_static_64$${CMAKE_STATIC_LIBRARY_SUFFIX} - $${PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}PhysXExtensions_static_64$${CMAKE_STATIC_LIBRARY_SUFFIX} - $${PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}PhysXPvdSDK_static_64$${CMAKE_STATIC_LIBRARY_SUFFIX} +set(extra_static_libs ${EXTRA_STATIC_LIBS}) +set(extra_shared_libs ${EXTRA_SHARED_LIBS}) + + +# The order of PhysX 5.x static libraries is important for static targets. We will loop through in order and define +# each static library explicitly, while setting their dependency as a chain to ensure the order is preserved + +set(IMPORTED_PHYSICS_LIBS + PhysX_static_64 + PhysXPvdSDK_static_64 + PhysXVehicle_static_64 + PhysXCharacterKinematic_static_64 + PhysXExtensions_static_64 + PhysXCooking_static_64 + PhysXCommon_static_64 + PhysXFoundation_static_64 ) -set(extra_static_libs ${EXTRA_STATIC_LIBS_NON_MONOLITHIC}) -set(extra_shared_libs ${EXTRA_SHARED_LIBS}) +foreach(PHYSICS_LIB $${IMPORTED_PHYSICS_LIBS}) -if(LY_MONOLITHIC_GAME) - if(LY_PHYSX_PROFILE_USE_CHECKED_LIBS) - set(MONO_PATH_TO_STATIC_LIBS $${CMAKE_CURRENT_LIST_DIR}/PhysX/static/checked/lib) - else() - set(MONO_PATH_TO_STATIC_LIBS $${CMAKE_CURRENT_LIST_DIR}/PhysX/static/profile/lib) - endif() - # The order of PhysX 4.x static libraries is important for monolithic targets. - set(IMPORTED_PHYSICS_LIBS - PhysX_static_64 - PhysXPvdSDK_static_64 - PhysXVehicle_static_64 - PhysXCharacterKinematic_static_64 - PhysXExtensions_static_64 - PhysXCooking_static_64 - PhysXCommon_static_64 - PhysXFoundation_static_64 - ) - foreach(PHYSICS_LIB $${IMPORTED_PHYSICS_LIBS}) - add_library($${PHYSICS_LIB}::imported STATIC IMPORTED GLOBAL) - set($${PHYSICS_LIB}_PATH $${MONO_PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX}) - set_target_properties($${PHYSICS_LIB}::imported - PROPERTIES - IMPORTED_LOCATION_DEBUG $${$${PHYSICS_LIB}_PATH} - IMPORTED_LOCATION_PROFILE $${$${PHYSICS_LIB}_PATH} - IMPORTED_LOCATION_RELEASE $${$${PHYSICS_LIB}_PATH} - ) - target_link_libraries($${PHYSICS_LIB}::imported INTERFACE - $${PREVIOUS_PHYSICS_LIB} - $${MONO_PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - set (PREVIOUS_PHYSICS_LIB $${PHYSICS_LIB}::imported) - endforeach() - - add_library(Physx4_STATIC_LIBS_FOR_MONOLITHIC::imported INTERFACE IMPORTED GLOBAL) - target_link_libraries(Physx4_STATIC_LIBS_FOR_MONOLITHIC::imported INTERFACE - PhysXFoundation_static_64::imported + # Set the individual target names to include a $${MY_NAME} prefix in order to prevent collisions + # with other 3rd party PhysX Packages of different versions while retaining the same actual + # filename + + set(PHYSICS_LIB_NAME $${MY_NAME}$${PHYSICS_LIB}) + + add_library($${PHYSICS_LIB_NAME}::imported STATIC IMPORTED GLOBAL) + + # Set the import location (note: generator expressions are not supported as properties here, so each config needs to be explicit for its location) + set_target_properties($${PHYSICS_LIB_NAME}::imported + PROPERTIES + IMPORTED_LOCATION_DEBUG $${_PACKAGE_DIR}/debug/lib/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_PROFILE $${_PACKAGE_DIR}/$${PHYSX_PROFILE_CONFIG}/lib/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE $${_PACKAGE_DIR}/lib/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX} ) -else() - list(APPEND $${MY_NAME}_LIBRARIES - $${PATH_TO_IMPORT_LIBS}/$${import_lib_prefix}PhysX_64$${import_lib_suffix} - $${PATH_TO_IMPORT_LIBS}/$${import_lib_prefix}PhysXCooking_64$${import_lib_suffix} - $${PATH_TO_IMPORT_LIBS}/$${import_lib_prefix}PhysXFoundation_64$${import_lib_suffix} - $${PATH_TO_IMPORT_LIBS}/$${import_lib_prefix}PhysXCommon_64$${import_lib_suffix} - $${extra_static_libs} + + # Set the target libraries dependency on any previous lib to build the order chain + target_link_libraries($${PHYSICS_LIB_NAME}::imported INTERFACE + $${PREVIOUS_PHYSICS_LIB} + $${PATH_TO_STATIC_LIBS}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${PHYSICS_LIB}$${CMAKE_STATIC_LIBRARY_SUFFIX} ) + set (PREVIOUS_PHYSICS_LIB $${PHYSICS_LIB_NAME}::imported) + +endforeach() + +add_library($${MY_NAME}_STATIC_LIBS::imported INTERFACE IMPORTED GLOBAL) + +target_link_libraries($${MY_NAME}_STATIC_LIBS::imported INTERFACE + $${PREVIOUS_PHYSICS_LIB} + $${extra_static_libs} +) + +# Add any optional shared library dependency as a runtime dependency +if(extra_shared_libs) set($${MY_NAME}_RUNTIME_DEPENDENCIES - $${PATH_TO_SHARED_LIBS}/$${CMAKE_SHARED_LIBRARY_PREFIX}PhysX_64$${CMAKE_SHARED_LIBRARY_SUFFIX} - $${PATH_TO_SHARED_LIBS}/$${CMAKE_SHARED_LIBRARY_PREFIX}PhysXCooking_64$${CMAKE_SHARED_LIBRARY_SUFFIX} - $${PATH_TO_SHARED_LIBS}/$${CMAKE_SHARED_LIBRARY_PREFIX}PhysXFoundation_64$${CMAKE_SHARED_LIBRARY_SUFFIX} - $${PATH_TO_SHARED_LIBS}/$${CMAKE_SHARED_LIBRARY_PREFIX}PhysXCommon_64$${CMAKE_SHARED_LIBRARY_SUFFIX} $${extra_shared_libs} ) endif() add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL) + ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR}) -if(LY_MONOLITHIC_GAME) - target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE Physx4_STATIC_LIBS_FOR_MONOLITHIC::imported) -else() - target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_LIBRARIES}) -endif() + +target_link_libraries($${TARGET_WITH_NAMESPACE} INTERFACE $${MY_NAME}_STATIC_LIBS::imported) + target_compile_definitions($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_COMPILE_DEFINITIONS}) + if(DEFINED $${MY_NAME}_RUNTIME_DEPENDENCIES) ly_add_target_files(TARGETS $${TARGET_WITH_NAMESPACE} FILES $${$${MY_NAME}_RUNTIME_DEPENDENCIES}) endif() diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index 444527b2..f487fa2b 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -61,14 +61,14 @@ def main(): extraLibsPerPlatform = { 'linux': { 'EXTRA_SHARED_LIBS': '${PATH_TO_SHARED_LIBS}/libPhysXGpu_64.so', - 'EXTRA_STATIC_LIBS_NON_MONOLITHIC': '', + 'EXTRA_STATIC_LIBS': '', }, 'windows': { 'EXTRA_SHARED_LIBS': '\n'.join(( '${PATH_TO_SHARED_LIBS}/PhysXDevice64.dll', '${PATH_TO_SHARED_LIBS}/PhysXGpu_64.dll' )), - 'EXTRA_STATIC_LIBS_NON_MONOLITHIC': '\n'.join(( + 'EXTRA_STATIC_LIBS': '\n'.join(( '${PATH_TO_STATIC_LIBS}/LowLevel_static_64.lib', '${PATH_TO_STATIC_LIBS}/LowLevelAABB_static_64.lib', '${PATH_TO_STATIC_LIBS}/LowLevelDynamics_static_64.lib', @@ -79,15 +79,15 @@ def main(): }, 'mac': { 'EXTRA_SHARED_LIBS': '', - 'EXTRA_STATIC_LIBS_NON_MONOLITHIC': '', + 'EXTRA_STATIC_LIBS': '', }, 'ios': { 'EXTRA_SHARED_LIBS': '', - 'EXTRA_STATIC_LIBS_NON_MONOLITHIC': '', + 'EXTRA_STATIC_LIBS': '', }, 'android': { 'EXTRA_SHARED_LIBS': '', - 'EXTRA_STATIC_LIBS_NON_MONOLITHIC': '', + 'EXTRA_STATIC_LIBS': '', }, } with TemporaryDirectory() as tempdir: diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index 5e8b1aec..e3dbe269 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -26,7 +26,7 @@ "openimageio-opencolorio-2.3.17-rev2-linux": "package-system/openimageio-opencolorio/build_openimageio.py --package-name=openimageio-opencolorio-2.3.17-rev2-linux --clean", "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-rev7-linux": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform-name linux", + "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-rev1-linux": "package-system/PhysX5/build_package_image.py --platform-name linux", "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", @@ -84,7 +84,7 @@ "tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux", "python-3.10.5-rev4-linux": "package-system/python/temp/python-linux", "python-3.10.5-rev4-linux-aarch64": "package-system/python/temp/python-linux-aarch64", - "PhysX-4.1.2.29882248-rev7-linux": "package-system/PhysX-linux", + "PhysX-4.1.2.29882248-rev8-linux": "package-system/PhysX-linux", "PhysX-5.1.1-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", From fe60fd1e086b539e8ab77eb6c04aface2bf8212c Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:53:57 -0800 Subject: [PATCH 07/12] Update script to remove unnecessary shared libraries in the final output package Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/PhysX/build_package_image.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index f487fa2b..1c014aca 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -62,6 +62,7 @@ def main(): 'linux': { 'EXTRA_SHARED_LIBS': '${PATH_TO_SHARED_LIBS}/libPhysXGpu_64.so', 'EXTRA_STATIC_LIBS': '', + 'KEEP_SHARED_LIBS': ['libPhysXGpu_64.so'], }, 'windows': { 'EXTRA_SHARED_LIBS': '\n'.join(( @@ -76,18 +77,22 @@ def main(): '${PATH_TO_STATIC_LIBS}/SceneQuery_static_64.lib', '${PATH_TO_STATIC_LIBS}/SimulationController_static_64.lib', )), + 'KEEP_SHARED_LIBS': ['PhysXDevice64.dll', 'PhysXGpu_64.dll'], }, 'mac': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', + 'KEEP_SHARED_LIBS': [], }, 'ios': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', + 'KEEP_SHARED_LIBS': [], }, 'android': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', + 'KEEP_SHARED_LIBS': [], }, } with TemporaryDirectory() as tempdir: @@ -122,6 +127,15 @@ def main(): }, subdir=subdir ) + if not maybeStatic: + # Delete everything in the shared folder except for ones that are marked for keeping + output_shared_folder = outputDir / builder.packageName / 'shared' + for clear_root, clear_dirs, clear_files in os.walk(str(output_shared_folder)): + keep_shared_files = extraLibsPerPlatform[vcpkg_platform]['KEEP_SHARED_LIBS'] + for clear_filename in clear_files: + if clear_filename in keep_shared_files: + continue + os.remove(os.path.join(clear_root, clear_filename)) if firstTime: builder.writePackageInfoFile( From ebeb664355bd6f45529adaa5161ef9033a33b327 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:04:47 -0800 Subject: [PATCH 08/12] Updates to support static only builds for Windows Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/PhysX/FindPhysX.cmake.template | 9 +++-- package-system/PhysX/build_package_image.py | 34 ++++++++++++------- package_build_list_host_windows.json | 8 ++--- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/package-system/PhysX/FindPhysX.cmake.template b/package-system/PhysX/FindPhysX.cmake.template index c90c2f90..86f2541a 100644 --- a/package-system/PhysX/FindPhysX.cmake.template +++ b/package-system/PhysX/FindPhysX.cmake.template @@ -33,6 +33,7 @@ endif() set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/$$,debug,$$<$$:$${PHYSX_PROFILE_CONFIG}>>/lib) set(PATH_TO_SHARED_LIBS $${_PACKAGE_DIR_SHARED}/$$,debug,$$<$$:$${PHYSX_PROFILE_CONFIG}>>/bin) +set(PATH_TO_ADDITIONAL_STATIC_LIBS $${_PACKAGE_DIR_SHARED}/$$,debug,$$<$$:$${PHYSX_PROFILE_CONFIG}>>/lib) if(DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX) set(PATH_TO_IMPORT_LIBS $${PATH_TO_STATIC_LIBS}) @@ -44,9 +45,13 @@ else() set(import_lib_suffix $${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() -set(extra_static_libs ${EXTRA_STATIC_LIBS}) -set(extra_shared_libs ${EXTRA_SHARED_LIBS}) +set(extra_static_libs +${EXTRA_STATIC_LIBS} +) +set(extra_shared_libs +${EXTRA_SHARED_LIBS} +) # The order of PhysX 5.x static libraries is important for static targets. We will loop through in order and define # each static library explicitly, while setting their dependency as a chain to ensure the order is preserved diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index 1c014aca..ec4c719c 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -62,7 +62,7 @@ def main(): 'linux': { 'EXTRA_SHARED_LIBS': '${PATH_TO_SHARED_LIBS}/libPhysXGpu_64.so', 'EXTRA_STATIC_LIBS': '', - 'KEEP_SHARED_LIBS': ['libPhysXGpu_64.so'], + 'KEEP_LIBS': ['libPhysXGpu_64.so'], }, 'windows': { 'EXTRA_SHARED_LIBS': '\n'.join(( @@ -70,29 +70,36 @@ def main(): '${PATH_TO_SHARED_LIBS}/PhysXGpu_64.dll' )), 'EXTRA_STATIC_LIBS': '\n'.join(( - '${PATH_TO_STATIC_LIBS}/LowLevel_static_64.lib', - '${PATH_TO_STATIC_LIBS}/LowLevelAABB_static_64.lib', - '${PATH_TO_STATIC_LIBS}/LowLevelDynamics_static_64.lib', - '${PATH_TO_STATIC_LIBS}/PhysXTask_static_64.lib', - '${PATH_TO_STATIC_LIBS}/SceneQuery_static_64.lib', - '${PATH_TO_STATIC_LIBS}/SimulationController_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/LowLevel_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/LowLevelAABB_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/LowLevelDynamics_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/PhysXTask_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/SceneQuery_static_64.lib', + '${PATH_TO_ADDITIONAL_STATIC_LIBS}/SimulationController_static_64.lib', )), - 'KEEP_SHARED_LIBS': ['PhysXDevice64.dll', 'PhysXGpu_64.dll'], + 'KEEP_LIBS': ['PhysXDevice64.dll', + 'PhysXGpu_64.dll', + 'LowLevel_static_64.lib', + 'LowLevelAABB_static_64.lib', + 'LowLevelDynamics_static_64.lib', + 'PhysXTask_static_64.lib', + 'SceneQuery_static_64.lib', + 'SimulationController_static_64.lib'], }, 'mac': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', - 'KEEP_SHARED_LIBS': [], + 'KEEP_LIBS': [], }, 'ios': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', - 'KEEP_SHARED_LIBS': [], + 'KEEP_LIBS': [], }, 'android': { 'EXTRA_SHARED_LIBS': '', 'EXTRA_STATIC_LIBS': '', - 'KEEP_SHARED_LIBS': [], + 'KEEP_LIBS': [], }, } with TemporaryDirectory() as tempdir: @@ -128,10 +135,11 @@ def main(): subdir=subdir ) if not maybeStatic: - # Delete everything in the shared folder except for ones that are marked for keeping + # Delete everything in the shared folder except for ones that are marked for keeping (static libraries) + # to reduce the size of the package. output_shared_folder = outputDir / builder.packageName / 'shared' for clear_root, clear_dirs, clear_files in os.walk(str(output_shared_folder)): - keep_shared_files = extraLibsPerPlatform[vcpkg_platform]['KEEP_SHARED_LIBS'] + keep_shared_files = extraLibsPerPlatform[vcpkg_platform]['KEEP_LIBS'] for clear_filename in clear_files: if clear_filename in keep_shared_files: continue diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index a974b1ca..c77f595f 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -41,8 +41,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/build_package_image.py", "OpenXR-1.0.22-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Android --package-root ../../package-system --clean", "OpenXR-1.0.22-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Windows --package-root ../../package-system --clean", - "PhysX-4.1.2.29882248-rev7-android": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform android", - "PhysX-4.1.2.29882248-rev7-windows": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform windows", + "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-rev1-android": "package-system/PhysX5/build_package_image.py --platform android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/build_package_image.py --platform windows", "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", @@ -110,8 +110,8 @@ "OpenSSL-1.1.1o-rev1-windows": "package-system/OpenSSL/temp/OpenSSL-windows", "OpenXR-1.0.22-rev1-android": "package-system/OpenXR-android", "OpenXR-1.0.22-rev1-windows": "package-system/OpenXR-windows", - "PhysX-4.1.2.29882248-rev7-android": "package-system/PhysX-android", - "PhysX-4.1.2.29882248-rev7-windows": "package-system/PhysX-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-rev1-android": "package-system/PhysX5/temp/PhysX5-android", "PhysX-5.1.1-rev2-windows": "package-system/PhysX5/temp/PhysX5-windows", "png-1.6.37-rev2-android": "package-system/libpng/temp/png-android", From cdfbf5bbccb87cd03b7d56c3a4f96a130e419e53 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Mon, 22 Jan 2024 17:01:55 -0800 Subject: [PATCH 09/12] Prevent non-windows platforms from building the shared libraries Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/PhysX/build_package_image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index ec4c719c..126e7516 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -109,6 +109,8 @@ def main(): # We package PhysX static and dynamic libraries for all supported platforms for maybeStatic in (True, False): + if not maybeStatic and vcpkg_platform != 'windows': + continue builder = VcpkgBuilder( packageName='PhysX', portName='physx', From 9f55a39d60b3249ea07570ed3cdb4fd34d42f868 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:19:24 -0800 Subject: [PATCH 10/12] Updates for mac and ios Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- .../PhysX/FindPhysX_ios.cmake.template | 38 +++++-------------- package_build_list_host_darwin.json | 8 ++-- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/package-system/PhysX/FindPhysX_ios.cmake.template b/package-system/PhysX/FindPhysX_ios.cmake.template index 4374257c..f4b8e213 100644 --- a/package-system/PhysX/FindPhysX_ios.cmake.template +++ b/package-system/PhysX/FindPhysX_ios.cmake.template @@ -12,7 +12,7 @@ if (TARGET $${TARGET_WITH_NAMESPACE}) return() endif() -set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/$$,static,shared>) +set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/static) set($${MY_NAME}_INCLUDE_DIR $${_PACKAGE_DIR}/include @@ -20,7 +20,7 @@ set($${MY_NAME}_INCLUDE_DIR $${_PACKAGE_DIR}/include/geometry ) -set($${MY_NAME}_COMPILE_DEFINITIONS $$<$$:PX_PHYSX_STATIC_LIB>) +set($${MY_NAME}_COMPILE_DEFINITIONS PX_PHYSX_STATIC_LIB) # LY_PHYSX_PROFILE_USE_CHECKED_LIBS allows to override what PhysX configuration to use on O3DE profile. set(LY_PHYSX_PROFILE_USE_CHECKED_LIBS OFF CACHE BOOL "When ON it uses PhysX SDK checked libraries on O3DE profile configuration") @@ -30,17 +30,7 @@ else() set(PHYSX_PROFILE_CONFIG "profile") endif() -if(LY_MONOLITHIC_GAME) - set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/$$,debug,$$<$$:$${PHYSX_PROFILE_CONFIG}>>/lib) -else() - # Frameworks are added and managed by XCode during the build process. - # At the moment $$ does not get replaced for "debug", "profile" or - # "release" for frameworks when added to XCode, so it's not able to find - # the frameworks since their path is wrong. To workaround this, for now it - # will only use the release version of the library. - set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/lib) - set(PATH_TO_SHARED_LIBS $${_PACKAGE_DIR}/bin) -endif() +set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/$$,debug,$$<$$:$${PHYSX_PROFILE_CONFIG}>>/lib) set($${MY_NAME}_LIBRARIES $${PATH_TO_STATIC_LIBS}/libPhysXCharacterKinematic_static_64.a @@ -48,21 +38,13 @@ set($${MY_NAME}_LIBRARIES $${PATH_TO_STATIC_LIBS}/libPhysXExtensions_static_64.a $${PATH_TO_STATIC_LIBS}/libPhysXPvdSDK_static_64.a ) -if(LY_MONOLITHIC_GAME) - list(APPEND $${MY_NAME}_LIBRARIES - $${PATH_TO_STATIC_LIBS}/libPhysX_static_64.a - $${PATH_TO_STATIC_LIBS}/libPhysXCooking_static_64.a - $${PATH_TO_STATIC_LIBS}/libPhysXFoundation_static_64.a - $${PATH_TO_STATIC_LIBS}/libPhysXCommon_static_64.a - ) -else() - list(APPEND $${MY_NAME}_LIBRARIES - $${PATH_TO_SHARED_LIBS}/PhysX.framework - $${PATH_TO_SHARED_LIBS}/PhysXCooking.framework - $${PATH_TO_SHARED_LIBS}/PhysXFoundation.framework - $${PATH_TO_SHARED_LIBS}/PhysXCommon.framework - ) -endif() + +list(APPEND $${MY_NAME}_LIBRARIES + $${PATH_TO_STATIC_LIBS}/libPhysX_static_64.a + $${PATH_TO_STATIC_LIBS}/libPhysXCooking_static_64.a + $${PATH_TO_STATIC_LIBS}/libPhysXFoundation_static_64.a + $${PATH_TO_STATIC_LIBS}/libPhysXCommon_static_64.a +) add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL) ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR}) diff --git a/package_build_list_host_darwin.json b/package_build_list_host_darwin.json index a8a1d5fa..031b3925 100644 --- a/package_build_list_host_darwin.json +++ b/package_build_list_host_darwin.json @@ -26,8 +26,8 @@ "OpenSSL-1.1.1o-rev1-ios": "package-system/OpenSSL/build_package_image.py --platform ios", "OpenEXR-3.1.3-rev4-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Mac --package-root ../../package-system/OpenEXR/temp --clean", "openimageio-opencolorio-2.3.17-rev3-mac": "package-system/openimageio-opencolorio/build_openimageio.py --package-name=openimageio-opencolorio-2.3.17-rev3-mac --clean", - "PhysX-4.1.2.29882248-rev7-mac": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform mac", - "PhysX-4.1.2.29882248-rev7-ios": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform ios", + "PhysX-4.1.2.29882248-rev8-mac": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform mac", + "PhysX-4.1.2.29882248-rev8-ios": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform ios", "PhysX-5.1.1-rev1-mac": "package-system/PhysX5/build_package_image.py --platform mac", "PhysX-5.1.1-rev1-ios": "package-system/PhysX5/build_package_image.py --platform ios", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-mac": "package-system/NvCloth/build_package_image.py --platform-name mac", @@ -81,8 +81,8 @@ "tiff-4.2.0.15-rev3-ios": "package-system/tiff-ios", "python-3.10.5-rev2-darwin": "package-system/python/darwin_x64/package", "asn1-0.9.27-rev2-ios": "package-system/asn1-ios", - "PhysX-4.1.2.29882248-rev7-mac": "package-system/PhysX-mac", - "PhysX-4.1.2.29882248-rev7-ios": "package-system/PhysX-ios", + "PhysX-4.1.2.29882248-rev8-mac": "package-system/PhysX-mac", + "PhysX-4.1.2.29882248-rev8-ios": "package-system/PhysX-ios", "PhysX-5.1.1-rev1-mac": "package-system/PhysX5/temp/PhysX5-mac", "PhysX-5.1.1-rev1-ios": "package-system/PhysX5/temp/PhysX5-ios", "NvCloth-v1.1.6-4-gd243404-pr58-rev1-mac": "package-system/NvCloth-mac", From de2aa36f4efd6f5537c807d79cfca3280a0a83f7 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:15:35 +0000 Subject: [PATCH 11/12] Update for Linux aarch64 Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package_build_list_host_linux-aarch64.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_build_list_host_linux-aarch64.json b/package_build_list_host_linux-aarch64.json index 25304e5c..05f13959 100644 --- a/package_build_list_host_linux-aarch64.json +++ b/package_build_list_host_linux-aarch64.json @@ -28,7 +28,7 @@ "OpenMesh-8.1-rev3-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenMesh --platform-name Linux-aarch64 --clean", "OpenSSL-1.1.1t-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenSSL --platform-name Linux-aarch64 --clean", "OpenXR-1.0.22-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenXR --platform-name Linux-aarch64 --clean", - "PhysX-4.1.2.29882248-rev7-linux-aarch64": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev7 --platform-name linux-aarch64", + "PhysX-4.1.2.29882248-rev8-linux-aarch64": "package-system/PhysX/build_package_image.py --package-name PhysX-4.1.2.29882248 --package-rev rev8 --platform-name linux-aarch64", "PhysX-5.1.1-rev1-linux-aarch64": "package-system/PhysX5/build_package_image.py --platform-name linux-aarch64", "png-1.6.37-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Linux-aarch64 --clean", "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri/build_package_image.py --platform-name linux-aarch64", @@ -69,7 +69,7 @@ "OpenMesh-8.1-rev3-linux-aarch64": "package-system/OpenMesh/temp/OpenMesh-linux-aarch64", "OpenSSL-1.1.1t-rev1-linux-aarch64": "package-system/OpenSSL/temp/OpenSSL-linux-aarch64", "OpenXR-1.0.22-rev2-linux-aarch64": "package-system/OpenXR/temp/OpenXR-linux-aarch64", - "PhysX-4.1.2.29882248-rev7-linux-aarch64": "package-system/PhysX-linux-aarch64", + "PhysX-4.1.2.29882248-rev8-linux-aarch64": "package-system/PhysX-linux-aarch64", "PhysX-5.1.1-rev1-linux-aarch64": "package-system/PhysX5/temp/PhysX5-linux-aarch64", "png-1.6.37-rev2-linux-aarch64": "package-system/libpng/temp/png-linux-aarch64", "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri-linux-aarch64", From 71af1081ecf2484d218d37e32b34e16ec941f85d Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Wed, 24 Jan 2024 02:07:37 +0000 Subject: [PATCH 12/12] Fix for Linux Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/PhysX/build_package_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-system/PhysX/build_package_image.py b/package-system/PhysX/build_package_image.py index 126e7516..35c1b4b7 100644 --- a/package-system/PhysX/build_package_image.py +++ b/package-system/PhysX/build_package_image.py @@ -109,7 +109,7 @@ def main(): # We package PhysX static and dynamic libraries for all supported platforms for maybeStatic in (True, False): - if not maybeStatic and vcpkg_platform != 'windows': + if not maybeStatic and vcpkg_platform not in ['windows', 'linux']: continue builder = VcpkgBuilder( packageName='PhysX',