forked from Tuqz/helion-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (58 loc) · 2.2 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
# File: /CMakeLists.txt
# Author(s): P. Kilgore (ThyLordRoot)
# Since: 1/4/2014
# Set up project
PROJECT(helion C CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# A place for external contributions to go
FILE(MAKE_DIRECTORY external)
FILE(MAKE_DIRECTORY external/cmake/)
SET(CMAKE_MODULE_PATH "external/cmake/")
# Setup any local flags we need, like C++11 support
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(CXX11_FLAG "-std=c++0x")
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CXX11_FLAG "-std=c++11")
ENDIF()
# No compliant compiler was found
IF(NOT CXX11_FLAG)
MESSAGE(FATAL_ERROR "Helion requires C++11 support (found ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}). Please use a compliant compiler.")
ELSE()
ADD_DEFINITIONS(${CXX11_FLAG})
ENDIF()
# We need to find OpenGL
find_package(OpenGL REQUIRED)
IF (NOT OPENGL_FOUND)
MESSAGE(FATAL_ERROR "OpenGL is required to build Helion.")
ELSEIF (NOT OPENGL_GLU_FOUND)
MESSAGE(FATAL_ERROR "GLU is required to build Helion.")
ELSE()
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIRS})
ENDIF()
# See if we can find glfw
IF (NOT GLFW_FOUND)
IF (NOT EXISTS "external/cmake/FindGLFW.cmake")
# Download Pixar's handly finder script for GLFW3
FILE(DOWNLOAD "https://raw.github.com/PixarAnimationStudios/OpenSubdiv/master/cmake/FindGLFW.cmake"
"external/cmake/FindGLFW.cmake")
ENDIF()
# Make sure there's a fallback location
SET(GLFW_LOCATION "${PROJECT_SOURCE_DIR}/external/glfw")
find_package(GLFW)
ENDIF()
# Must have GLFW
IF (NOT GLFW_FOUND)
MESSAGE(FATAL_ERROR "GLFW is required to build Helion. Please extract the latest binary release into external/glfw")
ENDIF()
SET(LIBHELION_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/libhelion/")
SET(DEFAULT_INCS ${OPENGL_INCLUDE_DIR} ${GLFW_INCLUDE_DIR} ${LIBHELION_INCLUDE_DIR})
# libhelion MUST come first, since it has unresolved syms that break the linker
SET(DEFAULT_LIBS "helion-core" ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES})
# libhelion must come first
ADD_SUBDIRECTORY(src/libhelion)
# Check to see if we are building tech demos
IF(BUILD_TECH_DEMOS)
MESSAGE(STATUS "Tech demos will be included in this build.")
ADD_SUBDIRECTORY(techdemos/planetarium)
ADD_SUBDIRECTORY(techdemos/rocket_design)
ENDIF()