-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
93 lines (86 loc) · 3.85 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
cmake_minimum_required(VERSION 3.16)
project(physx-complete)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIGURATION>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIGURATION>)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY ON CACHE INTERNAL "")
set(TARGET_APPLE OFF)
set(TARGET_LINUX OFF)
set(TARGET_EMSCRIPTEN OFF)
set(TARGET_WINDOWS OFF)
set(TARGET_UWP OFF)
set(TARGET_ANDROID OFF)
if(CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES iOS OR CMAKE_SYSTEM_NAME MATCHES tvOS)
set(TARGET_APPLE ON CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_NAME MATCHES Linux)
set(TARGET_LINUX ON CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_NAME MATCHES Emscripten)
set(TARGET_EMSCRIPTEN ON CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(TARGET_UWP ON)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_WINDOWS ON)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
set(TARGET_ANDROID ON)
endif()
# DNDEBUG and DEBUG
add_compile_definitions(
$<IF:$<CONFIG:Debug>,_DEBUG,NDEBUG>
)
# PhysX-specific CMake project setup
set(NV_USE_DEBUG_WINCRT ON CACHE BOOL "Use the debug version of the CRT")
set(PHYSX_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/physx CACHE INTERNAL "")
set(PXSHARED_PATH ${PHYSX_ROOT_DIR}/../pxshared CACHE INTERNAL "")
set(PXSHARED_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "")
set(PX_PHYSX_ ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "")
set(CMAKEMODULES_VERSION "1.27" CACHE INTERNAL "")
set(CMAKEMODULES_PATH ${PHYSX_ROOT_DIR}/../externals/cmakemodules CACHE INTERNAL "")
set(PX_OUTPUT_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE INTERNAL "")
set(PX_OUTPUT_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} CACHE INTERNAL "")
set(PX_GENERATE_STATIC_LIBRARIES ON CACHE INTERNAL "")
set(GPU_LIB_COPIED 1 CACHE INTERNAL "")
#set(PX_FLOAT_POINT_PRECISE_MATH OFF)
if(TARGET_EMSCRIPTEN)
set(TARGET_BUILD_PLATFORM "linux" CACHE INTERNAL "")
set(PLATFORM "Linux" CACHE INTERNAL "")
elseif (WIN32)
if (UWP)
set(TARGET_BUILD_PLATFORM "windows" CACHE INTERNAL "")
set(PLATFORM "uwp")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_BUILD_PLATFORM "windows" CACHE INTERNAL "")
set(PLATFORM "Windows")
endif()
elseif(TARGET_APPLE)
set(TARGET_BUILD_PLATFORM "linux" CACHE INTERNAL "")
set(PLATFORM "macOS")
elseif(TARGET_LINUX)
set(TARGET_BUILD_PLATFORM "linux" CACHE INTERNAL "")
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu" CACHE INTERNAL "")
set(PLATFORM "Linux")
#set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-gnu" CACHE INTERNAL "")
elseif(TARGET_ANDROID)
set(TARGET_BUILD_PLATFORM "linux" CACHE INTERNAL "")
set(PLATFORM "Android")
endif()
# Call into PhysX's CMake scripts
add_subdirectory("physx/compiler/public")
if(TARGET_EMSCRIPTEN OR ( (TARGET_WINDOWS OR TARGET_UWP) AND CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64"))
# disable vectorization
target_compile_definitions(LowLevelAABB PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(SceneQuery PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(SimulationController PRIVATE "PX_SIMD_DISABLED" "DISABLE_CUDA_PHYSX")
target_compile_definitions(PhysXExtensions PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(PhysXVehicle PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(PhysXCommon PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(PhysX PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(PhysXFoundation PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(LowLevel PRIVATE "PX_SIMD_DISABLED" "DISABLE_CUDA_PHYSX")
target_compile_definitions(PhysXCooking PRIVATE "PX_SIMD_DISABLED")
target_compile_definitions(PhysXCharacterKinematic PRIVATE "PX_SIMD_DISABLED")
# endianness checks
target_compile_definitions(libnyquist PUBLIC "ARCH_CPU_LITTLE_ENDIAN")
target_compile_definitions("physfs-static" PUBLIC "MY_CPU_LE")
endif()