Update OpenGL sample build settings on Windows

This commit is contained in:
Rob Armstrong
2025-02-10 23:10:55 -08:00
parent 9582bb03a9
commit 7a9bd38ecc
22 changed files with 517 additions and 30 deletions

View File

@@ -17,6 +17,11 @@ endif()
# Include directories and libraries
include_directories(../../../Common)
if(WIN32)
set(PC_GLUT_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../Common")
set(PC_GLUT_LIBRARY_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/lib/x64")
endif()
find_package(OpenGL)
find_package(GLUT)
@@ -26,9 +31,9 @@ if(${OpenGL_FOUND})
# Add target for simpleTexture3D
add_executable(simpleTexture3D simpleTexture3D_kernel.cu simpleTexture3D.cpp)
target_compile_options(simpleTexture3D PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_options(simpleTexture3D PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(simpleTexture3D PRIVATE cxx_std_17 cuda_std_17)
target_compile_features(simpleTexture3D PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(simpleTexture3D PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
@@ -50,6 +55,23 @@ target_compile_features(simpleTexture3D PRIVATE cxx_std_17 cuda_std_17)
${CMAKE_CURRENT_BINARY_DIR}
)
if(WIN32)
target_link_libraries(simpleTexture3D
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET simpleTexture3D
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET simpleTexture3D
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/glew64.dll ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
else()
message(STATUS "GLUT not found - will not build sample 'simpleTexture3D'")
endif()