-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathCMakeLists.txt
107 lines (91 loc) · 2.87 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(FORGE)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
INCLUDE(FGInstallDirs)
SET(USE_WINDOW_TOOLKIT "glfw3" CACHE STRING "Choose Window toolkit")
SET_PROPERTY(CACHE USE_WINDOW_TOOLKIT PROPERTY STRINGS "glfw3" "sdl2")
OPTION(BUILD_DOCUMENTATION "Build Documentation" OFF)
OPTION(BUILD_EXAMPLES "Build Examples" ON)
# Set a default build type if none was specified
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
ENDIF()
IF(UNIX)
ADD_DEFINITIONS(-Wall -std=c++11 -fvisibility=hidden)
ENDIF()
# OS Definitions
IF(UNIX)
IF(APPLE)
ADD_DEFINITIONS(-DOS_MAC)
SET(CMAKE_MACOSX_RPATH ON)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
ENDIF("${isSystemDir}" STREQUAL "-1")
ELSE(APPLE)
ADD_DEFINITIONS(-DOS_LNX)
ENDIF(APPLE)
ELSE(UNIX)
ADD_DEFINITIONS(-DOS_WIN -DNOMINMAX)
ENDIF(UNIX)
# Architechture Definitions
#INCLUDE(${CMAKE_MODULE_PATH}/TargetArch.cmake)
#target_architecture(ARCH)
#IF(${ARCH} STREQUAL "x86_64")
# ADD_DEFINITIONS(-DARCH_64)
#ELSE(${ARCH})
# ADD_DEFINITIONS(-DARCH_32)
#ENDIF()
INCLUDE(${CMAKE_MODULE_PATH}/Version.cmake)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLEWmx REQUIRED)
IF(GLEWmx_FOUND AND OPENGL_FOUND)
ADD_DEFINITIONS(-DGLEW_MX)
SET(GL_INC_DIR
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
)
SET(GL_LIBS
${OPENGL_gl_LIBRARY}
${GLEWmx_LIBRARY})
ELSE()
IF(NOT GLEWmx_FOUND)
MESSAGE(FATAL_ERROR "GLEW-MX not found")
ENDIF()
IF(NOT OPENGL_FOUND)
MESSAGE(FATAL_ERROR "OpenGL not found")
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(
"${PROJECT_SOURCE_DIR}/include"
${GL_INC_DIR}
)
SET(X11_LIBS "")
IF(APPLE)
FIND_PACKAGE(X11 REQUIRED)
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
SET(X11_LIBS ${X11_LIBRARIES})
ENDIF(APPLE)
ADD_SUBDIRECTORY(src)
## Install step
INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "${FG_INSTALL_INC_DIR}"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN ".gitignore" EXCLUDE
)
IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF()
# Generate documentation
IF(BUILD_DOCUMENTATION)
ADD_SUBDIRECTORY(docs)
ENDIF(BUILD_DOCUMENTATION)