-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
112 lines (88 loc) · 3.81 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 2.8)
set(PROJNAME Invk)
Project(${PROJNAME})
Message(STATUS "-------------------------------")
Message(STATUS "Processing Project ${PROJNAME}:")
####################################################################################
# Bootstrap
#
set( BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
find_path ( HELPERS_PATH "Helpers.cmake" HINTS ${BASE_DIRECTORY}/../libraries/helpers ${BASE_DIRECTORY}/helpers ${CMAKE_HELPERS_PATH} )
if ( ${HELPERS_PATH} STREQUAL "HELPERS-NOTFOUND" )
message ( FATAL_ERROR "\n Please set the CMAKE_HELPERS_PATH to for cmake helpers." )
endif()
include( ${HELPERS_PATH}/Helpers.cmake ) # Cross-Platform functions
#####################################################################################
# Sample requirements
set ( REQUIRE_JPG "0" )
set ( REQUIRE_PNG "0" )
set ( REQUIRE_TGA "0" )
set ( REQUIRE_VEC "1" )
set ( REQUIRE_CAM "1" )
set ( REQUIRE_GLEW "1" )
set ( REQUIRE_DIRECTORY "0" )
set ( REQUIRE_STRHELPER "0" )
set ( REQUIRE_MAIN "1" )
set ( REQUIRE_NVGUI "1" )
# add_definitions(-DBUILD_BMP)
####################################################################################
# Find Sample Utils
#
find_package(Utils)
#####################################################################################
# Require OpenGL
#
IF(WIN32)
LIST(APPEND LIBRARIES_OPTIMIZED "opengl32.lib" )
LIST(APPEND LIBRARIES_DEBUG "opengl32.lib" )
ENDIF()
#####################################################################################
# Source files for this project
#
file(GLOB SOURCE_FILES *.cpp *.c *.h )
########################################################################3
# Collect shaders for reference
file(GLOB GLSL_FILES ${ASSET_PATH}/*.glsl )
#####################################################################################
# Executable
#
unset ( ALL_SOURCE_FILES )
list( APPEND ALL_SOURCE_FILES ${SOURCE_FILES} )
list( APPEND ALL_SOURCE_FILES ${COMMON_SOURCE_FILES} )
list( APPEND ALL_SOURCE_FILES ${PACKAGE_SOURCE_FILES} )
list( APPEND ALL_SOURCE_FILES ${UTIL_SOURCE_FILES} )
list( APPEND ALL_SOURCE_FILES ${CUDA_FILES} )
if ( NOT DEFINED WIN32 )
#find_library(NVTOOLSEXT nvToolsExt HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64)
#set(libdeps GL GLEW X11 ${NVTOOLSEXT})
set(libdeps GL GLEW X11 )
LIST(APPEND LIBRARIES_OPTIMIZED ${libdeps})
LIST(APPEND LIBRARIES_DEBUG ${libdeps})
ENDIF()
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-DGVDB_IMPORTS -DGLEW_STATIC -DGLEW_NO_GLU)
add_definitions(-DASSET_PATH="${ASSET_PATH}/")
add_executable (${PROJNAME} ${ALL_SOURCE_FILES} ${CUDA_FILES} ${PTX_SOURCES} ${GLSL_FILES} )
set_property ( TARGET ${PROJNAME} APPEND PROPERTY DEPENDS ${PTX_SOURCES} )
if ( MSVC )
set_target_properties( ${PROJNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} )
set_target_properties( ${PROJNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH} )
set_target_properties( ${PROJNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH} )
source_group(CUDA FILES ${CUDA_FILES})
source_group(PTX FILES ${PTX_FILES})
source_group(Helpers FILES ${UTIL_SOURCE_FILES})
source_group(Core FILES ${SOURCE_FILES})
endif ()
#####################################################################################
# Library dependencies
#
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug)
foreach (loop_var IN ITEMS ${LIBRARIES_OPTIMIZED} )
target_link_libraries ( ${PROJNAME} optimized ${loop_var} )
endforeach()
foreach (loop_var IN ITEMS ${LIBRARIES_DEBUG} )
target_link_libraries ( ${PROJNAME} debug ${loop_var} )
endforeach()
message ( STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}" )
message ( STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}" )
message ( STATUS "EXECUTABLE_OUTPUT_PATH: ${EXECUTABLE_OUTPUT_PATH}" )