-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
61 lines (53 loc) · 2.35 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
# Project initialization
cmake_minimum_required(VERSION 2.7.2 FATAL_ERROR)
project("opengl_examples")
# Compiler settings
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# Wall: Enable all warnings about constructors
# Wextra: Enable some extra warnings
# Werror: Treat all warnings as errors
# set(warnings "-Wall -Wextra -Werror")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# W4: Show the most warnings
# WX: Treat all warnings as errors
# EHsc: Only emit code for exception filters when detected that the code in the try block might throw a C++ exception
set(warnings "/W4 /EHsc")
set(CMAKE_CONFIGURATION_TYPES Debug Release)
endif()
# Set warnings
if (NOT CONFIGURED_ONCE)
set(CMAKE_CXX_FLAGS "${warnings}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
endif()
# Set variables
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(PROJECTS_DIR ${CMAKE_SOURCE_DIR}/src/projects)
# Add include directories
include_directories(${INCLUDE_DIR})
include_directories(${INCLUDE_DIR}/projects)
include_directories(${INCLUDE_DIR}/glad/include)
# Build and include GLFW
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(${INCLUDE_DIR}/glfw)
include_directories(${INCLUDE_DIR}/glfw/include)
include_directories(${INCLUDE_DIR}/glfw/deps)
# Add subdirectories (projects)
add_subdirectory(${PROJECTS_DIR}/basic_cube)
add_subdirectory(${PROJECTS_DIR}/multiple_attributes_and_buffers)
add_subdirectory(${PROJECTS_DIR}/compute_shader)
add_subdirectory(${PROJECTS_DIR}/texture)
add_subdirectory(${PROJECTS_DIR}/texture_array)
add_subdirectory(${PROJECTS_DIR}/tesselation)
add_subdirectory(${PROJECTS_DIR}/tesselation_displacement_map)
add_subdirectory(${PROJECTS_DIR}/transform_feedback)
add_subdirectory(${PROJECTS_DIR}/geometry_shader)
add_subdirectory(${PROJECTS_DIR}/geometry_shader_normal_viewer)
add_subdirectory(${PROJECTS_DIR}/framebuffers)
add_subdirectory(${PROJECTS_DIR}/read_pixels)
add_subdirectory(${PROJECTS_DIR}/point_sprites)
add_subdirectory(${PROJECTS_DIR}/phong_lighting)
add_subdirectory(${PROJECTS_DIR}/raytracer)
add_subdirectory(${PROJECTS_DIR}/fullscreen_quad)
# Create a variable that is set to true and cached after the first configuration
set(CONFIGURED_ONCE TRUE CACHE INTERNAL "A flag showing that CMake has configured at least once.")