-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (71 loc) · 3.04 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
################################################################
# Created by: #
# Ben Allen & Joshua Scott #
################################################################
# require new behaviour of: CMP0054
cmake_minimum_required(VERSION 3.1)
# Assignment Name
set(CGRA_PROJECT "a3" CACHE STRING "CGRA Project Name")
# Project
project("CGRA_PROJECT_${CGRA_PROJECT}" CXX C)
# Enable IDE Project Folders
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
#########################################################
# Force Output Directories
# In general, this isn't a very friendly thing to do, but
# we'll do it anyway so the exes are in a reliable place.
#########################################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
#########################################################
# Find OpenGL
#########################################################
find_package(OpenGL REQUIRED)
#########################################################
# Include GLFW Subproject
#########################################################
add_subdirectory("work/ext/glfw")
include_directories("work/ext/glfw/include")
#########################################################
# Include GLEW Subproject
#########################################################
add_subdirectory("work/ext/glew-1.10.0")
#########################################################
# Include STB Subproject
#########################################################
add_subdirectory("work/ext/stb")
#########################################################
# Set Compiler Flags
#########################################################
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Full normal warnings
add_compile_options(/W4)
# Ignore C4800: forcing X to bool (performance warning)
add_compile_options(/wd4800)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# C++14
add_compile_options(-std=c++1y)
# Full normal warnings
add_compile_options(-Wall -Wextra -pedantic)
# Promote missing return to error
add_compile_options(-Werror=return-type)
# enable coloured output if gcc >= 4.9
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
add_compile_options(-fdiagnostics-color)
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
# C++14
add_compile_options(-std=c++1y)
# Full normal warnings
add_compile_options(-Wall -Wextra -pedantic)
# Promote missing return to error
add_compile_options(-Werror=return-type)
endif()
#########################################################
# Source Files
#########################################################
add_subdirectory(work/src) # Primary source files
add_subdirectory(work/res) # Resources like shaders (show up in IDE)
set_property(TARGET ${CGRA_PROJECT} PROPERTY FOLDER "CGRA")