forked from BlueQuartzSoftware/SIMPLView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
352 lines (293 loc) · 14.7 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
cmake_policy(SET CMP0002 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0079 NEW)
cmake_policy(SET CMP0077 NEW)
cmake_minimum_required(VERSION 3.13.0)
# Request C++14 standard, using new CMake variables.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
#--------------------------------------------------------------------------------------------------
# Always write out the compile_commands.json file to help out things like QtCreator and VS Code
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(NOT "${DREAM3D_SDK}" STREQUAL "")
include("${DREAM3D_SDK}/DREAM3D_SDK.cmake")
get_property(DREAM3D_SDK_STATUS_PRINTED GLOBAL PROPERTY DREAM3D_SDK_STATUS_PRINTED)
if(NOT DREAM3D_SDK_STATUS_PRINTED)
message(STATUS "DREAM3D_SDK Location: ${DREAM3D_SDK}")
set_property(GLOBAL PROPERTY DREAM3D_SDK_STATUS_PRINTED TRUE)
endif()
endif()
#------------------------------------------------------------------------------
# Create the Top level Project
project(SIMPLViewProj VERSION 1.2.0.0)
#------------------------------------------------------------------------------
# Create the Top level Project
#
set(SIMPLViewProjGenerateVersion 0)
get_property(SIMPLViewProj_VERSION_MAJOR GLOBAL PROPERTY SIMPLViewProj_VERSION_MAJOR)
if("${SIMPLViewProj_VERSION_MAJOR}" STREQUAL "")
set(SIMPLViewProj_VERSION_MAJOR "1")
set(SIMPLViewProjGenerateVersion 1)
endif()
get_property(SIMPLViewProj_VERSION_MINOR GLOBAL PROPERTY SIMPLViewProj_VERSION_MINOR)
if("${SIMPLViewProj_VERSION_MINOR}" STREQUAL "")
set(SIMPLViewProj_VERSION_MINOR "2")
endif()
get_property(SIMPLViewProj_VERSION_PATCH GLOBAL PROPERTY SIMPLViewProj_VERSION_PATCH)
if("${SIMPLViewProj_VERSION_PATCH}" STREQUAL "")
set(SIMPLViewProj_VERSION_PATCH "0")
endif()
get_property(SIMPLViewProj_VERSION_TWEAK GLOBAL PROPERTY SIMPLViewProj_VERSION_TWEAK)
if("${SIMPLViewProj_VERSION_TWEAK}" STREQUAL "")
set(SIMPLViewProj_VERSION_TWEAK "0")
endif()
# ---------- Setup output Directories -------------------------
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${SIMPLViewProj_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Libraries"
)
endif()
# --------- Setup the Executable output Directory -------------
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${SIMPLViewProj_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Executables."
)
endif()
# --------- Setup the Executable output Directory -------------
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${SIMPLViewProj_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all static libraries."
)
endif()
#------------------------------------------------------------------------------
# Find the Git Package for Versioning. It should be ok if Git is NOT found
Find_package(Git)
get_filename_component(SIMPLView_PARENT ${SIMPLViewProj_SOURCE_DIR} DIRECTORY CACHE)
#------------------------------------------------------------------------------
# If the developer has set another CMP directory then use that, otherwise look
# for the CMP directory at the same level as the SIMPL directory
if("${CMP_SOURCE_DIR}" STREQUAL "")
set(CMP_SOURCE_DIR ${SIMPLView_PARENT}/CMP)
message(STATUS "CMP_SOURCE_DIR: ${CMP_SOURCE_DIR}")
endif()
if(NOT EXISTS "${CMP_SOURCE_DIR}")
message(FATAL_ERROR "CMP_SOURCE_DIR does not exist at ${CMP_SOURCE_DIR}.")
endif()
include(${CMP_SOURCE_DIR}/cmpProject.cmake)
include(${CMP_SOURCE_DIR}/cmpCMakeMacros.cmake )
# If SIMPLView is being built from another higher level project then this is should be set to 0
if(${SIMPLViewProjGenerateVersion} EQUAL 1)
cmpRevisionString( GENERATED_HEADER_FILE_PATH "SIMPLViewFileNotUsed.h"
GENERATED_SOURCE_FILE_PATH "SIMPLViewFileNotUsed.cpp"
NAMESPACE "SIMPLViewProj"
PROJECT_NAME "${PROJECT_NAME}"
EXPORT_MACRO "SIMPLViewProj_EXPORT")
endif()
get_filename_component(SIMPLView_PARENT ${SIMPLViewProj_SOURCE_DIR} DIRECTORY CACHE)
#------------------------------------------------------------------------------
# If the developer has set another SIMPL directory then use that, otherwise look
# for the SIMPLView directory at the same level as the SIMPL directory
if("${SIMPLProj_SOURCE_DIR}" STREQUAL "")
set(SIMPLProj_SOURCE_DIR ${SIMPLView_PARENT}/SIMPL)
message(STATUS "SIMPLProj_SOURCE_DIR: ${SIMPLProj_SOURCE_DIR}")
endif()
if(NOT EXISTS "${SIMPLProj_SOURCE_DIR}")
message(FATAL_ERROR "SIMPLProj_SOURCE_DIR does not exist at ${SIMPLProj_SOURCE_DIR}.")
endif()
set(LIB_TYPE STATIC)
if(BUILD_SHARED_LIBS)
set(LIB_TYPE SHARED)
endif(BUILD_SHARED_LIBS)
#------------------------------------------------------------------------------
# There are several different Release Types that we are going to use.
# Official: This is an official release from BlueQuartz Software
# Beta: This is a Beta release that has is getting ready to be officially released.
# Development: This is currently in development and probably has bugs.
get_property(SIMPLViewProj_RELEASE_TYPE GLOBAL PROPERTY PACKAGE_RELEASE_TYPE)
if("${SIMPLViewProj_RELEASE_TYPE}" STREQUAL "")
set(SIMPLViewProj_RELEASE_TYPE "Development")
set_property(GLOBAL PROPERTY PACKAGE_RELEASE_TYPE "${SIMPLViewProj_RELEASE_TYPE}")
endif()
include(CMakeParseArguments)
option(SIMPLView_BUILD_DOCUMENTATION "Build the SIMPLView documentation" ON)
set_property(GLOBAL PROPERTY SIMPLView_BUILD_DOCUMENTATION "${SIMPLView_BUILD_DOCUMENTATION}")
option(SIMPLView_USE_STYLESHEETEDITOR "Use the style sheet editor to apply custom styles" OFF)
set_property(GLOBAL PROPERTY SIMPLView_USE_STYLESHEETEDITOR "${SIMPLView_USE_STYLESHEETEDITOR}")
# -----------------------------------------------------------------------
# Setup a Global property that is used to gather Documentation Information
# into a single known location
get_property(DREAM3DDocRoot GLOBAL PROPERTY DREAM3DDocRoot)
if("${DREAM3DDocRoot}" STREQUAL "")
message(STATUS "Setting GLOBAL PROPERTY DREAM3DDocRoot")
set_property(GLOBAL PROPERTY DREAM3DDocRoot "${SIMPLViewProj_BINARY_DIR}")
get_property(DREAM3DDocRoot GLOBAL PROPERTY DREAM3DDocRoot)
endif()
get_property(SIMPLPluginList GLOBAL PROPERTY SIMPLPluginList)
if("${SIMPLPluginList}" STREQUAL "")
# message(STATUS "Setting GLOBAL PROPERTY SIMPLPluginList")
set_property(GLOBAL PROPERTY SIMPLPluginList "${SIMPLViewProj_BINARY_DIR}/SIMPLPluginList.txt")
get_property(SIMPLPluginList GLOBAL PROPERTY SIMPLPluginList)
file(WRITE "${SIMPLViewProj_BINARY_DIR}/SIMPLPluginList.txt" "")
endif()
get_property(SIMPLibSearchDirs GLOBAL PROPERTY SIMPLibSearchDirs)
if("${SIMPLibSearchDirs}" STREQUAL "")
# message(STATUS "Setting GLOBAL PROPERTY SIMPLibSearchDirs")
set_property(GLOBAL PROPERTY SIMPLibSearchDirs "${SIMPLViewProj_BINARY_DIR}/LibSearchDirs.txt")
get_property(SIMPLibSearchDirs GLOBAL PROPERTY SIMPLibSearchDirs)
file(WRITE "${SIMPLViewProj_BINARY_DIR}/LibSearchDirs.txt" "")
endif()
# -----------------------------------------------------------------------
# The project generally does NOT want to install headers. See if another
# project has over ridden that property
get_property(CMP_PROJECT_INSTALL_HEADERS GLOBAL PROPERTY CMP_PROJECT_INSTALL_HEADERS)
if("${CMP_PROJECT_INSTALL_HEADERS}" STREQUAL "")
set_property(GLOBAL PROPERTY CMP_PROJECT_INSTALL_HEADERS "0")
set(PROJECT_INSTALL_HEADERS "0")
else()
set(PROJECT_INSTALL_HEADERS "${CMP_PROJECT_INSTALL_HEADERS}")
endif()
get_property(CMP_PROJECT_INSTALL_HEADERS GLOBAL PROPERTY CMP_PROJECT_INSTALL_HEADERS)
# -----------------------------------------------------------------------
# This needs to be set here because it is used in the next section....
set(EXE_DEBUG_EXTENSION "_debug")
if( "${SIMPLView_APPLICATION_NAME}" STREQUAL "")
set(SIMPLView_APPLICATION_NAME "SIMPLView")
endif()
# -----------------------------------------------------------------------
# Set a Global Prefix where everthing is going to get intalled. For OS X we are
# going to try to install everything into the .app package
# -----------------------------------------------------------------------
set_property(GLOBAL PROPERTY DREAM3D_PACKAGE_DEST_PREFIX ".")
if(APPLE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_property(GLOBAL PROPERTY DREAM3D_PACKAGE_DEST_PREFIX "${SIMPLView_APPLICATION_NAME}${EXE_DEBUG_EXTENSION}.app/Contents/")
else()
set_property(GLOBAL PROPERTY DREAM3D_PACKAGE_DEST_PREFIX "${SIMPLView_APPLICATION_NAME}.app/Contents/")
endif()
endif()
get_property(DREAM3D_PACKAGE_DEST_PREFIX GLOBAL PROPERTY DREAM3D_PACKAGE_DEST_PREFIX)
# -----------------------------------------------------------------------
# Set this to ON because SIMPLView needs the Qt based widgets to be compiled.
set(SIMPL_Group_WIDGETS ON CACHE BOOL "Build the QtWidgets based library")
# -----------------------------------------------------------------------
# Bring in the SIMPL Project
# -----------------------------------------------------------------------
add_subdirectory( ${SIMPLProj_SOURCE_DIR} ${PROJECT_BINARY_DIR}/SIMPL)
# -----------------------------------------------------------------------
#Enable use of Solution Folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(PROJECT_CODE_DIR ${PROJECT_SOURCE_DIR}/Source)
set(PROJECT_RESOURCES_DIR ${SIMPLViewProj_SOURCE_DIR}/Resources)
set(PROJECT_INSTALL_HEADERS "${CMP_PROJECT_INSTALL_HEADERS}")
set(PROJECT_INSTALL_EXECUTABLES "1")
set(CMP_CONFIGURED_FILES_SOURCE_DIR ${CMP_SOURCE_DIR}/ConfiguredFiles)
set(CMP_ENABLE_PLUGINS "1")
set(CMP_PLUGIN_LIST_FILE "${SIMPLPluginList}")
set(CMP_PLUGIN_SEARCHDIR_FILE "${SIMPLibSearchDirs}")
file(APPEND ${CMP_PLUGIN_SEARCHDIR_FILE} "${SIMPLViewProj_BINARY_DIR}/Bin/plugins;")
file(APPEND ${CMP_PLUGIN_SEARCHDIR_FILE} "${SIMPLViewProj_BINARY_DIR}/Bin;")
set(CMP_LIB_SEARCH_DIRS "")
set(CMP_MODULES_SOURCE_DIR ${CMP_SOURCE_DIR}/Modules CACHE INTERNAL "")
if(UNIX AND NOT APPLE)
set(DREAM3D_LINUX_SYSTEM ${CMAKE_SYSTEM_NAME} CACHE STRING "The Name of the linux distrubution for packaging")
endif()
# --------------------------------------------------------------------
# Override CMake's built in module directory by prepending cmp's module
# directory first
set(CMAKE_MODULE_PATH ${CMP_MODULES_SOURCE_DIR} ${CMAKE_MODULE_PATH})
# --------------------------------------------------------------------
# Find HDF5 Headers/Libraries
# HDF5 now comes with everything that is needed for CMake to load
# up the targets (Exported) that it needs. We just need to find where
# HDF5 is installed.
include(${CMP_SOURCE_DIR}/ExtLib/HDF5Support.cmake)
# --------------------------------------------------------------------
# Should we use Intel Threading Building Blocks
# --------------------------------------------------------------------
set(SIMPL_USE_PARALLEL_ALGORITHMS "")
option(SIMPL_USE_MULTITHREADED_ALGOS "Use MultiThreaded Algorithms" OFF)
if(SIMPL_USE_MULTITHREADED_ALGOS)
include(${CMP_SOURCE_DIR}/ExtLib/TBBSupport.cmake)
set(SIMPL_USE_PARALLEL_ALGORITHMS "1")
endif()
# --------------------------------------------------------------------
# SIMPL needs the Eigen library for Least Squares fit and Eigen
# value/vector calculations.
set(SIMPL_USE_EIGEN "")
Find_Package(Eigen3 REQUIRED)
if(EIGEN3_FOUND)
message(STATUS "Eigen3 Location: ${EIGEN3_ROOT_DIR}")
message(STATUS "Eigen3 Version: ${EIGEN3_VERSION_STRING}")
set(SIMPL_USE_EIGEN "1" CACHE INTERNAL "")
else()
message(WARNING "The Eigen Library is required for some algorithms to execute. These algorithms will be disabled.")
endif()
# --------------------------------------------------------------------
# Find and Use the Qt5 Libraries
include(${CMP_SOURCE_DIR}/ExtLib/Qt5Support.cmake)
set(SIMPLView_Qt5_Components Core Widgets Network Gui Concurrent Svg Xml OpenGL PrintSupport )
CMP_AddQt5Support( "${SIMPLView_Qt5_Components}"
"${SIMPL_USE_QtWebEngine}"
"${SIMPLViewProj_BINARY_DIR}"
"SIMPLView")
# --------------------------------------------------------------------
# Now that we have found all of our required libraries and packages we
# we can start finding targets to compile
# We do NOT want to install any of the headers
set(SIMPLViewProj_INSTALL_FILES "${PROJECT_INSTALL_HEADERS}")
# --------------------------------------------------------------------
# Generate our ReadMe and License Files
configure_file(${PROJECT_RESOURCES_DIR}/SIMPLView/SIMPLViewLicense.txt
${SIMPLViewProj_BINARY_DIR}/SIMPLView/SIMPLViewLicense.txt )
# --------------------------------------------------------------------
# Generate install rules for the text files
if(APPLE)
install(FILES ${SIMPLViewProj_BINARY_DIR}/SIMPLView/SIMPLViewLicense.txt
DESTINATION "${DREAM3D_PACKAGE_DEST_PREFIX}/Resources"
COMPONENT Applications)
else()
install(FILES ${SIMPLViewProj_BINARY_DIR}/SIMPLView/SIMPLViewLicense.txt
DESTINATION "${DREAM3D_PACKAGE_DEST_PREFIX}"
COMPONENT Applications)
endif()
#------------------------------------------------------------------------------
# If we have not defined a "BrandedSIMPLView_DIR" then define it to the default
# generic set of ICONs
if(NOT DEFINED BrandedSIMPLView_DIR)
set(BrandedSIMPLView_DIR ${SIMPLViewProj_SOURCE_DIR}/Resources/OpenSourceEdition)
endif()
# -----------------------------------------------------------------------
# This needs to be set here as we are going to look for files in this directory
# -----------------------------------------------------------------------
if("${FilterWidgetsLib_BINARY_DIR}" STREQUAL "")
set(FilterWidgetsLib_BINARY_DIR ${SIMPLViewProj_BINARY_DIR}/FilterWidgetsLib)
endif()
# --------------------------------------------------------------------
#- Add in the Main SIMPLView Application
add_subdirectory( ${SIMPLViewProj_SOURCE_DIR}/Source/SIMPLView ${PROJECT_BINARY_DIR}/SIMPLView)
# --------------------------------------------------------------------
#- Add in the Main SIMPLView Application
option(SIMPLView_BUILD_DevHelper "Build the DevHelper Application" OFF)
if(SIMPLView_BUILD_DevHelper)
add_subdirectory( ${SIMPLViewProj_SOURCE_DIR}/Source/DevHelper ${PROJECT_BINARY_DIR}/DevHelper)
endif()
set(SIMPView_DOCS_ROOT_DIR "${SIMPLViewProj_BINARY_DIR}/Bin/Help/SIMPLView")
# add the Command line utilities
# Figure out here if we are going to build the command line tools
option(SIMPLView_BUILD_CLI_TOOLS "Build the command line versions of the applications" OFF)
if( SIMPLView_BUILD_CLI_TOOLS )
add_subdirectory(${SIMPLViewProj_SOURCE_DIR}/Tools ${SIMPLViewProj_BINARY_DIR}/Tools)
endif()
# This should be the last line in this file:
include(${PROJECT_RESOURCES_DIR}/CPack/PackageProject.cmake)
# ------- Enable the CTest testing. Use make test to run all tests ---------------
if(SIMPL_BUILD_TESTING)
include(${SIMPLViewProj_SOURCE_DIR}/Test/CMakeLists.txt)
endif()