|
@@ -6,13 +6,13 @@
|
|
#
|
|
#
|
|
#
|
|
#
|
|
|
|
|
|
-set(MY_NAME "PhysX")
|
|
|
|
|
|
+set(MY_NAME "PhysX4")
|
|
set(TARGET_WITH_NAMESPACE "3rdParty::$${MY_NAME}")
|
|
set(TARGET_WITH_NAMESPACE "3rdParty::$${MY_NAME}")
|
|
if (TARGET $${TARGET_WITH_NAMESPACE})
|
|
if (TARGET $${TARGET_WITH_NAMESPACE})
|
|
return()
|
|
return()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
-set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/$$<IF:$$<BOOL:$${LY_MONOLITHIC_GAME}>,static,shared>)
|
|
|
|
|
|
+set(_PACKAGE_DIR $${CMAKE_CURRENT_LIST_DIR}/PhysX/static)
|
|
set(_PACKAGE_DIR_SHARED $${CMAKE_CURRENT_LIST_DIR}/PhysX/shared)
|
|
set(_PACKAGE_DIR_SHARED $${CMAKE_CURRENT_LIST_DIR}/PhysX/shared)
|
|
|
|
|
|
set($${MY_NAME}_INCLUDE_DIR
|
|
set($${MY_NAME}_INCLUDE_DIR
|
|
@@ -21,7 +21,7 @@ set($${MY_NAME}_INCLUDE_DIR
|
|
$${_PACKAGE_DIR}/include/geometry
|
|
$${_PACKAGE_DIR}/include/geometry
|
|
)
|
|
)
|
|
|
|
|
|
-set($${MY_NAME}_COMPILE_DEFINITIONS $$<$$<BOOL:$${LY_MONOLITHIC_GAME}>: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.
|
|
# 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")
|
|
set(LY_PHYSX_PROFILE_USE_CHECKED_LIBS OFF CACHE BOOL "When ON it uses PhysX SDK checked libraries on O3DE profile configuration")
|
|
@@ -33,6 +33,7 @@ endif()
|
|
|
|
|
|
set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/$$<IF:$$<CONFIG:debug>,debug,$$<$$<CONFIG:profile>:$${PHYSX_PROFILE_CONFIG}>>/lib)
|
|
set(PATH_TO_STATIC_LIBS $${_PACKAGE_DIR}/$$<IF:$$<CONFIG:debug>,debug,$$<$$<CONFIG:profile>:$${PHYSX_PROFILE_CONFIG}>>/lib)
|
|
set(PATH_TO_SHARED_LIBS $${_PACKAGE_DIR_SHARED}/$$<IF:$$<CONFIG:debug>,debug,$$<$$<CONFIG:profile>:$${PHYSX_PROFILE_CONFIG}>>/bin)
|
|
set(PATH_TO_SHARED_LIBS $${_PACKAGE_DIR_SHARED}/$$<IF:$$<CONFIG:debug>,debug,$$<$$<CONFIG:profile>:$${PHYSX_PROFILE_CONFIG}>>/bin)
|
|
|
|
+set(PATH_TO_ADDITIONAL_STATIC_LIBS $${_PACKAGE_DIR_SHARED}/$$<IF:$$<CONFIG:debug>,debug,$$<$$<CONFIG:profile>:$${PHYSX_PROFILE_CONFIG}>>/lib)
|
|
|
|
|
|
if(DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX)
|
|
if(DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX)
|
|
set(PATH_TO_IMPORT_LIBS $${PATH_TO_STATIC_LIBS})
|
|
set(PATH_TO_IMPORT_LIBS $${PATH_TO_STATIC_LIBS})
|
|
@@ -44,78 +45,77 @@ else()
|
|
set(import_lib_suffix $${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
set(import_lib_suffix $${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
endif()
|
|
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_static_libs ${EXTRA_STATIC_LIBS_NON_MONOLITHIC})
|
|
|
|
-set(extra_shared_libs ${EXTRA_SHARED_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(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
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+foreach(PHYSICS_LIB $${IMPORTED_PHYSICS_LIBS})
|
|
|
|
+
|
|
|
|
+ # 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
|
|
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}
|
|
$${extra_shared_libs}
|
|
)
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
|
|
add_library($${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL)
|
|
|
|
+
|
|
ly_target_include_system_directories(TARGET $${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_INCLUDE_DIR})
|
|
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})
|
|
target_compile_definitions($${TARGET_WITH_NAMESPACE} INTERFACE $${$${MY_NAME}_COMPILE_DEFINITIONS})
|
|
|
|
+
|
|
if(DEFINED $${MY_NAME}_RUNTIME_DEPENDENCIES)
|
|
if(DEFINED $${MY_NAME}_RUNTIME_DEPENDENCIES)
|
|
ly_add_target_files(TARGETS $${TARGET_WITH_NAMESPACE} FILES $${$${MY_NAME}_RUNTIME_DEPENDENCIES})
|
|
ly_add_target_files(TARGETS $${TARGET_WITH_NAMESPACE} FILES $${$${MY_NAME}_RUNTIME_DEPENDENCIES})
|
|
endif()
|
|
endif()
|