-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists_old.txt
157 lines (129 loc) · 4.69 KB
/
CMakeLists_old.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Copyright Linkoping University 2011
# SGCT Project Authors see Authors.txt
#
# General project settings
#
cmake_minimum_required(VERSION 2.6.2)
project(SGCT C CXX)
#
# Path for custom cmake modules, like FindXPackage.cmake
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
#------------------------------------
# Build Type
# Release/Debug/RelWithDebInfo/MinSizeRel...
set(CMAKE_BUILD_TYPE RelWithDebInfo)
#--------------------------------------------------------------------
# Output paths for the executables and libraries
#
if(NOT EXECUTABLE_OUTPUT_PATH)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all executables.")
endif(NOT EXECUTABLE_OUTPUT_PATH)
if(NOT LIBRARY_OUTPUT_PATH)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH
"DEFAULT LIBRARY PATH.")
endif(NOT LIBRARY_OUTPUT_PATH)
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
#
# Build Dependencies
#
INCLUDE_DIRECTORIES(
src/
src/deps/freetype/include
src/deps/glew/include
src/deps/glfw/include
src/deps/lpng/include
src/deps/tinyxml/include
src/deps/zlib/include
)
#
# Find modules, ex third party libs, include files
#
##TODO BUILD FROM SOURCE
#find_package(GLEW REQUIRED)
#INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
#havent been able to make a cmake file for GLFW 2.7 yet
find_package(GLFW REQUIRED)
INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIR})
# OpenGL
find_package(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
SET(GL_LIBS ${OPENGL_gl_LIBRARY})
#USE x11
IF(UNIX AND NOT APPLE)
INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
list(APPEND GL_LIBS ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})
ENDIF(UNIX AND NOT APPLE)
#USE COCOA
IF(UNIX AND APPLE)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
list(APPEND GL_LIBS ${COCOA_LIBRARY})
ENDIF(UNIX AND APPLE)
set(SGCT_DEPENDENCIES ${GL_LIBS} ${GLFW_LIBRARY} glew tinyxml zlib png15 freetype)
#--------------------------------------------------------------------
# Project Paths
#
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sgct/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
set(SGCT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/sgct/src)
set(SGCT_BINARY_DIR ${CMAKE_BINARY_DIR})
set(SGCT_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH})
set(SGCT_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH})
#--------------------------------------------------------------------
# Boolean values to build the different projects
option(WITH_EXAMPLES "Compile example projects" ON)
#--------------------------------------------------------------------
# Build shared libs or static libs
option(BUILD_SHARED_LIBS "Build shared libs or static libs" OFF)
mark_as_advanced(BUILD_SHARED_LIBS)
#--------------------------------------------------------------------
# If the generator is VS8, set the compiler to VS8
#
if(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005")
if(NOT ${CMAKE_CXX_COMPILER} MATCHES "8")
string(REPLACE "9.0" "8" CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
string(REPLACE "9.0" "8" CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
endif(NOT ${CMAKE_CXX_COMPILER} MATCHES "8")
endif(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005")
#--------------------------------------------------------------------
# Disable deprecation warnings for standard C functions.
#
if(CMAKE_COMPILER_2005)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
endif(CMAKE_COMPILER_2005)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DDARWIN)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#--------------------------------------------------------------------
# Set preprocessor definition for static or shared build
# This variable should be used by all libraries in the subdirectories.
# Set the LIB_TYPE variable to STATIC
#--------------------------------------------------------------------
SET(BUILD_SHARED_LIBS OFF)
IF (BUILD_SHARED_LIBS)
add_definitions(-DSGCT_ALL_DYN_LINK)
SET(BUILD_SHARED_LIBS ON)
ENDIF (BUILD_SHARED_LIBS)
#--------------------------------------------------------------------
# Disable deprecation warnings for standard C functions
#
if(CMAKE_COMPILER_2005)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
endif(CMAKE_COMPILER_2005)
#--------------------------------------------------------------------
# Set preprocessor definition to indicate whether
# to use the debug postfix
#
if(DEBUG_POSTFIX)
add_definitions(-D_DEBUG_POSTFIX)
endif(DEBUG_POSTFIX)
#--------------------------------------------------------------------
# Build
#--------------------------------------------------------------------
ADD_SUBDIRECTORY(src/deps)
ADD_SUBDIRECTORY(src/sgct)
IF(WITH_EXAMPLES)
add_subdirectory(src/apps)
ENDIF(WITH_EXAMPLES)