Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy external dlls doesn't work in my setup... #669

Open
BrescaMatej opened this issue Sep 23, 2024 · 0 comments
Open

Copy external dlls doesn't work in my setup... #669

BrescaMatej opened this issue Sep 23, 2024 · 0 comments

Comments

@BrescaMatej
Copy link

I'm trying to integrate PhysX into my project using cmake, the PhysX library is added to my project as git submodule, currently i got to the point where I can use the library in my project but it seems that some cmake variables are not set correctly and i dont have a clean setup to continue working.

The issue im finding is that the "engine\external\physx\physx\source\compiler\cmake\windows\CMakeLists.txt" tries to copy dlls from folders that don't exist on my drive , the commented out lines are the ones that i've disabled in order to make CMake finish configurating and generating files.

# copy the external dlls
IF(PX_COPY_EXTERNAL_DLL OR PUBLIC_RELEASE)
	IF(NOT PHYSX_SLN_PHYSXDEVICE_PATH)
		SET(PHYSX_SLN_PHYSXDEVICE_PATH "$ENV{PM_PhysXDevice_PATH}/bin/x86/" CACHE INTERNAL "PhysX device copy path")
	ENDIF()

	IF(NOT PHYSX_SLN_FREEGLUT_PATH)
		SET(PHYSX_SLN_FREEGLUT_PATH "$ENV{PM_freeglut_PATH}/bin/" CACHE INTERNAL "PhysX freeglut copy path")
	ENDIF()

	IF(CMAKE_CL_64)
		#FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice64.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_DEBUG})
		#FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice64.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_PROFILE})
		#FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice64.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_RELEASE})
		#FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice64.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_CHECKED})

		#FILE(COPY ${PHYSX_SLN_FREEGLUT_PATH}/win64/freeglutd.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_DEBUG})
		#FILE(COPY ${PHYSX_SLN_FREEGLUT_PATH}/win64/freeglut.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_PROFILE})
		#FILE(COPY ${PHYSX_SLN_FREEGLUT_PATH}/win64/freeglut.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_RELEASE})
		#FILE(COPY ${PHYSX_SLN_FREEGLUT_PATH}/win64/freeglut.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_CHECKED})
	ELSE()
		FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_DEBUG})
		FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_PROFILE})
		FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_RELEASE})
		FILE(COPY ${PHYSX_SLN_PHYSXDEVICE_PATH}/PhysXDevice.dll DESTINATION ${PX_EXE_OUTPUT_DIRECTORY_CHECKED})
	ENDIF()
ENDIF()

the "$ENV{PM_PhysXDevice_PATH}" and "$ENV{PM_freeglut_PATH}" are empty when i print them out , and also the "/bin/x86/" is folder that is not generated , instead i get "win.x86_64.vc143.mt" folder that has the checked , debug, profile and release subfolders containg the dlls...

I didn't try to change those paths manually because I've already integrated PhysX library in my older project by manually copy/pasting source files and dlls to output directory, i don't want to do that again

So im wondering if there are some steps I've missed in my setup or maybe there's something i can do to initialize those values correctly to be in sync with the workflow im currently using...

Below is the part of my project's cmakelists.txt that im using to setup PhysX , I've found the example that uses most of these settings

#physx
set( PHYSX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/physx/physx )

set( PHYSX_ROOT_DIR ${PHYSX_PATH} ) #This is needed for $ENV{PHYSX_PATH}/compiler/public/CMakeLists.txt
set( PHYSX_INCLUDE_DIRS {PHYSX_PATH}/include/ {PHYSX_PATH}/../pxshared/include/ )
set( PHYSX_LIBRARIES
       PhysXExtensions
       PhysX
       PhysXPvdSDK
       PhysXVehicle
       PhysXCharacterKinematic
       PhysXCooking
       PhysXCommon
       PhysXFoundation
       # SnippetUtils
       )

set(TARGET_BUILD_PLATFORM "windows") # has to match the TARGET_BUILD_PLATFORM in $ENV{PHYSX_PATH}/physix/buildtools/cmake_generate_projects.py
set(PX_BUILDSNIPPETS OFF CACHE BOOL "Generate the snippets")
set(PX_BUILDPUBLICSAMPLES OFF CACHE BOOL "Generate the samples projects")
set(PX_GENERATE_STATIC_LIBRARIES ON CACHE BOOL "Generate static libraries")
set(PX_FLOAT_POINT_PRECISE_MATH OFF CACHE BOOL "Float point precise math")
set(NV_USE_STATIC_WINCRT ON CACHE BOOL "Use the statically linked windows CRT")
set(NV_USE_DEBUG_WINCRT ON CACHE BOOL "Use the debug version of the CRT")
set(PXSHARED_PATH ${PHYSX_PATH}/../pxshared)
set(PXSHARED_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CMAKEMODULES_VERSION "1.27")
set(CMAKEMODULES_PATH ${PHYSX_PATH}/../externals/cmakemodules)
set(PX_OUTPUT_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/externals/physx)
set(PX_OUTPUT_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/externals/physx)

add_subdirectory(${PHYSX_PATH}/compiler/public externals/physx)
include_directories(external/physx/physx/include)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant