forked from Kitware/Visomics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·245 lines (209 loc) · 8.6 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
###########################################################################
#
# Program: Visomics
#
# Copyright (c) Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###########################################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
#-----------------------------------------------------------------------------
PROJECT(Visomics)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Superbuild Option - Enabled by default
#
OPTION(Visomics_SUPERBUILD "Build Visomics and the projects it depends on via SuperBuild.cmake." ON)
MARK_AS_ADVANCED(Visomics_SUPERBUILD)
#-----------------------------------------------------------------------------
# Build options
#
SET(Visomics_KEGG_SERVER_HOSTNAME "visomics.kitware.com" CACHE STRING "KEGG Server hostname")
SET(Visomics_KEGG_SERVER_PORT "8090" CACHE STRING "KEGG Server port")
#-----------------------------------------------------------------------------
# Visomics version number. An even minor number corresponds to releases.
#
SET(Visomics_MAJOR_VERSION 0)
SET(Visomics_MINOR_VERSION 5)
SET(Visomics_BUILD_VERSION 2)
SET(Visomics_VERSION
"${Visomics_MAJOR_VERSION}.${Visomics_MINOR_VERSION}.${Visomics_BUILD_VERSION}")
#-----------------------------------------------------------------------------
# Install directories, used for install rules.
#
SET(Visomics_INSTALL_BIN_DIR "bin")
SET(Visomics_INSTALL_LIB_DIR "lib")
SET(Visomics_INSTALL_INCLUDE_DIR "include/visomics-${Visomics_MAJOR_VERSION}.${Visomics_MINOR_VERSION}")
SET(Visomics_INSTALL_DATA_DIR "data")
SET(Visomics_INSTALL_RSCRIPTS_DIR "share/R")
SET(Visomics_INSTALL_SHARE_DIR "share")
SET(Visomics_INSTALL_DOC_DIR "doc")
#-----------------------------------------------------------------------------
# Update CMake module path
# Note: FindXXX.cmake script specific to utility should be copied into Utilities/CMake
#
SET(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/CMake"
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
${CMAKE_MODULE_PATH})
#-----------------------------------------------------------------------------
# CMake Function(s) and Macro(s)
#
INCLUDE(CMake/ctkFunctionCheckCompilerFlags.cmake)
INCLUDE(CMake/ctkFunctionGetGccVersion.cmake)
#-----------------------------------------------------------------------------
# Output directories.
#
SET(output_dir ${Visomics_BINARY_DIR}/bin)
FOREACH(type LIBRARY RUNTIME ARCHIVE)
SET(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.")
ENDFOREACH()
#-----------------------------------------------------------------------------
# Qt
#
FIND_PACKAGE(Qt4 4.7 COMPONENTS QtCore QtGui QtNetwork QtScript QtWebKit REQUIRED)
INCLUDE(${QT_USE_FILE})
#-----------------------------------------------------------------------------
# Testing
#
OPTION(BUILD_TESTING "Test the project" ON)
IF(BUILD_TESTING)
ENABLE_TESTING()
INCLUDE(CTest)
MARK_AS_ADVANCED(TCL_TCLSH DART_ROOT)
set(Visomics_LAUNCHER_EXECUTABLE ${Visomics_BINARY_DIR}/bin/visomics)
set(Visomics_LAUNCH_COMMAND ${Visomics_LAUNCHER_EXECUTABLE} --command)
# Setup file for setting custom ctest vars
CONFIGURE_FILE(
CMake/CTestCustom.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
ENDIF()
#-----------------------------------------------------------------------------
# Coverage
#
OPTION(WITH_COVERAGE "Enable/Disable coverage" OFF)
#-----------------------------------------------------------------------------
# Documentation
#
#-----------------------------------------------------------------------------
# Check compiler version
#
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(REQUIRED_GNUCXX_VERSION "4.2.0")
ctkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION)
IF(${GCC_VERSION} VERSION_LESS ${REQUIRED_GNUCXX_VERSION})
MESSAGE(FATAL_ERROR "Gcc >= ${REQUIRED_GNUCXX_VERSION} is required ! Your current version is ${GCC_VERSION}.")
ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
# Additional CXX/C Flags
#
SET(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags")
MARK_AS_ADVANCED(ADDITIONAL_C_FLAGS)
SET(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags")
MARK_AS_ADVANCED(ADDITIONAL_CXX_FLAGS)
#-----------------------------------------------------------------------------
# Set coverage Flags
#
IF(WITH_COVERAGE)
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG")
SET(COVERAGE_CXX_FLAGS ${coverage_flags})
SET(COVERAGE_C_FLAGS ${coverage_flags})
ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
# Visomics C/CXX Flags
#
SET(Visomics_C_FLAGS "${CMAKE_C_FLAGS_INIT} ${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
SET(Visomics_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} ${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2")
ctkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
ctkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)
SET(Visomics_C_FLAGS "${cflags} ${Visomics_C_FLAGS}")
SET(Visomics_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${Visomics_CXX_FLAGS}")
ENDIF()
#-----------------------------------------------------------------------------
# Superbuild script
#
IF(Visomics_SUPERBUILD)
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
RETURN()
ENDIF()
#-----------------------------------------------------------------------------
# VTK
#
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
GET_FILENAME_COMPONENT(VTK_QT_QMAKE_EXECUTABLE_REALPATH ${VTK_QT_QMAKE_EXECUTABLE} REALPATH)
GET_FILENAME_COMPONENT(QT_QMAKE_EXECUTABLE_REALPATH ${QT_QMAKE_EXECUTABLE} REALPATH)
IF(NOT ${VTK_QT_QMAKE_EXECUTABLE_REALPATH} STREQUAL ${QT_QMAKE_EXECUTABLE_REALPATH})
MESSAGE(FATAL_ERROR "Qt version mismatch problem:
(1) QT_QMAKE_EXECUTABLE:${QT_QMAKE_EXECUTABLE_REALPATH}
(2) VTK_QT_QMAKE_EXECUTABLE:${VTK_QT_QMAKE_EXECUTABLE_REALPATH}
Try to rebuild VTK using (1)
")
ENDIF()
#-----------------------------------------------------------------------------
# QtPropertyBrowser
FIND_PACKAGE(QtPropertyBrowser REQUIRED)
INCLUDE(${QtPropertyBrowser_USE_FILE})
#-----------------------------------------------------------------------------
# Set C/CXX Flags
#
SET(CMAKE_CXX_FLAGS ${Visomics_CXX_FLAGS} CACHE STRING "CMake C Flags" FORCE)
SET(CMAKE_C_FLAGS ${Visomics_C_FLAGS} CACHE STRING "CMake CXX Flags" FORCE)
#-----------------------------------------------------------------------------
# Configure headers
#
SET(Visomics_BUILD_TESTING ${BUILD_TESTING}) # Used in voConfigure.h.in
FOREACH(header voConfigure.h voTestConfigure.h)
CONFIGURE_FILE(
${header}.in
${CMAKE_CURRENT_BINARY_DIR}/${header}
)
ENDFOREACH()
#-----------------------------------------------------------------------------
# Include directories
#
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY(ThirdParty/CTK)
INCLUDE_DIRECTORIES(ThirdParty/CTK)
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY(Base)
ADD_SUBDIRECTORY(Application)
#-----------------------------------------------------------------------------
# R scripts
#
set(r_scripts
Utilities/GetRExternalPackages.R
)
INSTALL(FILES ${r_scripts} DESTINATION ${Visomics_INSTALL_RSCRIPTS_DIR} COMPONENT Runtime)
#-----------------------------------------------------------------------------
# Install sample dataset(s)
#
IF(BUILD_TESTING)
SET(datasets
${VisomicsData_DIR}/Data/UNC/All_conc_kitware_transposed.csv
#${VisomicsData_DIR}/Data/UniversityOfWashington/PE_Microarray_dataset.csv
)
INSTALL(FILES ${datasets} DESTINATION ${Visomics_INSTALL_DATA_DIR} COMPONENT Runtime)
ENDIF()
#-----------------------------------------------------------------------------
# Setup CPack
INCLUDE(CMake/VisomicsCPack.cmake)