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 simpleGL
add_executable(simpleGL simpleGL.cu)
target_compile_options(simpleGL PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_options(simpleGL PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(simpleGL PRIVATE cxx_std_17 cuda_std_17)
target_compile_features(simpleGL PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(simpleGL PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
@@ -43,6 +48,23 @@ target_compile_features(simpleGL PRIVATE cxx_std_17 cuda_std_17)
${GLUT_LIBRARIES}
)
if(WIN32)
target_link_libraries(simpleGL
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET simpleGL
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET simpleGL
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/glew64.dll ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
add_custom_command(TARGET simpleGL POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/data