eh, i guess physX didn't like windows?

This commit is contained in:
2026-01-25 03:25:21 -05:00
parent 697a2e85e1
commit 75503f7ef3
3 changed files with 46 additions and 15 deletions

View File

@@ -287,4 +287,31 @@ add_custom_command(TARGET ModularityPlayer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Resources
$<TARGET_FILE_DIR:ModularityPlayer>/Resources
)
)
# ==================== Copy PhysX DLLs (Windows) ====================
if(WIN32 AND MODULARITY_ENABLE_PHYSX)
set(PHYSX_COPY_SCRIPT ${CMAKE_SOURCE_DIR}/cmake/CopyPhysXDLLs.cmake)
if(MODULARITY_BUILD_EDITOR)
add_custom_command(TARGET Modularity POST_BUILD
COMMAND ${CMAKE_COMMAND}
-D SRC_DIR=${PX_OUTPUT_BIN_DIR}
-D DST_DIR=$<TARGET_FILE_DIR:Modularity>
-P ${PHYSX_COPY_SCRIPT}
COMMAND ${CMAKE_COMMAND}
-D SRC_DIR=${CMAKE_BINARY_DIR}/physx/sdk_source_bin
-D DST_DIR=$<TARGET_FILE_DIR:Modularity>
-P ${PHYSX_COPY_SCRIPT}
)
endif()
add_custom_command(TARGET ModularityPlayer POST_BUILD
COMMAND ${CMAKE_COMMAND}
-D SRC_DIR=${PX_OUTPUT_BIN_DIR}
-D DST_DIR=$<TARGET_FILE_DIR:ModularityPlayer>
-P ${PHYSX_COPY_SCRIPT}
COMMAND ${CMAKE_COMMAND}
-D SRC_DIR=${CMAKE_BINARY_DIR}/physx/sdk_source_bin
-D DST_DIR=$<TARGET_FILE_DIR:ModularityPlayer>
-P ${PHYSX_COPY_SCRIPT}
)
endif()

17
cmake/CopyPhysXDLLs.cmake Normal file
View File

@@ -0,0 +1,17 @@
if(NOT DEFINED SRC_DIR OR NOT DEFINED DST_DIR)
message(FATAL_ERROR "CopyPhysXDLLs.cmake requires SRC_DIR and DST_DIR.")
endif()
if(NOT EXISTS "${SRC_DIR}")
return()
endif()
file(MAKE_DIRECTORY "${DST_DIR}")
file(GLOB_RECURSE PHYSX_DLLS RELATIVE "${SRC_DIR}" "${SRC_DIR}/*.dll")
foreach(dll ${PHYSX_DLLS})
set(src "${SRC_DIR}/${dll}")
if(EXISTS "${src}")
file(COPY "${src}" DESTINATION "${DST_DIR}")
endif()
endforeach()

View File

@@ -51,19 +51,6 @@ namespace {
return output;
}
std::string escapeForCmd(const std::string& value) {
std::string out;
out.reserve(value.size());
for (char c : value) {
if (c == '"') {
out += "\"\"";
} else {
out += c;
}
}
return out;
}
std::string findVsDevCmd() {
std::string vsInstall = getEnvValue("VSINSTALLDIR");
if (!vsInstall.empty()) {
@@ -146,7 +133,7 @@ namespace {
wrapped << "cmd /c \"\""
<< vsDevCmd
<< "\" -arch=x64 -host_arch=x64 >nul && "
<< escapeForCmd(command)
<< command
<< "\"";
return wrapped.str();
}