Converting VS Property-Sheet into CMake settings

Oh, sorry, I didn’t understand that your previous answer was linked to the post (Why am I getting OptiX_DIR-NOTFOUND? - #4 by droettger), so I just picked the first bullet point as I’m not having any native CUDA calls in my file.

The project is a submodule of a larger sample library, so I’m trying to touch the other projects as little as possible. The top-level CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.25)

if (CMAKE_MAJOR_VERSION GREATER 2)
	cmake_policy(SET CMP0053 OLD)
	cmake_policy(SET CMP0026 OLD)
endif (CMAKE_MAJOR_VERSION GREATER 2)

project(Computergrafik)

if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
   message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")

SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_MODULE_PATH 
  "${Computergrafik_SOURCE_DIR}/cmake"
)

#change the default installation path
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "${Computergrafik_SOURCE_DIR}/Abgabe" CACHE PATH "Computergrafik install prefix" FORCE)
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
set(CPACK_GENERATOR "ZIP")
include(Dependencies)
include(Install)
include(CreateLaunchers)

add_definitions(/DFREEIMAGE_LIB /DTW_STATIC)
include_directories(${Computergrafik_SOURCE_DIR})
#disable win32 warning
add_definitions(/D_CRT_SECURE_NO_WARNINGS -DFREEGLUT_LIB_PRAGMAS=0 -DFREEGLUT_STATIC /DTW_STATIC /DTW_NO_LIB_PRAGMA)

add_subdirectory(ObjLoader)
add_subdirectory(ImageLoader)
add_subdirectory(Utils)


# Die Projekte hinzufügen
add_subdirectory(A1_Versuch1a)
add_subdirectory(A1_Versuch1b)
add_subdirectory(A1_Versuch1c)
add_subdirectory(A1_FraktaleSzene)

add_subdirectory(A3_Normalenvektoren)
add_subdirectory(A4_CubeMapping)
add_subdirectory(A5_BumpMapping)
add_subdirectory(A5_GeometryShader)
add_subdirectory(A5_PercentageCloserSoftShadows)
add_subdirectory(A5_DisplacementMapping)

include(nvcuda_compile_module.cmake)

add_subdirectory(A5_OptiXRaytracing)

#set_target_properties(A5_OptiXRaytracing PROPERTIES VS_USER_PROPS "${PROJECT_SOURCE_DIR}/A5_OptiXRaytracing/property-sheets/optix_build_settings.props")
#set_target_properties(A5_OptiXRaytracing PROPERTIES VS_USER_PROPS "${PROJECT_SOURCE_DIR}/A5_OptiXRaytracing/property-sheets/optix_settings.props")

install(DIRECTORY Texturen DESTINATION .)
install(DIRECTORY Modelle DESTINATION .)

include(CPack)

So, the function is available in the submodule. Sorry for not mentioning this, I thought the submodule environment was enough.

I added the PROGRAM_MODULES now to the executable and the build process is being started now.

However, nvcc terminates with nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified and the cmake debug output looks like this:

Current Source Dir: E:/workspace/computergrafik-opengl-rahmenprogramm-solved-edition/CGRahmenprogramm/A5_OptiXRaytracing
NCUDA_COMPILE_MODULE DEBUG MESSAGE: E:/workspace/cuda/cuda/bin/nvcc.exe --optix-ir;--machine=64;--gpu-architecture=compute_52;--use_fast_math;--relocatable-device-code=true;--generate-line-info;-Wno-deprecated-gpu-targets;-IE:/workspace/cuda/optix/include;E:/workspace/cuda/optix/SDK;E:/workspace/cuda/optix/SDK/build;-IE:/workspace/computergrafik-opengl-rahmenprogramm-solved-edition/CGRahmenprogramm/A5_OptiXRaytracing/optix optix/Raytracing.cu -o E:/workspace/computergrafik-opengl-rahmenprogramm-solved-edition/CGRahmenprogramm/build/gpu-code/Raytracing.optixir

So I assume nvcc is having issues finding optix/Raytracing.cu, which surprises me, because it’s right in the CURRENT_SOURCE_DIR in the given folder (the path to the file is E:/workspace/computergrafik-opengl-rahmenprogramm-solved-edition/CGRahmenprogramm/A5_OptiXRaytracing/optix/Raytracing.cu). I also tried to attach the CURRENT_SOURCE_DIR to the OPTIX_SHADER_SOURCES when calling NVCUDA_COMPILE_MODULE but that didn’t change anything either.