forked from SimVascular/SimVascular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
201 lines (185 loc) · 8.71 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
# Copyright (c) Stanford University, The Regents of the University of
# California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-----------------------------------------------------------------------------
# This toplevel CMakeLists.txt should be used as the first attempt to build
# SimVascular.
# This CMakeLists.txt uses ExternalProject_Add to do two main things:
# 1. ExternalProject_Add(Externals ---> Gets all of SimVascular's externals
# 2. ExternalProject_Add(SimVascular ---> Builds SimVascular
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.7.0)
if (POLICY CMP0040)
cmake_policy(SET CMP0040 OLD)
endif()
if (POLICY CMP0046)
cmake_policy(SET CMP0046 OLD)
endif()
if (POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif()
if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()
if (POLICY CMP0025) # Compiler ID when using clang set to clang not appleclang
cmake_policy(SET CMP0025 OLD)
endif()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Project(SV_TOP)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# CMake module path inside of true simvascular source
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Code/CMake"
"${CMAKE_MODULE_PATH}")
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# CMake Includes
include(CheckLibraryExists)
include(GetPrerequisites)
include(GenerateExportHeader)
include(ExternalProject)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# SimVascular Includes
include(SimVascularMacros)
include(SimVascularSystemSetup)
include(SimVascularFunctionCheckCompilerFlags)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# RPATH handling
# No objects built directly with project. Not needed!
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Externals!
set(SV_EXTERNALS_VERSION_NUMBER "2018.01" CACHE STRING "SimVascular Externals Release Version")
mark_as_advanced(SV_EXTERNALS_VERSION_NUMBER)
if(APPLE)
option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" OFF)
set(SV_EXTERNALS_PREBUILT_QT_PATH "" CACHE PATH "Qt5 Cmake Config File Path" FORCE)
elseif(LINUX)
option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" OFF)
if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01")
set(SV_EXTERNALS_PREBUILT_QT_PATH "/opt/Qt5.4.2/5.4/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5 Cmake Config File Path" FORCE)
elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2018.05")
set(SV_EXTERNALS_PREBUILT_QT_PATH "/opt/Qt5.6.3/5.6.3/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5 Cmake Config File Path" FORCE)
else()
set(SV_EXTERNALS_PREBUILT_QT_PATH "" FORCE)
endif()
elseif(WIN32)
option(SV_EXTERNALS_USE_PREBUILT_QT "Use Externally Installed Qt5" ON)
if(SV_EXTERNALS_VERSION_NUMBER VERSION_EQUAL "2018.01")
set(SV_EXTERNALS_PREBUILT_QT_PATH "C:/OpenSource/Qt/Qt5.4.2/5.4/msvc2013_64_opengl/lib/cmake/Qt5" CACHE PATH "Qt5 Cmake Config File Path")
elseif(SV_EXTERNALS_VERSION_NUMBER VERSION_GREATER_EQUAL "2018.05")
set(SV_EXTERNALS_PREBUILT_QT_PATH "C:/OpenSource/Qt/Qt5.6.3/5.6.3/msvc2015_64/lib/cmake/Qt5" CACHE PATH "Qt5 Cmake Config File Path")
else()
set(SV_EXTERNALS_PREBUILT_QT_PATH "" FORCE)
endif()
endif()
mark_as_advanced(SV_EXTERNALS_USE_PREBUILT_QT)
mark_as_advanced(SV_EXTERNALS_PREBUILT_QT_PATH)
set(SV_EXTERNALS_TOPLEVEL_BIN_DIR "${CMAKE_BINARY_DIR}/Externals-build/svExternals/bin")
set(SV_EXTERNALS_ADDITIONAL_CMAKE_ARGS "" CACHE STRING "If more options want to be provided to the sv_externals build, they can be with this string")
ExternalProject_Add(Externals
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Externals
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Externals-build
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_MACOSX_RPATH:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DSV_EXTERNALS_VERSION_NUMBER:STRING=${SV_EXTERNALS_VERSION_NUMBER}
-DSV_EXTERNALS_USE_PREBUILT_QT:BOOL=${SV_EXTERNALS_USE_PREBUILT_QT}
-DSV_EXTERNALS_PREBUILT_QT_PATH:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH}
-DQt5_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH}
-DSV_EXTERNALS_TOPLEVEL_BIN_DIR:PATH=${SV_EXTERNALS_TOPLEVEL_BIN_DIR}
${SV_EXTERNALS_ADDITIONAL_CMAKE_ARGS}
)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# SimVascular!
if(WIN32)
set(freetype_shared_option "-DSV_USE_FREETYPE_SHARED:BOOL=OFF")
else()
set(freetype_shared_option "-DSV_USE_FREETYPE_SHARED:BOOL=ON")
endif()
set(SV_ADDITIONAL_CMAKE_ARGS "" CACHE STRING "If more options want to be provided to the sv_externals build, they can be with this string")
ExternalProject_Add(SimVascular
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Code
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/SimVascular-build
DEPENDS Externals
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_MACOSX_RPATH:BOOL=ON
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DSV_EXTERNALS_VERSION_NUMBER:STRING=${SV_EXTERNALS_VERSION_NUMBER}
-DSV_USE_FREETYPE:BOOL=ON
${freetype_shared_option}
-DSV_USE_GDCM:BOOL=ON
-DSV_USE_ITK:BOOL=ON
-DSV_USE_MITK:BOOL=ON
-DSV_USE_MITK_CONFIG:BOOL=OFF
-DSV_USE_MMG:BOOL=ON
-DSV_USE_MPICH2:BOOL=OFF
-DSV_USE_OpenCASCADE:BOOL=ON
-DSV_USE_PYTHON:BOOL=ON
-DSV_USE_Qt5:BOOL=ON
-DSV_USE_QT:BOOL=ON
-DSV_USE_QT_GUI:BOOL=ON
-DSV_USE_SOLVERIO:BOOL=ON
-DSV_USE_TETGEN_ADAPTOR:BOOL=ON
-DSV_EXTERNALS_USE_TOPLEVEL_BIN_DIR:BOOL=ON
-DSV_EXTERNALS_TOPLEVEL_BIN_DIR:PATH=${SV_EXTERNALS_TOPLEVEL_BIN_DIR}
-DQT_DLL_PATH:PATH=${qt5_installed_prefix}/bin
-DQT_PLUGIN_PATH:PATH=${qt5_installed_prefix}/plugins
-DSV_EXTERNALS_USE_PREBUILT_QT:BOOL=${SV_EXTERNALS_USE_PREBUILT_QT}
-DSV_EXTERNALS_PREBUILT_QT_PATH:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH}
-DSV_EXTERNALS_VERSION_NUMBER:STRING=${SV_EXTERNALS_VERSION_NUMBER}
-DQt5_DIR:PATH=${SV_EXTERNALS_PREBUILT_QT_PATH}
${SV_ADDITIONAL_CMAKE_ARGS}
)
#-----------------------------------------------------------------------------