-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
241 lines (212 loc) · 11.3 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# © Copyright 2010 - 2020 BlackTopp Studios Inc.
# This file is part of The Mezzanine Engine.
#
# The Mezzanine Engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Mezzanine Engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
#
# The original authors have included a copy of the license specified above in the
# 'Docs' folder. See 'gpl.txt'
#
# We welcome the use of the Mezzanine engine to anyone, including companies who wish to
# Build professional software and charge for their product.
#
# However there are some practical restrictions, so if your project involves
# any of the following you should contact us and we will try to work something
# out:
# - DRM or Copy Protection of any kind(except Copyrights)
# - Software Patents You Do Not Wish to Freely License
# - Any Kind of Linking to Non-GPL licensed Works
# - Are Currently In Violation of Another Copyright Holder's GPL License
# - If You want to change our code and not add a few hundred MB of stuff to
# your distribution
#
# These and other limitations could cause serious legal problems if you ignore
# them, so it is best to simply contact us or the Free Software Foundation, if
# you have any questions.
#
# Joseph Toppi - toppij@gmail.com
# John Blackwood - makoenergy02@gmail.com
########################################################################################################################
cmake_minimum_required(VERSION 3.13)
project(StaticFoundation)
message(STATUS "${PROJECT_NAME} - Starting Configuration using CMake ${CMAKE_VERSION}.")
############################################################################|###########################################
# Download, Verify and Setup the Jagati
if(NOT JAGATI_File)
set(JAGATI_File "${${PROJECT_NAME}_BINARY_DIR}/Jagati.cmake" CACHE FILEPATH
"The file to load the Jagati from and potentially to download it to.")
endif(NOT JAGATI_File)
if(NOT JAGATI_Download)
option(JAGATI_Download "Should the Jagati be downloaded automatically" ON)
endif(NOT JAGATI_Download)
if(JAGATI_Download)
set(JAGATI_Checksum "a22b85ce3c85a2e030a43c57970164df5ca1f8f9d91a568d5d6\
2c0ff81cbb9cec3666e562c7afc0ab170994810c97614153e934ca9fd8c79101c675a7f55ae3f"
CACHE STRING "Check that when the Jagati is downloaded the right one is used (for consistency and security).")
set(JAGATI_Url "https://raw.githubusercontent.com/BlackToppStudios/Jagati/0.31.0/Jagati.cmake"
CACHE STRING "Where to download the Jagati from.")
file(DOWNLOAD "${JAGATI_Url}" "${JAGATI_File}" EXPECTED_HASH SHA512=${JAGATI_Checksum})
endif(JAGATI_Download)
include("${JAGATI_File}")
########################################################################################################################
# The rest of the Jagati setup
# Override One Jagati setting so that everyfike knows where this test executable is. This is required because most of
# the test settings and code are in MEZZ_Test which requires this package.
set(${PROJECT_NAME}BinTarget "${PROJECT_NAME}_Tester")
# Otherwise normal Jagati setup
StandardJagatiSetup()
########################################################################################################################
message(STATUS "Determining Source Files.")
AddHeaderFile("CrossPlatformExport.h")
AddHeaderFile("DataTypes.h")
AddHeaderFile("DetectionTraits.h")
AddHeaderFile("RuntimeStatics.h")
AddHeaderFile("StaticFoundation.h")
AddHeaderFile("StaticString.h")
AddHeaderFile("SuppressWarnings.h")
AddHeaderFile("Trace.h")
ShowList("Header Files:" "\t" "${StaticFoundationHeaderFiles}")
AddSourceFile("RuntimeStatics.cpp")
AddSourceFile("Trace.cpp")
ShowList("Source Files:" "\t" "${StaticFoundationSourceFiles}")
# Because this can't rely on Mezz_Test we need to do this manually
AddMainSourceFile("${StaticFoundationTestDir}Tests.h")
AddMainSourceFile("${StaticFoundationTestDir}Tests.cpp")
ShowList("Test Source Files:" "\t" "${StaticFoundationMainSourceFiles}")
AddSwigEntryPoint("SwigConfig.h")
ShowList("Swig Input Files:" "\t" "${StaticFoundationSwigFiles}")
AddJagatiDoxInput("Dox.h")
ShowList("Doxygen Input Files:" "\t" "${JagatiDoxArray}")
########################################################################################################################
# Set up config file
AddJagatiCompileOption("MEZZ_BuildDoxygen"
"Create HTML documentation with Doxygen. Requires Doxygen to be install in PATH." ON)
AddJagatiCompileOption("MEZZ_BuildStaticLibraries"
"If set the Mezzanine will be built as static libraries, shared if unset." ON)
AddJagatiCompileOption("MEZZ_CodeCoverage"
"If set compiler flags will be set that gather code coverage data on build results." OFF)
AddJagatiCompileOption("MEZZ_ForceGcc32Bit"
"If set and the compiler is Gcc compatible then the compiler will use a 32 instead of the 64 bit default" OFF)
AddJagatiCompileOption("MEZZ_Trace"
"Turn on troubleshooting tracing." OFF)
UseStaticLinking(${MEZZ_BuildStaticLibraries})
ChooseCodeCoverage(${MEZZ_CodeCoverage})
AddJagatiConfig("MEZZ_CpuKnown" "" ${CpuIsKnown})
AddJagatiConfig("MEZZ_CpuX86" "" ${CpuIsX86})
AddJagatiConfig("MEZZ_CpuAmd64" "" ${CpuIsAmd64})
AddJagatiConfig("MEZZ_CpuArm" "" ${CpuIsArm})
AddJagatiConfig("MEZZ_Linux" "" ${SystemIsLinux})
AddJagatiConfig("MEZZ_Windows" "" ${SystemIsWindows})
AddJagatiConfig("MEZZ_MacOSX" "" ${SystemIsMacOSX})
AddJagatiConfig("MEZZ_Ios" "" ${SystemIsIOS})
AddJagatiConfig("MEZZ_CompilerDetected" "" ${CompilerDetected})
AddJagatiConfig("MEZZ_CompilerIsClang" "" ${CompilerIsClang})
AddJagatiConfig("MEZZ_CompilerIsEmscripten" "" ${CompilerIsEmscripten})
AddJagatiConfig("MEZZ_CompilerIsGCC" "" ${CompilerIsGCC})
AddJagatiConfig("MEZZ_CompilerIsIntel" "" ${CompilerIsIntel})
AddJagatiConfig("MEZZ_CompilerIsMsvc" "" ${CompilerIsMsvc})
AddJagatiConfig("MEZZ_CompilerDesignNix" "" ${CompilerDesignNix})
AddJagatiConfig("MEZZ_CompilerDesignMS" "" ${CompilerDesignMS})
AddJagatiConfig("MEZZ_Arch64" "" ${Platform64Bit})
AddJagatiConfig("MEZZ_Arch32" "" ${Platform32Bit})
AddJagatiConfig("MEZZ_Debug" "" ${CompilerDebug})
EmitConfig()
AddConfigSource()
ShowList("Config Files made by StaticFoundation:" "\t" "${StaticFoundationConfigFilename}")
AddJagatiDoxInput("${StaticFoundationConfigFilename}")
########################################################################################################################
# Set up Doxygen Targets
if(MEZZ_BuildDoxygen)
find_program(MEZZ_DoxygenExecutable "doxygen")
if(MEZZ_DoxygenExecutable)
set(DoxygenConfigDir "${StaticFoundationDoxDir}doxyfiles/")
set(DoxygenResultsDir "${StaticFoundationBinaryDir}Doxygen/")
set(WarningsFile "${DoxygenResultsDir}html/DoxygenWarnings.txt")
string (REPLACE ";" " " DoxygenInputs "${JagatiDoxArray}")
configure_file(${DoxygenConfigDir}Doxyfile ${StaticFoundationBinaryDir})
if(EXISTS ${WarningsFile})
else(EXISTS ${WarningsFile})
file(MAKE_DIRECTORY ${DoxygenResultsDir})
file(WRITE ${WarningsFile} "")
endif(EXISTS ${WarningsFile})
message(STATUS "Found doxygen Executable at '${MEZZ_DoxygenExecutable}'")
add_custom_target(MezzanineDocumentation ALL
COMMAND ${MEZZ_DoxygenExecutable} ${StaticFoundationBinaryDir}Doxyfile
COMMAND ${CatCommand} ${DoxygenResultsDir}html/DoxygenWarnings.txt 1>&2
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/closed.png
${DoxygenResultsDir}html/clclosed.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/closed.png
${DoxygenResultsDir}html/closed.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/open.png
${DoxygenResultsDir}html/clopen.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/favicon.ico
${DoxygenResultsDir}html/favicon.ico
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/open.png
${DoxygenResultsDir}html/open.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/red_x.png
${DoxygenResultsDir}html/search/close.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}img/Magnifier.png
${DoxygenResultsDir}html/search/mag_sel.png
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DoxygenConfigDir}html/search.css
${DoxygenResultsDir}html/search/search.css
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/tab_a.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/tab_b.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/tab_h.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/tab_s.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/search/search_m.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/search/search_l.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/search/search_r.png
COMMAND ${CMAKE_COMMAND} -E remove
${DoxygenResultsDir}html/search_r.png
WORKING_DIRECTORY ${DoxygenConfigDir}
COMMENT "Generating API documentation with Doxygen" VERBATIM
SOURCES ${DoxygenConfigDir}Doxyfile
${DoxygenConfigDir}layout.xml
${DoxygenResultsDir}html/DoxygenWarnings.txt
${DoxygenConfigDir}html/DoxyStyle.css
${DoxygenConfigDir}html/search.css
${DoxygenConfigDir}html/DoxyFooter.html
${DoxygenConfigDir}html/DoxyHeader.html
)
# Creation Doxygen target here
else(MEZZ_DoxygenExecutable)
message(ERROR
" Could not find doxygen executable, is it installed and in your system Path?'")
endif(MEZZ_DoxygenExecutable)
endif(MEZZ_BuildDoxygen)
########################################################################################################################
# Set up Build targets
# Add this as a library to the list of available libraries.
AddJagatiLibrary()
CreateCoverageTarget(${StaticFoundationLib} ${StaticFoundationSourceFiles})
# This makes its own tester as the main exe because this cannot rely on Mezz_Test.
AddJagatiExecutable()
# Some extra creating of targets for other development related tasks
AddIDEVisibility("${StaticFoundationTestSourceFiles};Jenkinsfile")
SetCodeCoverage()
message(STATUS "${PROJECT_NAME} - Ending Configuration.")