forked from Kitware/Visomics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuperBuild.cmake
142 lines (122 loc) · 4.99 KB
/
SuperBuild.cmake
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
###########################################################################
#
# 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.
#
###########################################################################
#-----------------------------------------------------------------------------
# GNU R
#-----------------------------------------------------------------------------
# Note :GNU R is should be provided at configuration time. For example:
# cmake <OTHER_OPTIONS> -DR_COMMAND:FILEPATH=/path/to/R-2.11.1/bin/R ../Visomics
find_package(R REQUIRED)
include(CMakeExternals/RExternalPackages.cmake)
#-----------------------------------------------------------------------------
# Git protocole option
#-----------------------------------------------------------------------------
option(Visomics_USE_GIT_PROTOCOL "If behind a firewall turn this off to use http instead." ON)
set(git_protocol "git")
if(NOT Visomics_USE_GIT_PROTOCOL)
set(git_protocol "http")
endif()
#-----------------------------------------------------------------------------
# Enable and setup External project global properties
#-----------------------------------------------------------------------------
INCLUDE(ExternalProject)
INCLUDE(ctkMacroEmptyExternalProject)
set(ep_base "${CMAKE_BINARY_DIR}")
#set(ep_install_dir "${ep_base}/Install")
set(ep_suffix "-cmake")
SET(ep_common_c_flags "${CMAKE_C_FLAGS_INIT} ${ADDITIONAL_C_FLAGS}")
SET(ep_common_cxx_flags "${CMAKE_CXX_FLAGS_INIT} ${ADDITIONAL_CXX_FLAGS}")
# Compute -G arg for configuring external projects with the same CMake generator:
if(CMAKE_EXTRA_GENERATOR)
set(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
set(gen "${CMAKE_GENERATOR}")
endif()
#------------------------------------------------------------------------------
# Include ExternalProject Target
#------------------------------------------------------------------------------
include(CMakeExternals/VTK.cmake)
include(CMakeExternals/QtPropertyBrowser.cmake)
include(CMakeExternals/VisomicsData.cmake)
#include(CMakeExternals/CTK.cmake)
#-----------------------------------------------------------------------------
# Set superbuild boolean args
#-----------------------------------------------------------------------------
SET(project_cmake_boolean_args
#BUILD_DOCUMENTATION # Not used
BUILD_TESTING
BUILD_SHARED_LIBS
WITH_COVERAGE
#WITH_MEMCHECK # Not used
)
SET(project_superbuild_boolean_args)
FOREACH(project_cmake_arg ${project_cmake_boolean_args})
LIST(APPEND project_superbuild_boolean_args -D${project_cmake_arg}:BOOL=${${project_cmake_arg}})
ENDFOREACH()
# MESSAGE("CMake args:")
# FOREACH(arg ${project_superbuild_boolean_args})
# MESSAGE(" ${arg}")
# ENDFOREACH()
#-----------------------------------------------------------------------------
# Define list of additional options used to configure Visomics
#------------------------------------------------------------------------------
set(project_superbuild_extra_args)
if(DEFINED CTEST_CONFIGURATION_TYPE)
list(APPEND project_superbuild_extra_args -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE})
endif()
#-----------------------------------------------------------------------------
# Configure and build the project
#------------------------------------------------------------------------------
set(proj Visomics)
ExternalProject_Add(${proj}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
BINARY_DIR Visomics-build
CMAKE_GENERATOR ${gen}
PREFIX ${proj}${ep_suffix}
CMAKE_ARGS
${project_superbuild_extra_args}
${project_superbuild_boolean_args}
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
#-DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE} # Not used
-DVisomics_SUPERBUILD:BOOL=OFF
-DVisomics_C_FLAGS:STRING=${Visomics_C_FLAGS}
-DVisomics_CXX_FLAGS:STRING=${Visomics_CXX_FLAGS}
# QtPropertyBrowser
-DQtPropertyBrowser_DIR:PATH=${QtPropertyBrowser_DIR}
# VisomicsData
-DVisomicsData_DIR:PATH=${VisomicsData_DIR}
# VTK
-DVTK_DIR:PATH=${VTK_DIR}
#-DVTK_DEBUG_LEAKS:BOOL=${Slicer_USE_VTK_DEBUG_LEAKS}
# Qt
-DQT_QMAKE_EXECUTABLE:PATH=${QT_QMAKE_EXECUTABLE}
# CTK
#-DCTK_DIR:PATH=${CTK_DIR}
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
# Mandatory dependencies
${QtPropertyBrowser_DEPENDS}
${VisomicsData_DEPENDS}
#${CTK_DEPENDS}
${VTK_DEPENDS}
)