-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeUtils.txt
63 lines (44 loc) · 2.01 KB
/
CMakeUtils.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
function(add_glutproject APP_NAME APP_SRC)
ADD_DEFINITIONS(-DGLEW_STATIC)
ADD_DEFINITIONS(-DFREEGLUT_STATIC)
#ARGV2 = APP_COMP_API
IF(NOT DEFINED ARGV2)
SET(ARGV2 "ARGV_NULL")
ENDIF()
IF(${ARGV2} STREQUAL "COMPCU" AND NOT CUDA_FOUND)
RETURN()
ENDIF()
IF( ${ARGV2} STREQUAL "COMPCU" )
LIST(APPEND APP_LIBS ${CUDA_LIBRARIES})
CUDA_ADD_EXECUTABLE( ${APP_NAME} ${APP_SRC} ${SRC_APPFW} ${SRC_SYSTEM} ${SRC_MATH} ${SRC_ASSETS} ${SRC_GLUTIL} ${SRC_CUUTIL} )
SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES COMPILE_DEFINITIONS "COMPCU" )
ELSEIF( ${ARGV2} STREQUAL "COMPCL" )
LIST(APPEND APP_LIBS clew)
ADD_EXECUTABLE( ${APP_NAME} ${APP_SRC} ${SRC_APPFW} ${SRC_SYSTEM} ${SRC_MATH} ${SRC_ASSETS} ${SRC_GLUTIL} ${SRC_CLUTIL} )
SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES COMPILE_DEFINITIONS "COMPCL" )
ELSE()
ADD_EXECUTABLE( ${APP_NAME} ${APP_SRC} ${SRC_APPFW} ${SRC_SYSTEM} ${SRC_MATH} ${SRC_ASSETS} ${SRC_GLUTIL} )
SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES COMPILE_DEFINITIONS "COMPGL")
ENDIF()
IF(WIN32)
TARGET_LINK_LIBRARIES( ${APP_NAME} ${APP_LIBS} glew freeglut )
ENDIF(WIN32)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES( ${APP_NAME} ${APP_LIBS} glew glut GL )
ENDIF(UNIX AND NOT APPLE)
MESSAGE(STATUS "Project added: " ${APP_NAME})
source_group("${APP_NAME}" FILES ${APP_SRC})
source_group("${APP_NAME}\\appfw" FILES ${SRC_APPFW})
source_group("${APP_NAME}\\system" FILES ${SRC_SYSTEM})
source_group("${APP_NAME}\\math\\" FILES ${SRC_MATH_BASE})
source_group("${APP_NAME}\\math\\core" FILES ${SRC_MATH_CORE})
source_group("${APP_NAME}\\math\\util" FILES ${SRC_MATH_UTIL})
source_group("${APP_NAME}\\assets\\" FILES ${SRC_ASSETS})
source_group("${APP_NAME}\\glutil\\" FILES ${SRC_GLUTIL})
IF( ${ARGV2} STREQUAL "COMPCL" )
source_group("${APP_NAME}\\clutil\\" FILES ${SRC_CLUTIL})
ENDIF()
IF( ${ARGV2} STREQUAL "COMPCU" )
source_group("${APP_NAME}\\cuutil\\" FILES ${SRC_CUUTIL})
ENDIF()
endfunction()