This repository has been archived by the owner on Aug 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
/
CMakeLists.txt
127 lines (100 loc) · 3.1 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_policy(VERSION 2.6)
project(ogl-samples-pack)
enable_testing()
#CMAKE_BUILD_TOOL
################################
# Add common source
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/common")
################################
# Add package
macro(addExternalPackageGTC NAME DIRECTORY)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/external/${DIRECTORY}/util)
set(${NAME}_PACKAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/${DIRECTORY})
find_package(${NAME})
if(NOT ${NAME}_FOUND)
message("ERROR: ${NAME} not found")
endif(NOT ${NAME}_FOUND)
endmacro(addExternalPackageGTC)
################################
# Add GLEXT
find_package(OpenGL)
find_package(GLUT)
if(NOT OPENGL_FOUND)
message("ERROR: OpenGL not found")
endif(NOT OPENGL_FOUND)
################################
# Add OpenCL
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/external/cl-1.2")
################################
# Add External package
if(MSVC)
addExternalPackageGTC("GLEW" "glew-1.7.0")
addExternalPackageGTC("FREEGLUT" "freeglut-2.8.0")
endif(MSVC)
addExternalPackageGTC("OPENCL" "cl-1.2")
addExternalPackageGTC("GLES2" "gles-2.0")
addExternalPackageGTC("EGL" "egl-1.4")
addExternalPackageGTC("GLM" "glm-0.9.3.0")
addExternalPackageGTC("GLI" "gli-0.3.1.0")
################################
# Add libraries to executables
if(APPLE)
set(BINARY_FILES
${OPENGL_LIBRARY}
${OPENCL_LIBRARY}
${GLM_LIBRARY}
${GLI_LIBRARY})
else(APPLE)
set(BINARY_FILES
${OPENGL_LIBRARY}
${OPENCL_LIBRARY}
${FREEGLUT_LIBRARY}
${GLEW_LIBRARY}
${GLM_LIBRARY}
${GLI_LIBRARY})
endif(APPLE)
################################
# Add output directory
if(MSVC)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/)
else(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/debug )
else(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/release )
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(MSVC)
################################
# Add custom target to copy all data
if(APPLE)
add_custom_target(
${TARGET_DATA_COPY}
COMMAND ls)
else(APPLE)
set(TARGET_DATA_COPY DATA_COPY)
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(
${TARGET_DATA_COPY}
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(
${TARGET_DATA_COPY}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data)
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
endif(APPLE)
set(OGL_DATA_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)
################################
# Add options
option(OGL_SAMPLES_STATUS "OGL_SAMPLES_STATUS" OFF)
if(OGL_SAMPLES_STATUS)
add_definitions(-DGLF_AUTO_STATUS)
endif()
################################
# Add definitions
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
################################
# Add subdirectory
add_subdirectory(samples)