CMakeLists.txt 5.73 KB
Newer Older
1
2
cmake_minimum_required(VERSION 2.8.8)

3
project(VeloViewSuperBuild)
4
5
set (SuperBuild_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
set (SuperBuild_PROJECTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Projects")
Gabriel Devillers's avatar
Gabriel Devillers committed
6
7
set (SuperBuild_BINARY_DIR ${VeloViewSuperBuild_BINARY_DIR}) # required to do FindPackage(ParaView) inside Veloview's CMakeLists

Gabriel Devillers's avatar
Gabriel Devillers committed
8
9
set(qt_version 5)

Gabriel Devillers's avatar
Gabriel Devillers committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
macro (superbuild_setup_variables)
  include(SuperbuildVersionMacros)
  # if (paraview_SOURCE_SELECTION STREQUAL "git")
  #   # Assuming master; just use the latest version, but let the user set their
  #   # own version in case it is actually a branch from some other version.
  #   set(PARAVIEW_VERSION_DEFAULT "5.5.0"
  #     CACHE STRING "The default version of ParaView to use if it cannot be detected")
  #   mark_as_advanced(PARAVIEW_VERSION_DEFAULT)
  #   set(paraview_default_version "${PARAVIEW_VERSION_DEFAULT}")
  # elseif (paraview_SOURCE_SELECTION STREQUAL "source")
  #   # If it is a git repo, we'll get it that way, otherwise we will look at the
  #   # `version.txt` in the checkout.
  #   set(paraview_default_version "")
  # else ()
  #   # The selection is the version number; use it.
  #   set(paraview_default_version "${paraview_SOURCE_SELECTION}")
  # endif()
  # superbuild_set_version_variables(paraview "${paraview_default_version}" "paraview-version.cmake" "version.txt")
  # set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
  set(paraview_version "5.4")
endmacro ()
31

32
33
34
35
36
37
38
39
40
41
#------------------------------------------------------------------------------
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
  set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
  # Set the possible values of build type for cmake-gui
  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
    "MinSizeRel" "RelWithDebInfo")
endif()

42
43
44
45
46
#-----------------------------------------------------------------------------
# Collect information about the build platform.
include(CheckTypeSize)
check_type_size(void* VOID_PTR_SIZE BUILTIN_TYPES_ONLY)
if (VOID_PTR_SIZE EQUAL 8)
47
  set(VV_BUILD_ARCHITECTURE "64")
48
else ()
49
  set(VV_BUILD_ARCHITECTURE "32")
50
51
52
53
endif()

# Set suffix to be used for generating archives. This ensures that the package
# files have decent names that we can directly upload to the website.
54
set (package_suffix "${CMAKE_SYSTEM_NAME}-${VV_BUILD_ARCHITECTURE}bit")
55
56
57
58
59
60
61
62

#-----------------------------------------------------------------------------
# Setup CMAKE_MODULE_PATH so that platform specific configurations are processed
# before the generic ones.
set (CMAKE_MODULE_PATH
  "${SuperBuild_PROJECTS_DIR}"
  "${SuperBuild_CMAKE_DIR}"
  "${CMAKE_CURRENT_SOURCE_DIR}"
63
  "${CMAKE_CURRENT_SOURCE_DIR}/../CMake"
64
65
  ${CMAKE_MODULE_PATH})

66
67
68
69
function (superbuild_find_projects var)
  # Some of these allow using system libraries.
  set(projects
    boost
70
    bzip2
71
72
73
    cxx11
    eigen
    liblas
74
    freetype
75
    opencv
76
77
78
79
80
    paraview
    pcap
    png
    python
    pythonqt
81
    qt5
82
83
    veloview
    zlib
84
85
86
87
88
    ceres
    glog
    pcl
    qhull
    flann
89
90
91
92
93
94
95
96
97
    )

  if (UNIX)
    list(APPEND projects
      libxml2
    )

    if (NOT APPLE)
      list(APPEND projects
98
        fontconfig
99
100
101
102
        gperf
      )
    endif()
  endif()
103

104
105
106
107
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
108
109
110
111
112
113
114
115
116
117
118
119
120


if (WIN32)
  if ( (NOT "${CMAKE_GENERATOR}" MATCHES "^NMake.*$") OR
       (NOT "${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*$"))
    # not use VS environment. We need to be pointed to nmake and devenv paths
    # since they are needed when building tools (qt, python, etc.)
    find_program(DEVENV_PATH devenv)
    find_program(NMAKE_PATH nmake)
    mark_as_advanced(DEVENV_PATH NMAKE_PATH)
  endif()
endif()

121
122
123
124
125
126
if(UNIX AND NOT DEFINED USE_SYSTEM_python)
   # it is still possible to pass -DUSE_SYSTEM_python=False to cmake
   message(STATUS "Defaulting USE_SYSTEM_python to True (was undefined and we are on UNIX)")
   set(USE_SYSTEM_python True CACHE BOOL INTERNAL)
endif()

Gabriel Devillers's avatar
Gabriel Devillers committed
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
function (superbuild_add_packaging)
  if (WIN32)
    set(generators
      ZIP
      NSIS)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ
      TXZ)
  endif ()
  list(GET generators 0 default_generator)

  if (USE_SYSTEM_qt5)
    list(APPEND superbuild_export_variables
      Qt5_DIR)
  endif ()

  # pass some variables that are required for packaging step:
  list(APPEND superbuild_export_variables
    PARAVIEW_VERSION
    package_suffix
    )

  set(default_package veloview)
  foreach (generator IN LISTS generators)
      superbuild_add_extra_package_test(veloview "${generator}"
      LABELS  "VeloView" # does not have to be ${SOFTWARE_NAME} I think
      TIMEOUT 6400)
  endforeach ()

  if (default_package)
    superbuild_enable_install_target("${default_package}/${default_generator}")
  endif ()
endfunction ()

function (superbuild_add_tests)
  # TODO: add existing tests
  # add_subdirectory("${CMAKE_SOURCE_DIR}/tests" "${CMAKE_BINARY_DIR}/tests")
endfunction ()

170
171
172
# skiped module as defined in paraview superbuild.
# One difference: pythonQt needs Multimedia so we don't skip it.
set(qt5_skip_modules
173
  qtspeech
174
175
176
177
178
179
180
181
182
183
184
185
  qtconnectivity
  qtgamepad
  qtlocation
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)
list(APPEND qt5_process_environment
  BUILD_IN_SOURCE 1)

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
set(boost_libraries
  chrono
  date_time
  filesystem
  iostreams
  program_options
  system
  regex
  thread)
set(boost_extra_options
  "-sNO_BZIP2=1")

list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
list(APPEND superbuild_project_roots
  "${SuperBuild_PROJECTS_DIR}")

set(_superbuild_default_cxx11 ON)

add_subdirectory(common-superbuild)