PhysX
PhysX copied to clipboard
Configuration issue for Windows and UWP
I am trying to configure PhysX using add_subdirectory. My CMakeLists.txt looks like this:
# PhysX-specific CMake project setup
set(NV_USE_DEBUG_WINCRT ON CACHE BOOL "Use the debug version of the CRT")
set(PHYSX_ROOT_DIR ${DEPS_DIR}/physx/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 "")
if (WIN32)
if (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(TARGET_BUILD_PLATFORM "uwp" CACHE INTERNAL "")
set(PLATFORM "UWP")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_BUILD_PLATFORM "windows" CACHE INTERNAL "")
set(PLATFORM "Windows")
endif()
elseif(APPLE)
set(TARGET_BUILD_PLATFORM "mac" CACHE INTERNAL "")
set(PLATFORM "macOS")
elseif(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 "")
endif()
add_subdirectory("${PHYSX_ROOT_DIR}/compiler/public" EXCLUDE_FROM_ALL)
However, on Windows, when I try to configure, after configuration is complete, I get these errors during generation:
PHYSX ROOT C:/Users/Ravbug/Documents/RavEngine-Samples/RavEngine/deps/physx/physx
PhysX Build Platform: windows
Using CXX Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe
Added PhysX
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_EXE_LINKER_FLAGS_CHECKED
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_EXE_LINKER_FLAGS_PROFILE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_EXE_LINKER_FLAGS_CHECKED
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_EXE_LINKER_FLAGS_PROFILE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
--more of the same, snipped--
With Windows, I can re-run the cmake command and it works, but with UWP, I always get the generation error. This issue does not happen for macOS, iOS, tvOS, or Linux.
How do I resolve this?
Not responding directly to your issue, but I've found that using vcpkg has dramatically simplified handling dependencies in my projects on WIndows; PhysX is already ported and maintained there as well.