-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
209 lines (177 loc) · 7.82 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
cmake_minimum_required(VERSION 2.6)
project(OgreProcedural)
set(CMAKE_MODULE_PATH
"${OgreProcedural_SOURCE_DIR}/CMake"
"${OgreProcedural_SOURCE_DIR}/CMake/Utils"
"${OgreProcedural_SOURCE_DIR}/CMake/Packages"
)
include(ProceduralAddTargets)
set(OgreProcedural_VERSION_MAJOR 0)
set(OgreProcedural_VERSION_MINOR 3)
set(OgreProcedural_VERSION_PATCH 0)
set(OgreProcedural_VERSION_DASH_SEPARATED "0.3.0 unstable")
if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
# differentiation between debug and release builds.
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
set(CMAKE_DEBUG_POSTFIX "_d")
if (WIN32 OR APPLE)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"${OgreProcedural_BINARY_DIR}/sdk" CACHE PATH "PROCEDURAL install prefix" FORCE
)
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif(WIN32 OR APPLE)
if (IS_DIRECTORY "${OgreProcedural_SOURCE_DIR}/Dependencies")
message(STATUS "Found a directory named Dependencies...")
set(OgreProcedural_DEPENDENCIES_DIR "${OgreProcedural_SOURCE_DIR}/Dependencies")
if (IS_DIRECTORY "${OgreProcedural_DEPENDENCIES_DIR}/doxygen")
message(STATUS "Found doxygen")
set(DOXYGEN_DIR "${OgreProcedural_DEPENDENCIES_DIR}/doxygen")
endif()
file(GLOB GRAPHVIZ_POSSIBLE_PATH "${OgreProcedural_DEPENDENCIES_DIR}/Graphviz*")
if (EXISTS "${GRAPHVIZ_POSSIBLE_PATH}")
message(STATUS "Found Graphviz")
set(DOXYGEN_DOT_PATH "${GRAPHVIZ_POSSIBLE_PATH}/bin")
endif()
if (EXISTS "${OgreProcedural_DEPENDENCIES_DIR}/lua")
message(STATUS "Found lua")
set(LUA_DIR "${OgreProcedural_DEPENDENCIES_DIR}/lua")
endif()
file(GLOB SWIG_POSSIBLE_PATH "${OgreProcedural_DEPENDENCIES_DIR}/swig*")
if (EXISTS "${SWIG_POSSIBLE_PATH}")
message(STATUS "Found Swig")
set(SWIG_DIR ${SWIG_POSSIBLE_PATH})
endif()
endif()
find_package(OGRE REQUIRED CONFIG)
link_directories(${OGRE_LIBRARY_DIRS})
# Unity build options
# A Unity build includes all sources files in just a few actual compilation units
# to potentially speed up the compilation.
option(OgreProcedural_UNITY_BUILD "Enable unity build for OgreProcedural." FALSE)
set(OgreProcedural_UNITY_FILES_PER_UNIT "50" CACHE STRING "Number of files per compilation unit in Unity build.")
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /MP /Zm256")
# Enable intrinsics on MSVC in debug mode
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi")
if (CMAKE_CL_64)
# Visual Studio bails out on debug builds in 64bit mode unless
# this flag is set...
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /bigobj")
endif ()
if (OgreProcedural_UNITY_BUILD)
# object files can get large with Unity builds
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif ()
if (MSVC_VERSION GREATER 1600 OR MSVC_VERSION EQUAL 1600)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif ()
endif ()
find_package(Doxygen)
option(OgreProcedural_BUILD_SAMPLES "Build OgreProcedural samples." TRUE)
option(OgreProcedural_BUILD_TESTS "Build OgreProcedural test cases." FALSE)
option(OgreProcedural_BUILD_SCRIPT_INTERPRETER "Build a lua test bench to prototype stuff with OgreProcedural." FALSE)
option(OgreProcedural_BUILD_OGITOR_PLUGIN "Build Ogitor Plugin." FALSE)
option(OgreProcedural_BUILD_DOCS "Build documentation (if Doxygen is installed)." TRUE)
option(OgreProcedural_INSTALL_DOCS "Install documentation." FALSE)
if(MSVC)
option(OgreProcedural_INSTALL_PDB "Install debug files." FALSE)
endif ()
option(OgreProcedural_STATIC "Static build." FALSE)
# option(OgreProcedural_ILLUSTRATIONS "Build illustrations for manual" FALSE)
set(OgreProcedural_ILLUSTRATIONS_PATH "${OgreProcedural_BINARY_DIR}/image")
# Set docs target directory
if (WIN32 OR APPLE)
set(OgreProcedural_DOCS_PATH "docs")
elseif (UNIX)
set(OgreProcedural_DOCS_PATH "share/OgreProcedural/docs")
endif ()
# Specify build paths
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OgreProcedural_BINARY_DIR}/bin")
set(OgreProcedural_TEMPLATES_DIR "${OgreProcedural_SOURCE_DIR}/CMake/Templates")
set(OgreProcedural_WORK_DIR ${OgreProcedural_BINARY_DIR})
set(OgreProcedural_LIB_DIRECTORY "lib${LIB_SUFFIX}" CACHE STRING "Install path for libraries, e.g. 'lib64' on some 64-bit Linux distros.")
# Configure version file for use by scripts
configure_file("${OgreProcedural_TEMPLATES_DIR}/version.txt.in" "${OgreProcedural_BINARY_DIR}/version.txt" @ONLY)
include_directories("${OgreProcedural_SOURCE_DIR}/library/include" "${OgreProcedural_BINARY_DIR}/include")
find_package(Freetype)
add_subdirectory(library)
# definitions for samples
set(OgreProcedural_LIBRARIES OgreProcedural)
# CMake macros
include(ProceduralMacros)
include(ProceduralConfigTargets)
if (OgreProcedural_ILLUSTRATIONS OR OgreProcedural_BUILD_SAMPLES OR OgreProcedural_BUILD_TESTS)
prepare_demo_dirs()
endif()
if (OgreProcedural_BUILD_SAMPLES)
add_subdirectory(samples)
endif()
if (OgreProcedural_BUILD_TESTS)
add_subdirectory(tests)
endif()
if (OgreProcedural_BUILD_SCRIPT_INTERPRETER)
add_subdirectory(tools/ScriptInterpreter)
endif()
# documentation
if(OgreProcedural_BUILD_DOCS)
add_subdirectory(docs)
endif()
# Install CMake modules
add_subdirectory(CMake)
# and CPack
# cpack
set(CPACK_PACKAGE_DESCRIPTION "OgreProcedural")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ogre-Procedural is an Ogre3D based lib enabling developpers to quickly create geometric primitives, such as cubes, spheres, cylinders...")
set(CPACK_PACKAGE_NAME "ogre-procedural")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "ogre")
set(CPACK_PACKAGE_CONTACT "webmaster@ogreprocedural.org")
set(CPACK_PACKAGE_VENDOR "webmaster@ogreprocedural.org")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.md")
# TODO: add the version variable at the top in here
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "OgreProcedural-${OgreProcedural_VERSION_DASH_SEPARATED}")
SET(CPACK_GENERATOR ZIP)
IF(UNIX)
SET(CPACK_GENERATOR ${CPACK_GENERATOR};STGZ;TGZ)
ENDIF(UNIX)
IF(LINUX)
SET(CPACK_GENERATOR ${CPACK_GENERATOR};DEB;RPM)
ENDIF(LINUX)
IF(MSVC)
SET(CPACK_GENERATOR ${CPACK_GENERATOR};NSIS)
ENDIF(MSVC)
IF(APPLE)
SET(CPACK_GENERATOR ${CPACK_GENERATOR};PackageMaker)
ENDIF(APPLE)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${OgreProcedural_VERSION_DASH_SEPARATED}-${CMAKE_SYSTEM_PROCESSOR}")
# some NSIS stuff
IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
#SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} OgreProcedural")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\http://www.ogre3d.org/tikiwiki/Ogre+Procedural+Geometry+Library")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\http://www.ogre3d.org/tikiwiki/Ogre+Procedural+Geometry+Library")
SET(CPACK_NSIS_CONTACT "webmaster@ogreprocedural.org")
SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
#SET(CPACK_STRIP_FILES "bin/MyExecutable")
SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
#SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable")
INCLUDE(CPack)
if (OgreProcedural_INSTALL_DOCS)
# other doc files
set(DOC_FILES Contributors.txt MIT.txt ReadMe.txt)
install(FILES ${DOC_FILES} DESTINATION ${OgreProcedural_DOCS_PATH})
endif()