From 9efc001e26dba1898994f68aa9dea9050b129d05 Mon Sep 17 00:00:00 2001 From: bailehuni Date: Mon, 29 Jul 2024 23:51:46 +0100 Subject: [PATCH] Add physx library --- CMakeLists.txt | 15 ++++++++++++++- CMakePresets.json | 12 +++++++++--- test/CMakeLists.txt | 8 +++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bea3790..ca7a1ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ option(ENGINE_BUILD_TEST "Compile the test program" ON) if (MSVC) option(ENGINE_HOT_RELOAD "Enable VS hot reload" OFF) 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") @@ -218,4 +220,15 @@ target_link_libraries(${PROJECT_NAME} PUBLIC mikktspace) # weldmesh add_subdirectory(vendor/weldmesh) -target_link_libraries(${PROJECT_NAME} PUBLIC weldmesh) \ No newline at end of file +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 +) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 3d4a7ad..8594079 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -30,7 +30,9 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "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": { "CMAKE_BUILD_TYPE": "RelWithDebInfo", "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": { "CMAKE_BUILD_TYPE": "Release", "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" } } ] diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 33ddb8a..6cc9e61 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -62,4 +62,10 @@ get_target_property(ENGINE_SOURCE_DIR engine SOURCE_DIR) add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink - ${ENGINE_SOURCE_DIR}/res/engine $/res/engine) \ No newline at end of file + ${ENGINE_SOURCE_DIR}/res/engine $/res/engine) + +# copy dlls +add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS +) \ No newline at end of file