diff options
Diffstat (limited to 'NvCloth/compiler/cmake/windows/NvCloth.cmake')
| -rw-r--r-- | NvCloth/compiler/cmake/windows/NvCloth.cmake | 57 |
1 files changed, 49 insertions, 8 deletions
diff --git a/NvCloth/compiler/cmake/windows/NvCloth.cmake b/NvCloth/compiler/cmake/windows/NvCloth.cmake index c71c974..a867a75 100644 --- a/NvCloth/compiler/cmake/windows/NvCloth.cmake +++ b/NvCloth/compiler/cmake/windows/NvCloth.cmake @@ -4,15 +4,26 @@ MESSAGE("[NvCloth]cmake/windows/NvCloth.cmake") +IF(NOT DEFINED NV_CLOTH_ENABLE_CUDA) +SET(NV_CLOTH_ENABLE_CUDA 1) +ENDIF() +IF(NOT DEFINED NV_CLOTH_ENABLE_DX11) +SET(NV_CLOTH_ENABLE_DX11 1) +ENDIF() + SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) -#FIND_PACKAGE(PxShared REQUIRED) +IF(${NV_CLOTH_ENABLE_CUDA}) FIND_PACKAGE(CUDA 8 REQUIRED) MESSAGE("Found CUDA:" ${CUDA_INCLUDE_DIRS}) +ENDIF() SET(NVCLOTH_PLATFORM_INCLUDES PRIVATE ${CUDA_INCLUDE_DIRS}) -SET(NVCLOTH_PLATFORM_SOURCE_FILES + +SET(NVCLOTH_PLATFORM_SOURCE_FILES "" ) +IF(${NV_CLOTH_ENABLE_CUDA}) +LIST(APPEND NVCLOTH_PLATFORM_SOURCE_FILES ${PROJECT_ROOT_DIR}/src/cuda/CuCheckSuccess.h ${PROJECT_ROOT_DIR}/src/cuda/CuCloth.cpp ${PROJECT_ROOT_DIR}/src/cuda/CuCloth.h @@ -33,9 +44,14 @@ SET(NVCLOTH_PLATFORM_SOURCE_FILES ${PROJECT_ROOT_DIR}/src/cuda/CuSelfCollision.h ${PROJECT_ROOT_DIR}/src/cuda/CuSolver.cpp ${PROJECT_ROOT_DIR}/src/cuda/CuSolver.h - ${PROJECT_ROOT_DIR}/src/cuda/CuSolverKernel.h ${PROJECT_ROOT_DIR}/src/cuda/CuSolverKernelBlob.h +) +ENDIF() + +IF(${NV_CLOTH_ENABLE_DX11}) +LIST(APPEND NVCLOTH_PLATFORM_SOURCE_FILES + ${PROJECT_ROOT_DIR}/src/dx/DxBatchedVector.h ${PROJECT_ROOT_DIR}/src/dx/DxCheckSuccess.h ${PROJECT_ROOT_DIR}/src/dx/DxCloth.cpp @@ -60,6 +76,7 @@ SET(NVCLOTH_PLATFORM_SOURCE_FILES #${PROJECT_ROOT_DIR}/src/neon/NeonSolverKernel.cpp #${PROJECT_ROOT_DIR}/src/neon/SwCollisionHelpers.h ) +ENDIF() SET(NVCLOTH_AVX_SOURCE_FILES ${PROJECT_ROOT_DIR}/src/avx/SwSolveConstraints.cpp @@ -69,16 +86,25 @@ set_source_files_properties(${NVCLOTH_AVX_SOURCE_FILES} PROPERTIES COMPILE_FLAGS - +SET(NVCLOTH_HLSL_FILES "") +IF(${NV_CLOTH_ENABLE_DX11}) SET(NVCLOTH_HLSL_FILES ${PROJECT_ROOT_DIR}/src/dx/DxSolverKernel.hlsl ) set_source_files_properties(${NVCLOTH_HLSL_FILES} PROPERTIES VS_SHADER_TYPE Compute VS_SHADER_MODEL 5.0 VS_SHADER_FLAGS "/Vn gDxSolverKernel /Fh ${PROJECT_ROOT_DIR}/src/dx/DxSolverKernelBlob.h") +ENDIF() + SET(NVCLOTH_PLATFORM_SOURCE_FILES ${NVCLOTH_PLATFORM_SOURCE_FILES} ${NVCLOTH_HLSL_FILES} ${NVCLOTH_AVX_SOURCE_FILES}) +IF(${NV_CLOTH_ENABLE_CUDA}) set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; + + # Options are documented on http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#command-option-types-and-notation + # Important: to be able to debug CUDA kernel (correct stepping and workable warp watches), + # you should add the -G (short for --device-debug) option to the line below. + # Don't forget to remove it afterwards, since the code execution will be very slow with this flag. -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -lineinfo -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_50,code=compute_50 -D_USE_MATH_DEFINES -DNDEBUG -DPX_PROFILE=1 ) SET(NVCLOTH_CUDA_FILES @@ -99,20 +125,35 @@ COMMAND ${CUDA_TOOLKIT_ROOT_DIR}/bin/bin2c.exe --name kCuSolverKernel ${CUDA_FAT DEPENDS ${CUDA_FATBIN} VERBATIM ) +ENDIF() SET(NVCLOTH_COMPILE_DEFS NV_CLOTH_IMPORT=PX_DLL_EXPORT - NV_CLOTH_ENABLE_DX11=1 - NV_CLOTH_ENABLE_CUDA=1 $<$<CONFIG:debug>:${NVCLOTH_WINDOWS_DEBUG_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=DEBUG;> $<$<CONFIG:checked>:${NVCLOTH_WINDOWS_CHECKED_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=CHECKED;> $<$<CONFIG:profile>:${NVCLOTH_WINDOWS_PROFILE_COMPILE_DEFS};PX_PHYSX_DLL_NAME_POSTFIX=PROFILE;> $<$<CONFIG:release>:${NVCLOTH_WINDOWS_RELEASE_COMPILE_DEFS};> ) - - +IF(${NV_CLOTH_ENABLE_DX11}) +LIST(APPEND NVCLOTH_COMPILE_DEFS + NV_CLOTH_ENABLE_DX11=1 +) +ELSE() +LIST(APPEND NVCLOTH_COMPILE_DEFS + NV_CLOTH_ENABLE_DX11=0 +) +ENDIF() +IF(${NV_CLOTH_ENABLE_CUDA}) +LIST(APPEND NVCLOTH_COMPILE_DEFS + NV_CLOTH_ENABLE_CUDA=1 +) +ELSE() +LIST(APPEND NVCLOTH_COMPILE_DEFS + NV_CLOTH_ENABLE_CUDA=0 +) +ENDIF() SET(NVCLOTH_LIBTYPE SHARED) |