-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
269 lines (213 loc) · 9.27 KB
/
Copy pathCMakeLists.txt
File metadata and controls
269 lines (213 loc) · 9.27 KB
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
if(${CMAKE_MAJOR_VERSION} STREQUAL "3")
# CMake 3.0 introduces VERSION variables for each Project.
cmake_policy(SET CMP0048 NEW)
# CMake 3.1 introduces if() policies on dereferencing variables in quotes
cmake_policy(SET CMP0054 NEW)
# The DOWNLOAD_EXTRACT_TIMESTAMP option was not given
cmake_policy(SET CMP0135 NEW)
endif()
cmake_minimum_required(VERSION 3.14.5)
project(EMsoftSuperBuild VERSION 1.0.0.0 LANGUAGES C CXX Fortran)
if(WIN32)
message(STATUS "**************************************************************************")
message(STATUS "* Platform: Windows")
message(STATUS "* ONLY NVidia GPUs are supported on Windows platforms. Please ensure that")
message(STATUS "* the NVidia GPU computing toolkit version 10.0 is installed on your")
message(STATUS "* computer before trying to compile EMsoft.")
message(STATUS "**************************************************************************")
endif()
# This allows us to just use the "include()" command and the name of the project
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/projects"
${CMAKE_MODULE_PATH})
set(BUILD_TYPE ${CMAKE_BUILD_TYPE})
if("${BUILD_TYPE}" STREQUAL "")
set(BUILD_TYPE "Release" CACHE string "" FORCE)
endif()
# Set up some standard defaults, these will be passed down into external the
# projects.
include(BuildType)
include(BuildLocation)
include(ExternalProject)
include(download_dir)
# Use multiple CPU cores to build
include(ProcessorCount)
ProcessorCount(CoreCount)
if(MSVC90)
message(FATAL_ERROR "Visual Studio Version 9 2009 is NOT supported.")
endif(MSVC90)
if(MSVC10)
message(FATAL_ERROR "Visual Studio Version 10 2010 is NOT supported.")
endif(MSVC10)
if(MSVC11)
message(FATAL_ERROR "Visual Studio Version 11 2012 is NOT supported.")
endif(MSVC11)
if(MSVC12)
message(FATAL_ERROR "Visual Studio Version 12 2013 is NOT supported.")
endif(MSVC12)
if( "${EMsoft_SDK}" STREQUAL "")
message(FATAL_ERROR "Please specify the EMsoft_SDK cmake variable which is the top level directory where all the EMsoft dependent libraries will be built")
endif()
set(EMsoft_SDK_FILE ${EMsoft_SDK}/EMsoft_SDK.cmake)
set(download_dir ${EMsoft_SDK})
message(STATUS "EMsoft_SDK Folder: ${EMsoft_SDK}")
message(STATUS "EMsoft_SDK_FILE: ${EMsoft_SDK_FILE}")
set(CLONE_EMSOFT_REPO 1)
if("${WORKSPACE_DIR}" STREQUAL "")
#get_filename_component(WORKSPACE_DIR ${EMsoftSuperBuild_SOURCE_DIR} DIRECTORY)
set(CLONE_EMSOFT_REPO 0)
endif()
message(STATUS "Workspace Folder: ${WORKSPACE_DIR}")
set(BUILD_SHARED_LIBS ON)
if(APPLE)
execute_process(COMMAND uname -v
OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
execute_process(COMMAND sw_vers -productVersion
OUTPUT_VARIABLE OSX_PRODUCT_VERSION)
string(STRIP "${OSX_PRODUCT_VERSION}" OSX_PRODUCT_VERSION)
# Use this to figure out where the MacOS SDK folder is at. This can change based on if Xcode is actually installed
# or if just the command line tools are installed.
execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE OSX_SDK)
string(STRIP "${OSX_SDK}" OSX_SDK)
if(DARWIN_VERSION EQUAL 19) # macOS 10.15 Catalina (Xcode 11.x or Xcode 12.x)
message(FATAL_ERROR "MacOS Big Sur (11.x) is the minimum version needed to compile ${DREAM3DNX_APPLICATION_NAME}")
endif()
if(DARWIN_VERSION EQUAL 20) # macOS 11.00 Big Sur (Xcode 12.x)
# message(STATUS "Found macOS 11.00 Big Sur as the host. Darwin Version:${DARWIN_VERSION}")
set(CMAKE_MACOS_NAME "Big Sur")
set(CMAKE_MACOS_VERSION "11.00")
set(OSX_DEPLOYMENT_TARGET "11.0")
endif()
IF (DARWIN_VERSION EQUAL 21) # macOS 12.00 Monterey (Xcode 12.x/Xcode 13.x)
set(CMAKE_MACOS_NAME "Monterey")
set(CMAKE_MACOS_VERSION "12.00")
set(OSX_DEPLOYMENT_TARGET "12.0")
ENDIF ()
IF (DARWIN_VERSION EQUAL 22) # macOS 13.00 Ventura (Xcode 13.x/Xcode 14.x)
set(CMAKE_MACOS_NAME "Ventura")
set(CMAKE_MACOS_VERSION "13.00")
set(OSX_DEPLOYMENT_TARGET "13.0")
ENDIF ()
IF (DARWIN_VERSION EQUAL 23) # macOS 14.00 Sonoma (Xcode 15.x/Xcode 16.x)
set(CMAKE_MACOS_NAME "Sonoma")
set(CMAKE_MACOS_VERSION "14.00")
set(OSX_DEPLOYMENT_TARGET "14.0")
ENDIF ()
IF (DARWIN_VERSION EQUAL 24) # macOS 15.00 Sequoia (Xcode 16.x)
set(CMAKE_MACOS_NAME "Sequoia")
set(CMAKE_MACOS_VERSION "15.00")
set(OSX_DEPLOYMENT_TARGET "15.0")
ENDIF ()
message(STATUS "* System: MacOS ${CMAKE_MACOS_NAME} (${OSX_PRODUCT_VERSION}) Running on ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "* CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
message(STATUS "* OSX_SDK: ${OSX_SDK}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/projects/apple/OSX_EMsoft_SDK.cmake
${EMsoft_SDK}/EMsoft_SDK.cmake @ONLY )
elseif(WIN32)
if(MSVC90)
message(FATAL_ERROR "Visual Studio Version 9 2009 is NOT supported.")
endif(MSVC90)
if(MSVC10)
message(FATAL_ERROR "Visual Studio Version 10 2010 is NOT supported.")
endif(MSVC10)
if(MSVC11)
message(FATAL_ERROR "Visual Studio Version 11 2012 is NOT supported.")
endif(MSVC11)
if(MSVC12)
message(FATAL_ERROR "Visual Studio Version 12 2013 is NOT supported.")
endif(MSVC12)
if( ${MSVC_VERSION} EQUAL "1900")
message(FATAL_ERROR "Visual Studio Version 14 2015 is NOT supported.")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/projects/win32/WIN_EMsoft_SDK.cmake
${EMsoft_SDK}/EMsoft_SDK.cmake COPYONLY )
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/projects/unix/Linux_EMsoft_SDK.cmake
${EMsoft_SDK}/EMsoft_SDK.cmake COPYONLY )
endif()
FILE(APPEND ${EMsoft_SDK_FILE} "\n#--------------------------------------------------------------------------------------------------\n")
FILE(APPEND ${EMsoft_SDK_FILE} "set(EMsoft_SDK_ROOT \"${EMsoft_SDK}\")\n")
FILE(APPEND ${EMsoft_SDK_FILE} "set(EMsoft_SDK_VERSION ${EMsoft_SDK_VERSION})\n")
FILE(APPEND ${EMsoft_SDK_FILE} "\n#--------------------------------------------------------------------------------------------------\n")
FILE(APPEND ${EMsoft_SDK_FILE} "# EMsoft does not use QtWebEngine to render the docs anymore. Let the system do it.\n")
FILE(APPEND ${EMsoft_SDK_FILE} "set(EMsoftWorkbench_USE_QtWebEngine OFF)\n")
FILE(APPEND ${EMsoft_SDK_FILE} "\n#--------------------------------------------------------------------------------------------------\n")
FILE(APPEND ${EMsoft_SDK_FILE} "# Always write out the compile_commands.json file to help out things like QtCreator and VS Code\n")
FILE(APPEND ${EMsoft_SDK_FILE} "set(CMAKE_EXPORT_COMPILE_COMMANDS ON)\n")
#------------------------------------------------------------------------------
# Get the name of the Fortran compiler for easier decisions
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
#------------------------------------------------------------------------------
# On Windows we are going to use Intel MKL with the FFTW interface so we do not
# need to install FFTW3
if(${Fortran_COMPILER_NAME} MATCHES "gfortran.*")
include(FFTW)
elseif (${Fortran_COMPILER_NAME} MATCHES "ifort.*")
set(OSX_DEPLOYMENT_TARGET "10.13")
include(MKL)
else()
message(STATUS "The Fortran compiler is NOT recognized. EMsoft may not support it.")
message(FATAL_ERROR "Current Fortran Compiler is ${CMAKE_Fortran_COMPILER}")
endif()
include(nlopt)
include(JsonFortran)
include(Bcls)
include(CLFortran)
include(HDF5)
# include(HDF5pl)
#--------------------------------------------------------------------------------------------------
# Are we installing Qt (OFF by default)
# If we are, then we need additional libraries
# This part of the code base is not in any way maintained any more.
#--------------------------------------------------------------------------------------------------
OPTION(INSTALL_QT5 "Download and Install Qt5" OFF)
if("${INSTALL_QT5}" STREQUAL "ON")
if(NOT MSVC)
include(ghcFilesystem)
endif()
include(oneTBB)
include(Eigen)
include(EbsdLib)
include(Qt5)
endif()
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
function(CloneRepo)
set(options )
set(oneValueArgs DEPENDS PROJECT_NAME GIT_REPOSITORY TMP_DIR STAMP_DIR DOWNLOAD_DIR SOURCE_DIR BINARY_DIR INSTALL_DIR)
set(multiValueArgs )
cmake_parse_arguments(Z "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(projectName ${Z_PROJECT_NAME})
message(STATUS "Cloning ${projectName}" )
set(SOURCE_DIR "${Z_WORKSPACE_DIR}")
set_property(DIRECTORY PROPERTY EP_BASE ${SOURCE_DIR}/${projectName})
ExternalProject_Add(${projectName}
DEPENDS ${Z_DEPENDS}
TMP_DIR ${Z_TMP_DIR}
STAMP_DIR ${Z_STAMP_DIR}
DOWNLOAD_DIR ${Z_DOWNLOAD_DIR}
SOURCE_DIR ${Z_SOURCE_DIR}
BINARY_DIR ${Z_BINARY_DIR}
INSTALL_DIR ${Z_INSTALL_DIR}
GIT_PROGRESS 1
GIT_REPOSITORY "${Z_GIT_REPOSITORY}"
GIT_TAG develop
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
LOG_DOWNLOAD 1
LOG_UPDATE 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_TEST 1
LOG_INSTALL 1
)
endfunction()
if(CLONE_EMSOFT_REPO)
endif()