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,10 @@ 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)
@@ -27,9 +31,9 @@ if(${OpenGL_FOUND})
# Add target for FunctionPointers
add_executable(FunctionPointers FunctionPointers.cpp FunctionPointers_kernels.cu)
target_compile_options(FunctionPointers PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_options(FunctionPointers PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(FunctionPointers PRIVATE cxx_std_17 cuda_std_17)
target_compile_features(FunctionPointers PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(FunctionPointers PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
@@ -51,6 +55,23 @@ target_compile_features(FunctionPointers PRIVATE cxx_std_17 cuda_std_17)
${CMAKE_CURRENT_BINARY_DIR}
)
if(WIN32)
target_link_libraries(FunctionPointers
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET FunctionPointers
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET FunctionPointers
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 'FunctionPointers'")
endif()

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)
@@ -64,6 +69,23 @@ if(${OpenGL_FOUND})
${CMAKE_CURRENT_BINARY_DIR}/
)
if(WIN32)
target_link_libraries(boxFilter
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET boxFilter
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET boxFilter
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 'boxFilter'")
endif()

View File

@@ -17,6 +17,12 @@ 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 +32,9 @@ if(${OpenGL_FOUND})
# Add target for imageDenoising
add_executable(imageDenoising bmploader.cpp imageDenoising.cu imageDenoisingGL.cpp)
target_compile_options(imageDenoising PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_options(imageDenoising PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(imageDenoising PRIVATE cxx_std_17 cuda_std_17)
target_compile_features(imageDenoising PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(imageDenoising PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
@@ -50,6 +56,23 @@ target_compile_features(imageDenoising PRIVATE cxx_std_17 cuda_std_17)
${CMAKE_CURRENT_BINARY_DIR}/data
)
if(WIN32)
target_link_libraries(imageDenoising
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET imageDenoising
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET imageDenoising
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 'imageDenoising'")
endif()

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)
@@ -50,6 +55,23 @@ target_compile_features(particles PRIVATE cxx_std_17 cuda_std_17)
${CMAKE_CURRENT_BINARY_DIR}/data
)
if(WIN32)
target_link_libraries(particles
${PC_GLUT_LIBRARY_DIRS}/freeglut.lib
${PC_GLUT_LIBRARY_DIRS}/glew64.lib
)
add_custom_command(TARGET particles
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/$<CONFIGURATION>/freeglut.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(TARGET particles
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 'particles'")
endif()