-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (102 loc) · 8.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
ez_cmake_init()
ez_requires_physx()
set(PHYSX_VERSION "4.1.2.29882248")
set(PHYSX_BINARY "")
set(PHYSX_BIN_DEBUG "debug")
set(PHYSX_BIN_DEV "dev")
set(PHYSX_BIN_SHIPPING "shipping")
set(PHYSX_URL "")
if (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
# use the older version for UWP
set(PHYSX_VERSION "4.1.1.27006925")
set(PHYSX_BIN_DEBUG "debug")
set(PHYSX_BIN_DEV "release")
set(PHYSX_BIN_SHIPPING "release")
if (EZ_CMAKE_ARCHITECTURE_ARM)
set(PHYSX_BINARY "uwp.arm_64.vc141")
set(PHYSX_URL "https://github.com/ezEngine/thirdparty/releases/download/PhysX-4.1.2/PhysX_4.1.1.27006925_uwp.arm_64.vc141.7z")
else()
set(PHYSX_BINARY "uwp.x86_64.vc141")
set(PHYSX_URL "https://github.com/ezEngine/thirdparty/releases/download/PhysX-4.1.2/PhysX_4.1.1.27006925_uwp.x86_64.vc141.7z")
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (EZ_CMAKE_ARCHITECTURE_ARM)
message(FATAL_ERROR "Physx does not support ARM on desktop.")
else()
set(PHYSX_BINARY "win.x86_64.vc142.md")
set(PHYSX_URL "https://github.com/ezEngine/thirdparty/releases/download/PhysX-4.1.2/PhysX_4.1.2.29882248_win.x86_64.vc142.md.7z")
endif()
else()
message(FATAL_ERROR "Unsupported or not implemented PhysX platform.")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PHYSX_LIB_SUFFIX "_64.lib")
set(PHYSX_DLL_SUFFIX "_64.dll")
else()
set(PHYSX_LIB_SUFFIX "_32.lib")
set(PHYSX_DLL_SUFFIX "_32.dll")
message(FATAL_ERROR "Unsupported or not implemented PhysX platform.")
endif()
set(PHYSX_BINS "${CMAKE_BINARY_DIR}/PhysX")
set(PHYSX_BIN_DIR "${PHYSX_BINS}/${PHYSX_BINARY}")
set(EZ_PHYSX_SDK "${CMAKE_CURRENT_SOURCE_DIR}/${PHYSX_VERSION}")
set(PHYSX_INC_DIR "${EZ_PHYSX_SDK}/PhysX/Include")
set(PXSHARED_INC_DIR "${EZ_PHYSX_SDK}/PxShared/include")
ez_download_and_extract("${PHYSX_URL}" "${PHYSX_BINS}" "${PHYSX_BINARY}" "7z")
add_library(ezPhysX::Foundation SHARED IMPORTED GLOBAL)
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXFoundation${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXFoundation${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXFoundation${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_IMPLIB_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXFoundation${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_IMPLIB_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXFoundation${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES IMPORTED_IMPLIB_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXFoundation${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Foundation PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PXSHARED_INC_DIR}")
ez_uwp_mark_import_as_content(ezPhysX::Foundation)
add_library(ezPhysX::PVD STATIC IMPORTED GLOBAL)
set_target_properties(ezPhysX::PVD PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXPvdSDK_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PVD PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXPvdSDK_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PVD PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXPvdSDK_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PVD PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PXSHARED_INC_DIR}")
target_link_libraries(ezPhysX::PVD INTERFACE ezPhysX::Foundation)
add_library(ezPhysX::Common SHARED IMPORTED GLOBAL)
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXCommon${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXCommon${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXCommon${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_IMPLIB_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXCommon${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_IMPLIB_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXCommon${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES IMPORTED_IMPLIB_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXCommon${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Common PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PHYSX_INC_DIR}")
target_link_libraries(ezPhysX::Common INTERFACE ezPhysX::Foundation)
ez_uwp_mark_import_as_content(ezPhysX::Common)
add_library(ezPhysX::PhysX SHARED IMPORTED GLOBAL)
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysX${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysX${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysX${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_IMPLIB_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysX${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_IMPLIB_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysX${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES IMPORTED_IMPLIB_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysX${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::PhysX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PHYSX_INC_DIR}")
target_link_libraries(ezPhysX::PhysX INTERFACE ezPhysX::Common)
ez_uwp_mark_import_as_content(ezPhysX::PhysX)
add_library(ezPhysX::Cooking SHARED IMPORTED GLOBAL)
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXCooking${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXCooking${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXCooking${PHYSX_DLL_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_IMPLIB_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXCooking${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_IMPLIB_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXCooking${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES IMPORTED_IMPLIB_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXCooking${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Cooking PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PHYSX_INC_DIR}")
target_link_libraries(ezPhysX::Cooking INTERFACE ezPhysX::Foundation)
ez_uwp_mark_import_as_content(ezPhysX::Cooking)
add_library(ezPhysX::Extensions STATIC IMPORTED GLOBAL)
set_target_properties(ezPhysX::Extensions PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXExtensions_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Extensions PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXExtensions_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Extensions PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXExtensions_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Extensions PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PHYSX_INC_DIR}")
target_link_libraries(ezPhysX::Extensions INTERFACE ezPhysX::PhysX)
add_library(ezPhysX::Character STATIC IMPORTED GLOBAL)
set_target_properties(ezPhysX::Character PROPERTIES IMPORTED_LOCATION_DEBUG "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEBUG}/PhysXCharacterKinematic_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Character PROPERTIES IMPORTED_LOCATION_DEV "${PHYSX_BIN_DIR}/${PHYSX_BIN_DEV}/PhysXCharacterKinematic_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Character PROPERTIES IMPORTED_LOCATION_SHIPPING "${PHYSX_BIN_DIR}/${PHYSX_BIN_SHIPPING}/PhysXCharacterKinematic_static${PHYSX_LIB_SUFFIX}")
set_target_properties(ezPhysX::Character PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PHYSX_INC_DIR}")
target_link_libraries(ezPhysX::Character INTERFACE ezPhysX::PhysX)