Build Error with Glad library in CUDAOutputBuffer

Severity Code Description Project File Line Suppression State Details
Error C1083 Cannot open include file: ‘glad/glad.h’: No such file or directory 5axisSimulatorAabb D:\Thesis_Clone\sutil\CUDAOutputBuffer.h 31

Glad not found error appears during build solution in VS IDE. I find that glad is the library from OpenGL, which is not needed for my project. I tried to comment out

  if( POLICY CMP0072 )
    #FindOpenGL prefers GLVND by default when available
    cmake_policy(SET CMP0072 NEW)
  endif()

in Cmakelists, but glad not found error still appears after re-build.

I checked with CUDAOutputBuffer file, the line reports this error is:
#include <glad/glad.h> // Needs to be included before gl_interop
what does it means? Then I also checked with glad.sln, glad.h actually is correctly included.

What might be the cause of this error?
Thanks a lot.

Hi @cirycaong, the sutil library needs glad (to find the pointers to the GL functions). It looks like you have a structure for your project files that somehow doesn’t find glad.
Please read this for using or not using sutil.

1 Like

Thank you for your help. As I am new to Optix, I am quite not sure why my project files doesn’t find glad, as my project uses sutil library.
here is the full build messages.

Build started at 22:12...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Build started: Project: glfw, Configuration: Debug x64 ------
3>------ Build started: Project: glad, Configuration: Debug x64 ------
2>Building Custom Rule D:/Thesis_Clone/support/GLFW/src/CMakeLists.txt
2>context.c
2>init.c
2>input.c
2>monitor.c
2>vulkan.c
2>window.c
2>win32_init.c
2>win32_joystick.c
2>win32_monitor.c
2>win32_time.c
2>win32_tls.c
2>win32_window.c
2>wgl_context.c
2>egl_context.c
2>   Creating library D:/Thesis_Clone/build/lib/Debug/glfw3dll.lib and object D:/Thesis_Clone/build/lib/Debug/glfw3dll.exp
3>Building Custom Rule D:/Thesis_Clone/support/CMakeLists.txt
2>glfw.vcxproj -> D:\Thesis_Clone\build\bin\Debug\glfw3.dll
3>glad.c
3>   Creating library D:/Thesis_Clone/build/lib/Debug/glad.lib and object D:/Thesis_Clone/build/lib/Debug/glad.exp
3>glad.vcxproj -> D:\Thesis_Clone\build\bin\Debug\glad.dll
4>------ Build started: Project: imgui, Configuration: Debug x64 ------
4>Building Custom Rule D:/Thesis_Clone/support/imgui/CMakeLists.txt
4>imgui.cpp
4>imgui_demo.cpp
4>imgui_draw.cpp
4>imgui_impl_glfw.cpp
4>imgui_impl_opengl3.cpp
4>imgui_widgets.cpp
4>imgui.vcxproj -> D:\Thesis_Clone\build\lib\Debug\imgui.lib
5>------ Build started: Project: sutil_7_sdk, Configuration: Debug x64 ------
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_camera.cu.optixir
5>camera.cu
5>camera.cu
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_geometry.cu.optixir
5>geometry.cu
5>geometry.cu
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_shading.cu.optixir
5>shading.cu
5>shading.cu
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_sphere.cu.optixir
5>sphere.cu
5>sphere.cu
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_toolIntersection.cu.optixir
5>toolIntersection.cu
5>toolIntersection.cu
5>Building NVCC optixir file lib/ptx/Debug/sutil_generated_whitted.cu.optixir
5>whitted.cu
5>whitted.cu
5>Building Custom Rule D:/Thesis_Clone/sutil/CMakeLists.txt
5>CMake is re-running because D:/Thesis_Clone/build/sutil/CMakeFiles/generate.stamp is out-of-date.
5>  the file 'D:/Thesis_Clone/build/sutil/CMakeFiles/sutil.dir/__/cuda/sutil_generated_camera.cu.optixir.depend'
5>  is newer than 'D:/Thesis_Clone/build/sutil/CMakeFiles/generate.stamp.depend'
5>  result='-1'
5>-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.26100.
5>CMake Deprecation Warning at CMakeLists.txt:95 (cmake_policy):
5>  Compatibility with CMake < 3.10 will be removed from a future version of
5>  CMake.
5>
5>  Update the VERSION argument <min> value or use a ...<max> suffix to tell
5>  CMake that the project does not need compatibility with older versions.
5>
5>
5>sutil OPTIXIR
5>ptx_files = D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_camera.cu.optixir;D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_geometry.cu.optixir;D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_shading.cu.optixir;D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_sphere.cu.optixir;D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_toolIntersection.cu.optixir;D:/Thesis_Clone/build/lib/ptx/$(Configuration)/sutil_generated_whitted.cu.optixir
5>-- Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
5>-- Using Win32 for window creation
5>-- Configuring done (0.5s)
5>-- Generating done (0.6s)
5>-- Build files have been written to: D:/Thesis_Clone/build
5>Camera.cpp
5>GLDisplay.cpp
5>PPMLoader.cpp
5>Scene.cpp
5>sutil.cpp
5>Trackball.cpp
5>   Creating library D:/Thesis_Clone/build/lib/Debug/sutil_7_sdk.lib and object D:/Thesis_Clone/build/lib/Debug/sutil_7_sdk.exp
5>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
5>sutil_7_sdk.vcxproj -> D:\Thesis_Clone\build\bin\Debug\sutil_7_sdk.dll
5>Done building project "sutil_7_sdk.vcxproj".
6>------ Build started: Project: 5axisSimulatorAabb, Configuration: Debug x64 ------
6>Building NVCC optixir file lib/ptx/Debug/5axisSimulatorAabb_generated_5axisSimulatorAabb.cu.optixir
6>5axisSimulatorAabb.cu
6>D:/Thesis_Clone\sutil/CUDAOutputBuffer.h(31): fatal error C1083: Cannot open include file: 'glad/glad.h': No such file or directory
6>CMake Error at 5axisSimulatorAabb_generated_5axisSimulatorAabb.cu.optixir.cmake:273 (message):
6>  Error generating
6>  D:/Thesis_Clone/build/lib/ptx/Debug/5axisSimulatorAabb_generated_5axisSimulatorAabb.cu.optixir
6>
6>
6>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\Thesis_Clone\5axisSimulatorAabb\5axisSimulatorAabb.cu;D:\Thesis_Clone\5axisSimulatorAabb\CMakeLists.txt' exited with code 1.
6>Done building project "5axisSimulatorAabb.vcxproj" -- FAILED.
7>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
7>Project not selected to build for this solution configuration 
========== Build: 5 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
========== Build completed at 22:12 and took 15.550 seconds ==========

If you really want to use sutil (the link above discourages that and links to alternatives) you have to fix CMakeLists.txt with cmake’s target_include_directories() I think (hard to say, I don’t have your files).

Thank you very much for your help.
I checked the position of glad folder, it located in the support folder as the original SDK sets. my project source files are set as in the screenshot. the main exe I want is the 5axisSimulatorAabb, also I add an toolintersection.cu in the cuda folder.
I am not very familiar with cmake, within my ability range, glad looks appropriately include. Sincerely appreciate if you would like to help me quickly have a look at my cmakelists.

This is my main cmakelists

cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)

project(5AxisSim)

cmake_policy(VERSION 2.8.12)

if( POLICY CMP0072 )
  # FindOpenGL prefers GLVND by default when available
  cmake_policy(SET CMP0072 NEW)
endif()

if( POLICY CMP0074 )
  # find_package uses <PackageName>_ROOT variables.
  cmake_policy(SET CMP0074 NEW)
endif()

# Add paths to our CMake code to the module path, so they can be found automatically by
# CMake.
set(CMAKE_MODULE_PATH
  "D:/NVIDIA Corporation/OptiX SDK 8.0.0/SDK/CMake"
  ${CMAKE_MODULE_PATH}
  )

# Set the default build to Release.  Note this doesn't do anything for the VS
# default build target which defaults to Debug when you first start it.
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
      "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

# Tells CMake to build all the libraries as shared libraries by default.  This can be
# overrided by individual libraries later.
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

##########
# Process our custom setup scripts here.

# Enable C++11. Needs to be done before the include of ConfigCompilerFlags.cmake below.
set(GCC_LIBSTDCPP11 ON)

# Include all CMake Macros.
include(Macros)
# Determine information about the compiler
include (CompilerInfo)
# Check for specific machine/compiler options.
include (ConfigCompilerFlags)

# Turn off the warning that NVCC issues when generating PTX from our CUDA samples.  This
# is a custom extension to the FindCUDA code distributed by CMake.
OPTION(CUDA_REMOVE_GLOBAL_MEMORY_SPACE_WARNING "Suppress the \"Advisory: Cannot tell what pointer points to, assuming global memory space\" warning nvcc makes." ON)

# For Xcode 5, gcc is actually clang, so we have to tell CUDA to treat the compiler as
# clang, so that it doesn't mistake it for something else.
if(USING_CLANG_C)
  set(CUDA_HOST_COMPILER "clang" CACHE FILEPATH "Host side compiler used by NVCC")
endif()

# CUDA 8 is broken for generating dependencies during configure
option(CUDA_GENERATE_DEPENDENCIES_DURING_CONFIGURE "Generate dependencies during configure time instead of only during build time." OFF)

# Passing the --use-local-env option to NVCC can dramatically speed up CUDA compilation
if(WIN32)
  option(CUDA_USE_LOCAL_ENV "Pass the '--use-local-env' option to NVCC; only applies to initial configure" ON)
endif()

# Find at least a 5.0 version of CUDA.
find_package(CUDA 5.0 REQUIRED)

# If NVRTC was enabled/disabled, reset OPTIXIR/PTX to default
set( CUDA_NVRTC_ENABLED OFF CACHE BOOL "Use NVRTC to compile OPTIXIR/PTX at run-time instead of NVCC at build-time" )
if( NOT ( NOT ( NOT CUDA_NVRTC_ENABLED ) ) EQUAL ( NOT ( NOT CUDA_NVRTC_ENABLED_INTERNAL ) ) )
  message( STATUS "Resetting OPTIXIR/PTX support" )
  unset( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT CACHE )
endif()
set( CUDA_NVRTC_ENABLED_INTERNAL ${CUDA_NVRTC_ENABLED} CACHE INTERNAL "Previous configured value (NVRTC)" FORCE )

if( CUDA_NVRTC_ENABLED )
  if( CUDA_VERSION VERSION_LESS 12.0 )
    if( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT )
      message( SEND_ERROR "CUDA_NVRTC_ENABLED is not compatible with SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT in CUDA versions less than 12.0" )
    else()
      option( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT "Enable support for generating OptiX-IR targetted input files" OFF )
    endif()
  else()
    option( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT "Enable support for generating OptiX-IR targetted input files" ON )
  endif()
else()
  if( CUDA_VERSION VERSION_LESS 11.7 )
    if( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT )
      message( SEND_ERROR "SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT is not supported in CUDA versions less than 11.7" )
    else()
      option( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT "Enable support for generating OptiX-IR targetted input files" OFF )
    endif()
  else()
    option( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT "Enable support for generating OptiX-IR targetted input files" ON )
  endif()
endif()

# This code looks funny, but CMake doesn't have an equality operator for boolean types
# (only integer and string). By doing NOT NOT VAL, you can force the original value into 0
# or 1 and allow the EQUAL operator to function correctly.
if( NOT ( NOT ( NOT SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT ) ) EQUAL ( NOT ( NOT SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT_INTERNAL ) ) )
  message( STATUS "Unsetting values associated with OptiX code generation" )
  # This allows us to reset dependent options if you change it.
  unset( SAMPLES_INPUT_GENERATE_OPTIXIR CACHE )
  unset( SAMPLES_INPUT_GENERATE_PTX CACHE )
  unset( GENERATE_DEBUG_DEVICE_CODE CACHE )
endif()
set(SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT_INTERNAL ${SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT} CACHE INTERNAL "Previous configured value (OPTIXIR)" FORCE)

if( SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT )
  option( SAMPLES_INPUT_GENERATE_OPTIXIR "Generate Optix-IR OptiX shaders" ON )
  option( SAMPLES_INPUT_GENERATE_PTX "Generate PTX OptiX shaders" OFF )
else()
  option( SAMPLES_INPUT_GENERATE_OPTIXIR "Generate Optix-IR OptiX shaders" OFF )
  option( SAMPLES_INPUT_GENERATE_PTX "Generate PTX OptiX shaders" ON )
endif()

# Determine if we are going to use the static CRT on windows.
if(WIN32)
  option(RELEASE_USE_STATIC_CRT "Build using the static CRT library" ON)
endif()

# Helper for fixing compiler flags
function(replace_flag var old_flag new_flag)
  string(REPLACE "${old_flag}" "${new_flag}" ${var} ${${var}})
  set(${var} "${${var}}" CACHE STRING "Default compiler flags" FORCE)
endfunction()

function(replace_flags old_flag new_flag)
  foreach(build "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO)
    replace_flag(CMAKE_C_FLAGS${build}   "${old_flag}" "${new_flag}")
    replace_flag(CMAKE_CXX_FLAGS${build} "${old_flag}" "${new_flag}")
  endforeach()
endfunction()

if(WIN32)
  if(RELEASE_USE_STATIC_CRT)
    replace_flags("/MD" "/MT")
  else()
    replace_flags("/MT" "/MD")
  endif()
endif(WIN32)

# Present the CUDA_64_BIT_DEVICE_CODE on the default set of options.
mark_as_advanced(CLEAR CUDA_64_BIT_DEVICE_CODE)

set(CUDA_MIN_SM_TARGET sm_50 CACHE STRING "Minimum CUDA SM architecture to use for compilation.")

function(optix_add_cuda_flag_config config flag)
  string(TOUPPER "${config}" config)
  list(FIND CUDA_NVCC_FLAGS${config} ${flag} index)
  if(index EQUAL -1)
    list(APPEND CUDA_NVCC_FLAGS${config} ${flag})
    set(CUDA_NVCC_FLAGS${config} ${CUDA_NVCC_FLAGS${config}} CACHE STRING ${CUDA_NVCC_FLAGS_DESCRIPTION} FORCE)
  endif()
endfunction()

function(optix_add_cuda_flag flag)
  optix_add_cuda_flag_config( "" ${flag} )
endfunction()

# Add some useful default arguments to the NVCC and NVRTC flags.  This is an example of
# how we use PASSED_FIRST_CONFIGURE.  Once you have configured, this variable is TRUE
# and following block of code will not be executed leaving you free to edit the values
# as much as you wish from the GUI or from ccmake.
if( NOT PASSED_FIRST_CONFIGURE )
  set(CUDA_NVCC_FLAGS_DESCRIPTION "Semi-colon delimit multiple arguments.")
  string(REPLACE "sm_" "compute_" CUDA_MIN_SM_COMPUTE_TARGET ${CUDA_MIN_SM_TARGET})

  list(FIND CUDA_NVCC_FLAGS "-arch" index)
  if(index EQUAL -1)
    list(APPEND CUDA_NVCC_FLAGS -arch ${CUDA_MIN_SM_TARGET})
    set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE STRING "Semi-colon delimit multiple arguments." FORCE)
  endif()

  optix_add_cuda_flag("--use_fast_math")
  optix_add_cuda_flag("-lineinfo")
  if( DEFINED CMAKE_CONFIGURATION_TYPES )
    foreach( config ${CMAKE_CONFIGURATION_TYPES} )
      if( ${config} STREQUAL "Debug" )
        optix_add_cuda_flag_config( _${config} "-G" )
        optix_add_cuda_flag_config( _${config} "-O0" )
      endif()
    endforeach()
  else()
    if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
      optix_add_cuda_flag( "-G" )
      optix_add_cuda_flag( "-O0" )
    endif()
  endif()



  if( CUDA_VERSION VERSION_LESS "3.0" )
    optix_add_cuda_flag("--keep")
  endif()

  # Some CUDA 11.x toolkits erroneously complain about sm_50 being deprecated
  if(CUDA_VERSION VERSION_GREATER "11.0")
    optix_add_cuda_flag("-Wno-deprecated-gpu-targets")
  endif()

  if(CUDA_USE_LOCAL_ENV)
    optix_add_cuda_flag("--use-local-env")
  endif()

  if(CMAKE_CXX_STANDARD EQUAL 11)
    set(SAMPLES_NVRTC_CXX "-std=c++11")
  else()
    set(SAMPLES_NVRTC_CXX "")
  endif()

  if( NOT DEFINED CMAKE_CONFIGURATION_TYPES )
    if( NOT CMAKE_BUILD_TYPE STREQUAL CMAKE_BUILD_TYPE_PREVIOUS )
      message( STATUS "Resetting CUDA_NVRTC_FLAGS" )
      unset( CUDA_NVRTC_FLAGS CACHE )
    endif()
    set( CMAKE_BUILD_TYPE_PREVIOUS ${CMAKE_BUILD_TYPE} CACHE INTERNAL "Previous configured value (CMAKE_BUILD_TYPE)" FORCE )

    set( configs "Debug" "Release" "RelWithDebInfo" "MinSizeRel" )
    foreach( config ${configs} )
      if( ${config} STREQUAL "Debug" )
        set( SAMPLES_NVRTC_DEBUG "-G" )
      else()
        set( SAMPLES_NVRTC_DEBUG "-lineinfo" )
      endif()

      string( TOUPPER ${config} config_upper )
      set( CUDA_NVRTC_FLAGS_${config_upper} ${SAMPLES_NVRTC_CXX} -arch ${CUDA_MIN_SM_COMPUTE_TARGET} ${SAMPLES_NVRTC_DEBUG} -use_fast_math -default-device -rdc true -D__x86_64 CACHE STRING "List of NVRTC options just for the samples" FORCE )

      if( ${config} STREQUAL ${CMAKE_BUILD_TYPE} )
        set( CUDA_NVRTC_FLAGS ${CUDA_NVRTC_FLAGS_${config_upper}} CACHE STRING "List of NVRTC options just for the samples" )
      endif()
    endforeach()
  else()
    set( CUDA_NVRTC_FLAGS ${SAMPLES_NVRTC_CXX} -arch ${CUDA_MIN_SM_COMPUTE_TARGET} -lineinfo -use_fast_math -default-device -rdc true -D__x86_64 CACHE STRING "List of NVRTC options just for the samples" FORCE )
    set( CUDA_NVRTC_FLAGS_DEBUG ${SAMPLES_NVRTC_CXX} -arch ${CUDA_MIN_SM_COMPUTE_TARGET} -G -use_fast_math -default-device -rdc true -D__x86_64 CACHE STRING "List of NVRTC options just for the samples" FORCE )
  endif()
endif()

mark_as_advanced(CUDA_NVRTC_FLAGS)

# This passes a preprocessor definition to cl.exe when processing CUDA code.
if(USING_WINDOWS_CL)
  list(APPEND CUDA_NVCC_FLAGS --compiler-options /D_USE_MATH_DEFINES)
endif()

# Put all the runtime stuff in the same directory.  By default, CMake puts each targets'
# output into their own directory.  We want all the targets to be put in the same
# directory, and we can do this by setting these variables.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")

# Create a flag for mac which will allow apps to add the local cuda toolkit
# install path to the app's rpath.
if( APPLE )
  set( CUDA_TOOLKIT_RPATH_FLAG "-Wl,-rpath,${CUDA_TOOLKIT_ROOT_DIR}/lib" )
endif()

# Locate the NVRT distribution.  Search the SDK first, then look in the system.
set(OptiX_INSTALL_DIR "D:/NVIDIA Corporation/OptiX SDK 8.0.0" CACHE PATH "Path to OptiX installed location.")

# Search for the OptiX libraries and include files.
find_package(OptiX REQUIRED)

# Add the path to the OptiX headers to our include paths.
include_directories(
  "${OptiX_INCLUDE}"
  "${CMAKE_CURRENT_SOURCE_DIR}/cuda"
  )

# Select whether to use NVRTC or NVCC to generate PTX
if( NOT SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT AND SAMPLES_INPUT_GENERATE_OPTIXIR )
  message( SEND_ERROR "Must enable SAMPLES_INPUT_ENABLE_OPTIXIR_SUPPORT to enable SAMPLES_INPUT_GENERATE_OPTIXIR" )
endif()


##################################################################
# SUtil compilation

set(SAMPLES_PTX_DIR "${CMAKE_BINARY_DIR}/lib/ptx")
set(SAMPLES_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

set(CUDA_GENERATED_OUTPUT_DIR ${SAMPLES_PTX_DIR})

if( WIN32 )
  string(REPLACE "/" "\\\\" SAMPLES_PTX_DIR ${SAMPLES_PTX_DIR})
else( WIN32 )
  if( USING_GNU_C AND NOT APPLE )
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DM_PI=3.14159265358979323846" )
  endif()
endif( WIN32 )

set(SAMPLES_CUDA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cuda")

set(SAMPLES_SUPPORT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../SDK/support")

# NVRTC include paths relative to the sample path
set(SAMPLES_RELATIVE_INCLUDE_DIRS "\\
  \"cuda\", \\
  \"sutil\", \\
  \".\", ")

# NVRTC absolute include paths to the headers used to build the samples
set(SAMPLES_ABSOLUTE_INCLUDE_DIRS "\\
  \"${OptiX_INCLUDE}\", \\
  \"${CUDA_INCLUDE_DIRS}\", ")

# Build a null-terminated option list for NVRTC
set( config_suffixes "_RELEASE" "_DEBUG" )
foreach( config_suffix ${config_suffixes} )
  # CMake doesn't allow empty strings in lists, so use a dummy suffix
  if( ${config_suffix} STREQUAL "_RELEASE" )
    set( config_suffix "" )
  endif()
  set(CUDA_NVRTC_OPTIONS${config_suffix})
  foreach(flag ${CUDA_NVRTC_FLAGS${config_suffix}})
    set(CUDA_NVRTC_OPTIONS${config_suffix} "${CUDA_NVRTC_OPTIONS${config_suffix}} \\\n  \"${flag}\",")
  endforeach()
  set(CUDA_NVRTC_OPTIONS${config_suffix} "${CUDA_NVRTC_OPTIONS${config_suffix}}")
endforeach()

configure_file(sampleConfig.h.in sampleConfig.h @ONLY)

# Path to sutil.h that all the samples need
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
                     "${CMAKE_BINARY_DIR}/include"
                     ${CMAKE_CURRENT_BINARY_DIR}
                     ${CUDA_INCLUDE_DIRS}
                     )

set(SAMPLES_CUDA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cuda)

# Helper macro to generate PTX from the CUDA files in sutil.
macro(OPTIX_sutil_compile_to_optix_input generated_files)
  if( NOT CUDA_NVRTC_ENABLED )
    if( SAMPLES_INPUT_GENERATE_OPTIXIR )
      message("sutil OPTIXIR")
      CUDA_WRAP_SRCS( sutil OPTIXIR generated_files2 ${ARGN} )
      list(APPEND ${generated_files} ${generated_files2})
    endif()
    if( SAMPLES_INPUT_GENERATE_PTX )
      message("sutil PTX")
      CUDA_WRAP_SRCS( sutil PTX generated_files3 ${ARGN} )
      list(APPEND ${generated_files} ${generated_files3})
    endif()
  endif()
  message("${generated_files} = ${${generated_files}}")
endmacro()

# These calls will group PTX and CUDA files into their own directories in the Visual
# Studio projects.
macro(OPTIX_add_source_groups)
  if( NOT CUDA_NVRTC_ENABLED )
    if( SAMPLES_INPUT_GENERATE_PTX )
      source_group("PTX Files"  REGULAR_EXPRESSION ".+\\.ptx$")
    endif()
    if( SAMPLES_INPUT_GENERATE_OPTIXIR )
      source_group("OptixIR Files"  REGULAR_EXPRESSION ".+\\.optixir$")
    endif()
  endif()
  source_group("CUDA Files" REGULAR_EXPRESSION ".+\\.cu$")
endmacro()

#########################################################
# OPTIX_add_sample_executable
#
# Convience function for adding samples to the code.  You can copy the contents of this
# funtion into your individual project if you wish to customize the behavior.  Note that
# in CMake, functions have their own scope, whereas macros use the scope of the caller.
function(OPTIX_add_sample_executable target_name_base target_name_var)

  set( target_name ${target_name_base} )
  set( ${target_name_var} ${target_name} PARENT_SCOPE )

  OPTIX_add_source_groups()

  # Separate the sources from the CMake and CUDA options fed to the macro.  This code
  # comes from the CUDA_COMPILE_PTX macro found in FindCUDA.cmake.  We are copying the
  # code here, so that we can use our own name for the target.  target_name is used in the
  # creation of the output file names, and we want this to be unique for each target in
  # the SDK.
  CUDA_GET_SOURCES_AND_OPTIONS(source_files cmake_options options ${ARGN})

  # Isolate OBJ target files. NVCC should only process these files and leave PTX targets for NVRTC
  set(cu_obj_source_files)
  set(cu_optix_source_files)
  foreach(file ${source_files})
    get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT)
    if(${_cuda_source_format} MATCHES "OBJ")
      list(APPEND cu_obj_source_files ${file})
    else()
      list(APPEND cu_optix_source_files ${file})
    endif()
  endforeach()

  # Create the rules to build the OBJ from the CUDA files.
  CUDA_WRAP_SRCS( ${target_name} OBJ generated_files ${cu_obj_source_files} ${cmake_options} OPTIONS ${options} )

  # Create the rules to build the PTX and/or OPTIX files.
  if( SAMPLES_INPUT_GENERATE_OPTIXIR )
    CUDA_WRAP_SRCS( ${target_name} OPTIXIR generated_files2 ${cu_optix_source_files} ${cmake_options} OPTIONS ${options} )
    list(APPEND generated_files ${generated_files2})
  endif()
  if( SAMPLES_INPUT_GENERATE_PTX AND NOT CUDA_NVRTC_ENABLED)
    CUDA_WRAP_SRCS( ${target_name} PTX generated_files3 ${cu_optix_source_files} ${cmake_options} OPTIONS ${options} )
    list(APPEND generated_files ${generated_files3})
  endif()

  # Here is where we create the rule to make the executable.  We define a target name and
  # list all the source files used to create the target.  In addition we also pass along
  # the cmake_options parsed out of the arguments.
  add_executable(${target_name}
    ${source_files}
    ${generated_files}
    ${cmake_options}
    )

  # Most of the samples link against the sutil library and the optix library.  Here is the
  # rule that specifies this linkage.
  target_link_libraries( ${target_name}
    ${GLFW_LIB_NAME}
    imgui
    sutil_7_sdk
    )

  set_target_properties( ${target_name} PROPERTIES
    COMPILE_DEFINITIONS
    "OPTIX_SAMPLE_NAME_DEFINE=${target_name};OPTIX_SAMPLE_DIR_DEFINE=${target_name}" )

  if( UNIX AND NOT APPLE )
    # Force using RPATH instead of RUNPATH on Debian
    target_link_libraries( ${target_name} "-Wl,--disable-new-dtags" )
  endif()

  if(USING_GNU_CXX)
    target_link_libraries( ${target_name} m ) # Explicitly link against math library (C samples don't do that by default)
  endif()
endfunction()

#########################################################
#  List of samples found in subdirectories.
#
# If you wish to start your own sample, you can copy one of the sample's directories.
# Just make sure you rename all the occurances of the sample's name in the C code as well
# and the CMakeLists.txt file.
# add_subdirectory( optixBoundValues        )
# add_subdirectory( optixCallablePrograms   )
# add_subdirectory( optixCompileWithTasks   )
# add_subdirectory( optixConsole            )
# add_subdirectory( optixCurves             )
# add_subdirectory( optixCustomPrimitive    )
# add_subdirectory( optixCutouts            )
# add_subdirectory( optixDenoiser           )
# add_subdirectory( optixDisplacedMicromesh )
# add_subdirectory( optixDynamicGeometry    )
# add_subdirectory( optixDynamicMaterials   )
# add_subdirectory( optixHair               )
# add_subdirectory( optixHello              )
# add_subdirectory( optixMeshViewer         )
# add_subdirectory( optixModuleCreateAbort  )
# add_subdirectory( optixMotionGeometry     )
# add_subdirectory( optixMultiGPU           )
# add_subdirectory( optixNVLink             )
# add_subdirectory( optixOpticalFlow        )
# add_subdirectory( optixOpacityMicromap    )
# add_subdirectory( optixPathTracer         )
# add_subdirectory( optixRaycasting         )
# add_subdirectory( optixRibbons            )
# add_subdirectory( optixSimpleMotionBlur   )
# add_subdirectory( optixSphere             )
# add_subdirectory( optixTriangle           )
# add_subdirectory( optixVolumeViewer       )
# add_subdirectory( optixWhitted            )
add_subdirectory( 5axisSimulatorAabb      )



# Our sutil library.  The rules to build it are found in the subdirectory.
add_subdirectory(sutil)
# Third-party support libraries.
add_subdirectory(support)

This is sutil Cmakelists

set(sources
    ${CMAKE_CURRENT_BINARY_DIR}/../sampleConfig.h
    ${SAMPLES_CUDA_DIR}/camera.cu
    ${SAMPLES_CUDA_DIR}/geometry.cu
    ${SAMPLES_CUDA_DIR}/shading.cu
    ${SAMPLES_CUDA_DIR}/sphere.cu
    ${SAMPLES_CUDA_DIR}/toolIntersection.cu
    ${SAMPLES_CUDA_DIR}/whitted.cu
    ${SAMPLES_CUDA_DIR}/BufferView.h
    ${SAMPLES_CUDA_DIR}/GeometryData.h
    ${SAMPLES_CUDA_DIR}/Light.h
    ${SAMPLES_CUDA_DIR}/LocalGeometry.h
    ${SAMPLES_CUDA_DIR}/MaterialData.h
    ${SAMPLES_CUDA_DIR}/util.h
    ${SAMPLES_CUDA_DIR}/helpers.h
    ${SAMPLES_CUDA_DIR}/whitted.h
    Aabb.h
    Camera.cpp
    Camera.h
    CuBuffer.h
    CUDAOutputBuffer.h
    Exception.h
    GLDisplay.cpp
    GLDisplay.h
    Matrix.h
    PPMLoader.cpp
    PPMLoader.h
    Preprocessor.h
    Quaternion.h
    Record.h
    Scene.cpp
    Scene.h
    sutilapi.h
    sutil.cpp
    sutil.h
    Trackball.cpp
    Trackball.h
    vec_math.h
    )



include_directories(${CMAKE_CURRENT_SOURCE_DIR})

if(NOT CUDA_NVRTC_ENABLED)
  OPTIX_sutil_compile_to_optix_input(ptx_files ${sources})
else()
  set(ptx_files)
endif()

OPTIX_add_source_groups()

# Make the library.
set(sutil_target "sutil_7_sdk")
add_library(${sutil_target} ${sources} ${ptx_files})
if( WIN32 )
  target_compile_definitions( ${sutil_target} PUBLIC GLAD_GLAPI_EXPORT )
endif()

target_link_libraries(${sutil_target} LINK_PRIVATE
  ${GLFW_LIB_NAME}
  glad
  imgui
  ${CUDA_LIBRARIES}
  )

# Use gcc rather than g++ to link if we are linking statically against libgcc_s and libstdc++
if(USING_GNU_C OR USING_GNU_CXX)
  if(GCC_LIBSTDCPP_HACK)
    set_target_properties(${sutil_target} PROPERTIES LINKER_LANGUAGE "C")
    target_link_libraries(${sutil_target} LINK_PRIVATE ${STATIC_LIBSTDCPP})
  endif()
endif()


if(CUDA_NVRTC_ENABLED)
  target_link_libraries(${sutil_target} LINK_PRIVATE ${CUDA_nvrtc_LIBRARY})
endif()
if(WIN32)
  target_link_libraries(${sutil_target} LINK_PRIVATE winmm.lib)
endif()

# Make the list of sources available to the parent directory for installation needs.
set(sutil_sources "${sources}" PARENT_SCOPE)

set_property(TARGET ${sutil_target} PROPERTY FOLDER "${OPTIX_IDE_FOLDER}")

# Disable until we get binary samples
if(0 AND RELEASE_INSTALL_BINARY_SAMPLES AND NOT RELEASE_STATIC_BUILD)
  # If performing a release install, we want to use rpath for our install name.
  # The executables' rpaths will then be set to @executable_path so we can invoke
  # the samples from an arbitrary location and it will still find this library.
  set_target_properties(${sutil_target} PROPERTIES
    INSTALL_NAME_DIR "@rpath"
    BUILD_WITH_INSTALL_RPATH ON
    )
  install(TARGETS ${sutil_target}
    RUNTIME DESTINATION ${SDK_BINARY_INSTALL_DIR}
    LIBRARY DESTINATION ${SDK_BINARY_INSTALL_DIR}
    )
endif()

cmakelists in the 5AxisSimulatorAabb

OPTIX_add_sample_executable( 5axisSimulatorAabb target_name
  5axisSimulatorAabb.cu
  5axisSimulatorAabb.cpp
  5axisSimulatorAabb.h
  OPTIONS -rdc true
  )

target_link_libraries( ${target_name}
  ${CUDA_LIBRARIES}
  )

You have a missing header compiler error, so your project is missing this include path:

“C:\ProgramData\NVIDIA Corporation\OptiX SDK 8.0.0\SDK\support.”

or the equivalent on your system.

Likely cause is replacing CMAKE_SOURCE_DIR with your custom path:

“D:/NVIDIA Corporation/OptiX SDK 8.0.0”

Are the glad headers where they’re supposed to be as per the generated Visual Studio project file?