forked from nvpro-samples/gl_ssao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
95 lines (82 loc) · 3.62 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJNAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
Project(${PROJNAME})
Message(STATUS "-------------------------------")
Message(STATUS "Processing Project ${PROJNAME}:")
# offer the choice of having shared_sources as a sub-folder... good for packaging a sample
# if BASE_DIRECTORY not defined, it means this cmake file was called as the first entry point and not included
if(NOT BASE_DIRECTORY) # if not defined, it means this cmake file was called as the first entry point and not included
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/shared_sources)
Message(STATUS "found sub-folder shared_sources")
SET(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/shared_sources/CMakeLists_include.txt)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/shared_sources ${CMAKE_BINARY_DIR}/shared_sources)
elseif(EXISTS $ENV{NVPRO_ROOT_DIR}/shared_sources)
FILE(TO_CMAKE_PATH "$ENV{NVPRO_ROOT_DIR}" BASE_DIRECTORY)
INCLUDE(${BASE_DIRECTORY}/shared_sources/CMakeLists_include.txt)
add_subdirectory(${BASE_DIRECTORY}/shared_sources ${CMAKE_BINARY_DIR}/shared_sources)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../shared_sources)
SET(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../..)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../../shared_sources/CMakeLists_include.txt)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../shared_sources ${CMAKE_BINARY_DIR}/shared_sources)
else()
SET(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../shared_sources/CMakeLists_include.txt)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../shared_sources ${CMAKE_BINARY_DIR}/shared_sources)
endif()
endif()
_add_project_definitions(${PROJNAME})
if (SUPPORT_NVTOOLSEXT)
add_definitions(-DSUPPORT_NVTOOLSEXT)
endif(SUPPORT_NVTOOLSEXT)
#####################################################################################
# additions from packages needed for this sample
# add refs in LIBRARIES_OPTIMIZED
# add refs in LIBRARIES_DEBUG
# add files in PACKAGE_SOURCE_FILES
#
_add_package_NSight()
_add_package_AntTweakBar()
#####################################################################################
# Source files for this project
#
file(GLOB SOURCE_FILES *.cpp *.hpp *.inl *.h *.c)
file(GLOB GLSL_FILES *.glsl)
#####################################################################################
# Executable
#
if(WIN32 AND NOT GLUT_FOUND)
add_definitions(/wd4996) #remove printf warning
add_definitions(/wd4244) #remove double to float conversion warning
add_definitions(/wd4305) #remove double to float truncation warning
add_executable(${PROJNAME} WIN32 ${SOURCE_FILES} ${COMMON_SOURCE_FILES} ${PACKAGE_SOURCE_FILES} ${GLSL_FILES})
else()
add_executable(${PROJNAME} ${SOURCE_FILES} ${COMMON_SOURCE_FILES} ${PACKAGE_SOURCE_FILES} ${GLSL_FILES})
endif()
#####################################################################################
# common source code needed for this sample
#
source_group(common FILES
${COMMON_SOURCE_FILES}
${PACKAGE_SOURCE_FILES}
)
source_group(shaders FILES
${GLSL_FILES}
)
#####################################################################################
# Linkage
#
target_link_libraries(${PROJNAME} optimized
${LIBRARIES_OPTIMIZED}
${PLATFORM_LIBRARIES}
shared_sources
)
target_link_libraries(${PROJNAME} debug
${LIBRARIES_DEBUG}
${PLATFORM_LIBRARIES}
shared_sources
)
#####################################################################################
# copies binaries that need to be put next to the exe files (ZLib, etc.)
#
_copy_binaries_to_target( ${PROJNAME} )