Add physx library

This commit is contained in:
bailehuni 2024-07-29 23:51:46 +01:00
parent 97dcc0c75e
commit 9efc001e26
3 changed files with 30 additions and 5 deletions

View File

@ -7,6 +7,8 @@ option(ENGINE_BUILD_TEST "Compile the test program" ON)
if (MSVC) if (MSVC)
option(ENGINE_HOT_RELOAD "Enable VS hot reload" OFF) option(ENGINE_HOT_RELOAD "Enable VS hot reload" OFF)
endif() endif()
option(ENGINE_PHYSX_INCLUDE_DIR "Path to the PhysX SDK include directory" "")
option(ENGINE_PHYSX_LIBRARY_DIR "PhysX library location (often different per build configuration)" "")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo") set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
@ -218,4 +220,15 @@ target_link_libraries(${PROJECT_NAME} PUBLIC mikktspace)
# weldmesh # weldmesh
add_subdirectory(vendor/weldmesh) add_subdirectory(vendor/weldmesh)
target_link_libraries(${PROJECT_NAME} PUBLIC weldmesh) target_link_libraries(${PROJECT_NAME} PUBLIC weldmesh)
# PhysX 5
target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_PHYSX_INCLUDE_DIR})
target_link_directories(${PROJECT_NAME} PUBLIC ${ENGINE_PHYSX_LIBRARY_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC
PhysXCooking_64
PVDRuntime_64
PhysX_64
PhysXCommon_64
PhysXFoundation_64
)

View File

@ -30,7 +30,9 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"ENGINETEST_BUILD_WIN32_APP": "OFF", "ENGINETEST_BUILD_WIN32_APP": "OFF",
"ENGINE_HOT_RELOAD": "ON" "ENGINE_HOT_RELOAD": "ON",
"ENGINE_PHYSX_LIBRARY_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/bin/win.x86_64.vc143.mt/checked",
"ENGINE_PHYSX_INCLUDE_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/include"
} }
}, },
{ {
@ -41,7 +43,9 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
"ENGINETEST_BUILD_WIN32_APP": "OFF", "ENGINETEST_BUILD_WIN32_APP": "OFF",
"ENGINE_HOT_RELOAD": "ON" "ENGINE_HOT_RELOAD": "ON",
"ENGINE_PHYSX_LIBRARY_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/bin/win.x86_64.vc143.mt/checked",
"ENGINE_PHYSX_INCLUDE_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/include"
} }
}, },
{ {
@ -52,7 +56,9 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Release", "CMAKE_BUILD_TYPE": "Release",
"ENGINETEST_BUILD_WIN32_APP": "ON", "ENGINETEST_BUILD_WIN32_APP": "ON",
"ENGINE_HOT_RELOAD": "OFF" "ENGINE_HOT_RELOAD": "OFF",
"ENGINE_PHYSX_LIBRARY_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/bin/win.x86_64.vc143.mt/release",
"ENGINE_PHYSX_INCLUDE_DIR": "C:/Users/Bailey/source/repos/bailwillharr/PhysX-106.0-physx-5.4.1/physx/include"
} }
} }
] ]

View File

@ -62,4 +62,10 @@ get_target_property(ENGINE_SOURCE_DIR engine SOURCE_DIR)
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink COMMAND ${CMAKE_COMMAND} -E create_symlink
${ENGINE_SOURCE_DIR}/res/engine $<TARGET_FILE_DIR:enginetest>/res/engine) ${ENGINE_SOURCE_DIR}/res/engine $<TARGET_FILE_DIR:enginetest>/res/engine)
# copy dlls
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:enginetest> $<TARGET_RUNTIME_DLLS:enginetest>
COMMAND_EXPAND_LISTS
)