CMakeLists.txt 114 KB
Newer Older
1 2
#*****************************************************************************
#
3
# Copyright (c) 2000 - 2015, Lawrence Livermore National Security, LLC
4
# Produced at the Lawrence Livermore National Laboratory
5
# LLNL-CODE-442911
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
# All rights reserved.
#
# This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
# full copyright notice is contained in the file COPYRIGHT located at the root
# of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
#
# Redistribution  and  use  in  source  and  binary  forms,  with  or  without
# modification, are permitted provided that the following conditions are met:
#
#  - Redistributions of  source code must  retain the above  copyright notice,
#    this list of conditions and the disclaimer below.
#  - Redistributions in binary form must reproduce the above copyright notice,
#    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
#    documentation and/or other materials provided with the distribution.
#  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
#    be used to endorse or promote products derived from this software without
#    specific prior written permission.
#
# 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 LAWRENCE  LIVERMORE NATIONAL  SECURITY,
# LLC, THE  U.S.  DEPARTMENT OF  ENERGY  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.
#
# Modifications:
#
39 40
#   Mark C. Miller, Wed Jan 13 18:30:38 PST 2010
#   Added logic to ensure FORCE_ITAPS_REGEN is never cached in an ON state.
41 42 43 44 45
#
#   Mark C. Miller, Thu Jan 14 10:36:49 PST 2010
#   Undid above change as it turns out the value gets cached regardless of
#   an SET() command here. This was not observed in earlier tests because
#   I was ctrl-C'ing after the cmake process had past the point I was testing.
46 47 48 49 50
#
#   Mark C. Miller, Thu Jan 14 12:01:48 PST 2010
#   Added -D_LARGEFILE64_SOURCE to definitions for UNIX systems. This could
#   be a bit too global of a context in which to set it. We'll see. I also
#   added logic to set CMAKE_REQUIRED_DEFINITIONS prior to checking size
cyrush's avatar
cyrush committed
51
#   of off64_t. In theory, we might need to set CMAKE_REQUIRED_INCLUDES
52
#   too but that was not required on the systems I tested.
53 54 55 56 57
#
#   David M. Camp, Th Jan 14 11:50:00 PST 2010
#   Added new function ADD_TARGET_DEFINITIONS to add defines to targets.
#   This was needed for the plots to define ENGINE only for the engine build.
#
58 59 60 61 62 63 64 65
#    Gunther H. Weber, Thu Jan 28 14:33:36 PST 2010
#    Added hack/workaround that ensures that the static MPI libraries get added
#    to the end of the link line. In essence, we add a dummy/empty library
#    that has the MPI libraries as dependencies. This libary is added to the
#    end of the link line of parallel executables. Doing so ensures that cmake
#    will add the depencies of this dummy library, i.e., the MPI libraries, to
#    the end of the link line.
#
66 67 68 69 70 71
#    Gunther H. Weber, Fri Jan 29 10:42:11 PST 2010
#    Added a new option that supports setting the rpath relative to the
#    executable location. The purpose of this is to make VisIt not depend on
#    a properly set LD_LIBRARY_PATH as some MPI variants do not pass
#    environment variables.
#
72
#    Kathleen Bonnell, Wed Feb  3 11:28:41 PST 2010
cyrush's avatar
cyrush committed
73
#    Encapsulated VISIT_INSTALL_x_PLUGINS into one Macro that accepts a
74 75
#    type parameter.  Changed VISIT_THIRDPARTY_OPTION into two macros that
#    set a PATH var (for VISIT_x_DIR) or STRING var (for VISIT_x_LIBDEP).
76 77
#
#    Kathleen Bonnell, Tue Feb 16 14:04:16 MST 2010
cyrush's avatar
cyrush committed
78
#    Removed conditional setting of VISIT_RENDERING_SIZE_LIMIT, in case
79
#    initial configure pass was missing something. Install our zlib on windows.
80
#
81 82 83
#    Cyrus Harrison, Sun Feb 21 19:12:33 PST 2010
#    Added support for enable/disable of Python Engine Filters.
#
84 85 86 87
#    Eric Brugger, Mon Mar  8 13:02:08 PST 2010
#    Modified the logic that sets the VISIT_SVN_REVISION to get it from
#    the file SVN_REVISION before trying svn to get it.
#
88 89 90
#    Cyrus Harrison, Tue Mar  9 08:02:50 PST 2010
#    Enabled python filters support by default.
#
cyrush's avatar
cyrush committed
91
#    Kathleen Bonnell, Wed Mar 17 10:06:44 MST 2010
92 93
#    Change cmake minimum required to 2.8.0, to support FILE(COPY .
#
cyrush's avatar
cyrush committed
94
#    Kathleen Bonnell, Thu April 1 19:29:24 MST 2010
95 96 97
#    Find MakeNSIS on windows. Add PACKAGE target for windows, that uses
#    our NSIS scripts to create the self-installer.
#
98 99 100
#    Kathleen Bonnell, Wed April 14 16:33:27 MST 2010
#    Renable FindTortoiseSVN on windows to retrieve SVN revision number.
#
101 102 103
#    Jeremy Meredith, Mon Apr 19 16:34:02 EDT 2010
#    Support multiple paths returned for include files from mpi compiler.
#
104 105 106 107
#    Cyrus Harrison, Tue Apr 27 13:39:38 PDT 2010
#    Added ability to bake rpaths for MPI libs into exes & libs when
#    'make install' & 'make package' are used.
#
108 109 110 111
#    Cyrus Harrison, Thu Apr 29 09:32:01 PDT 2010
#    Small change to rpath detection to avoid cmake error w/
#    LIST(REMOVE_DUPLCIATES) if no rpaths are found.
#
112 113 114
#    Tom Fogal, Fri Apr 30 09:35:51 MDT 2010
#    Define HAVE_LIBSLIVR as appropriate.
#
115 116 117 118 119 120
#    Eric Brugger, Thu May  6 12:23:34 PDT 2010
#    I corrected the rpath detection logic to handle the case were there
#    were multiple rpaths.  In particular, INSTALL_RPATH was being set as a
#    list of rpaths (the rpaths end up semi-colon separated) and I changed
#    it to a string of space separated rpaths.
#
cyrush's avatar
cyrush committed
121 122
#    Kathleen Bonnell, Tue May 11 13:01:44 MST 2010
#    Set HAVE_SELECT to TRUE on windows.
123
#
124 125
#    Kathleen Bonnell, Fri Jun 4 7:58:34 PDT 2010
#    Changed logic for finding SVN_REVISION so check is not performed on
cyrush's avatar
cyrush committed
126
#    any platform if not building from a working copy.
127
#
128 129 130 131
#    Eric Brugger, Wed Jun  9 13:06:18 PDT 2010
#    I made a correction to a MESSAGE statement in the code that adds the
#    current link to the installation directory and added a comment that
#    explains why the flawed code we have there is actually what we want.
132
#
133 134 135 136
#    Eric Brugger, Thu Jun 17 13:38:03 PDT 2010
#    I modified the file to add -DMPICH_IGNORE_CXX_SEEK wherever -DPARALLEL
#    is specified to eliminate a compile failure with some versions of mpi.
#
137 138 139
#    Mark C. Miller, Thu Jul 29 17:36:48 PDT 2010
#    Added logic to include compiler version information as a comment int
#    The PluginVsInstall.cmake file.
140 141 142 143
#
#    Mark C. Miller, Thu Jul 29 23:43:52 PDT 2010
#    Added option to ignore problems finding third party libs. It is OFF
#    by default.
144
#
cyrush's avatar
cyrush committed
145
#    Kathleen Bonnell, Thu Aug 5 9:34:52 PDT 2010
146 147 148
#    For winodws, only override cmake's default CMAKE_INSTALL_PREFIX if it
#    wasn't specified on the command line.
#
149 150 151
#    Tom Fogal, Thu Aug  5 18:28:17 MDT 2010
#    Add missing include/visit directory to default include path.
#
cyrush's avatar
cyrush committed
152
#    Kathleen Bonnell, Fri Aug 13 9:59:37 MST 2010
153 154 155
#    Allow host-specific config-site files for Windows build.  If there is no
#    host-specific file, then windows.cmake is still used.
#
cyrush's avatar
cyrush committed
156
#    Kathleen Bonnell, Fri Aug 13 10:50:15 MST 2010
157 158 159 160
#    Allow config-site file to be specified on command-line.  Overrides
#    host-specific (all platforms) or windows.cmake (on windows).
#    usage:  -D VISIT_CONFIG_SITE="/path/to/config-site/file"
#
161 162 163 164 165
#    Cyrus Harrison, Mon Aug 16 13:12:17 PDT 2010
#    1) Disable python filters if VISIT_NOLINK_MPI_WITH_LIBRARIES is true b/c
#       the mpicom module (a shared lib) must link to mpi.
#    2) (Non-windows) add extra info about success of config-site include.
#
cyrush's avatar
cyrush committed
166
#    Kathleen Bonnell, Thu Aug 19 18:05:27 MST 2010
167 168
#    Fix broken plugin install target on windows.
#
cyrush's avatar
cyrush committed
169
#    Kathleen Bonnell, Thu Sep 2 15:44:22 PDT 2010
170 171
#    Add flag to windows nsis-installer script for 64 bit.
#
miller86's avatar
miller86 committed
172 173
#    Mark C. Miller, Tue Sep 21 13:47:27 PDT 2010
#    Fix DBIO_ONLY mode.
174 175 176 177
#
#    Tom Fogal, Wed Sep 22 13:45:36 MDT 2010
#    Fix HAVE_LIBGLEW definition.
#
178 179
#    Mark C. Miller, Fri Oct 22 12:28:25 PDT 2010
#    Added missing LIBDEP support for ExodusII dependence on (its own) netcdf.
180 181 182 183 184
#
#    Brad Whitlock, Fri Oct 29 16:56:34 PDT 2010
#    I added some more filtering when generating VisItLibraryDependencies.cmake
#    so it does not include local path names for Qt and Python.
#
cyrush's avatar
cyrush committed
185
#    Kathleen Bonnell, Thu Dec 2 15:49:04 MST 2010
186
#    Changed how ZLIB is handled on Windows.  Add compiler version messages
cyrush's avatar
cyrush committed
187
#    for MSVC to PluginVsInstall.cmake.  Make windows-specific string
188 189 190 191
#    replacements in VisItLibraryDependencies.cmake.  Allow '*.hpp' when
#    adding headers.  Add VisItGenerator.cmake file for plugin development
#    against an Installed VisIt on Windows.
#
cyrush's avatar
cyrush committed
192
#    Kathleen Bonnell, Fri Dec 10 14:37:15 PST 2010
193
#    Add VISIT_3RDPARTY_VAR(VISIT_ZLIB_DIR for windows.
194 195 196 197
#
#    Cyrus Harrison, Mon Dec 20 10:50:29 PST 2010
#    Use FORCE when setting various install paths.
#
cyrush's avatar
cyrush committed
198
#    Kathleen Bonnell, Tue Dec 28 17:06:41 MST 2010
199 200 201 202
#    Add VISIT_3RDPARTY_VAR for VISIT_SZIP_DIR and VISIT_JPEG_DIR for Windows,
#    and VISIT_H5PART_LIBDEP for all platforms. Call find for szip, zlib and
#    jpeg before Finds for any libs that may have dependencies on them.
#
203 204 205 206 207 208
#    Kathleen Bonnell, Wed Jan 5 10:36:29 PST 2010
#    Turn on use of FOLDER property.
#    Move Plugin macros to their own CMake file.
#
#    Kathleen Bonnell, Thu Jan 6 15:31:12 PST 2010
#    Allow data dir to be built on windows.
209
#
210 211 212
#    Eric Brugger, Fri Jan  7 13:24:41 PST 2011
#    I replaced the BOXLIB2D and BOXLIB3D variables with just BOXLIB.
#
213 214 215 216
#    Cyrus Harrison, Wed Jan 12 11:41:21 PST 2011
#    Add support for optional TYPE [CMAKE_TYPE] arg par to the
#    VISIT_OPTION_DEFAULT function.
#
217
#    Cyrus Harrison, Wed Jan 12 11:41:21 PST 2011
cyrush's avatar
cyrush committed
218
#    Added init of opt_ARG_PREV in VISIT_OPTION_DEFAULT to avoid cmake
219 220
#    warning message.
#
221 222 223
#    Kathleen Bonnell, Mon Feb 14 11:09:17 MST 2011
#    Remove strerror test, HAVE_STRERROR no longer used in VisIt.
#
224 225 226
#    Kathleen Bonnell, Wed Feb 16 08:33:33 PST 2011
#    Set CMAKE_BUILD_TYPE to Release, if not already set.
#
227 228 229 230 231 232
#    Mark C. Miller, Tue Mar 22 17:42:35 PDT 2011
#    I fixed problems overriding behavior of VISIT_3RDPARTY_VAR/DEP macros
#    when cmake is invoked with -DFOO_DIR:PATH=<path> to specify path to a
#    3rd party FOO lib. It was not working previously. I also removed
#    redundancy in args passed to VISIT_3RDPARTY_VAR/DEP macros
#    (VISIT_FOO_DIR and FOO_DIR replaced with just FOO_DIR).
233 234 235 236
#
#    Mark C. Miller, Wed Mar 30 09:30:49 PDT 2011
#    Fixed VISIT_3RDPARTY_VAR/DEP macros to define empty string ("") when
#    a lib's symbols are not defined instead of -NOTFOUND.
237 238 239 240 241
#
#    Eric Brugger, Thu May 12 12:50:58 PDT 2011
#    Add VISIT_FORCE_SSH_TUNNELING that always forces ssh tunneling for all
#    data connections.
#
242 243 244 245
#    Gunther H. Weber, Wed Jul 20 15:32:26 PDT 2011
#    Add support for creating a Mac App bundle by setting
#    VISIT_CREATE_APPBUNDLE_PACKAGE to ON.
#
246
#    Kathleen Biagas, Mon Aug 8 08:08:42 MST 2011
cyrush's avatar
cyrush committed
247
#    Use VISIT_3RDPARTY_DEP for all libdep vars.
248
#
249 250 251
#    Kathleen Biagas, Wed Aug 17 10:59:33 PDT 2011
#    Remove vtkzlib as a substitute for zlib.
#
252 253 254
#    Kathleen Biagas, Wed Aug 17 12:31:50 PDT 2011
#    Make use of NSIS to create an installer an option.
#
255 256 257 258
#    Gunther H. Weber, Tue Sep 20 17:15:48 PDT 2011
#    Use NERSC_HOST environment variable instead of hostname to determine if
#    we are running on Franklin or Hopper.
#
259 260 261
#    Kathleen Biagas, Mon Sep 26 14:59:32 MST 2011
#    Add mpi search support for Windows.
#
262 263 264
#    Gunther H. Weber, Wed Oct  5 19:14:27 PDT 2011
#    Change NERSC_HOST to VISIT_HOSTNAME to make it more general
#
265 266 267
#    Dave Pugmire, Tue Jan 10 15:30:02 EST 2012
#    Added support for R.
#
268 269 270 271 272
#    Kathleen Biagas, Tue Jan 24 12:22:47 MST 2012
#    On windows, use VisIt version of FindMPI.cmake to ensure correct search
#    paths.  Also ensure paths returned from FindMPI are converted to NATIVE
#    style.
#
273 274 275
#    Eric Brugger, Wed Feb 22 10:14:46 PST 2012
#    I added support for building without mesa.
#
276 277 278
#    Kathleen Biagas, Fri Mar  9 15:30:58 PST 2012
#    Prevent retesting of PROTOTYPE functions on re-configure.
#
279
#    Brad Whitlock, Fri May 18 16:35:34 PST 2012
cyrush's avatar
cyrush committed
280
#    Enhance support for resource files on Windows so we fill in more
281 282
#    application information.
#
cyrush's avatar
cyrush committed
283 284 285 286 287
#    Cyrus Harrison, Tue May 22 10:52:56 PDT 2012
#    Make PySide search conditional on VISIT_PYTHON_SCRIPTING.
#    Make Python search conditional on VISIT_PYTHON_SCRIPTING OR
#    VISIT_PYTHON_FILTERS
#
288 289 290 291 292 293 294 295
#    Eric Brugger, Fri May 25 09:50:53 PDT 2012
#    I set the VISIT_RENDERING_SIZE_LIMIT to 16384 so that we are not
#    unnecessarily constraining the user. There is no way to set this
#    properly since this is used in the viewer and the limit really comes
#    from the engine, which may have a different size if running
#    client/server. This setting should be removed and a runtime check
#    should be added to the engine.
#
296
#    Kathleen Biagas, Thu Jun 21 11:12:57 MST 2012
cyrush's avatar
cyrush committed
297 298
#    Include paths for vtk, exodusii, python and lib names for ptyhon are
#    different on windows than unix, so use special vars for use with
299 300
#    PluginVsInstall.
#    Added function 'ADD_TARGET_INCLUDE'.  (requires cmake 2.8.8 to work)
cyrush's avatar
cyrush committed
301
#    Modify how parallel flags are handled on windows.
302 303 304
#    Fix glitch with ADD_TARGET_DEFINITIONS when target
#    had more than one definition set already.
#
305 306 307
#    Kathleen Biagas, Tue Jun 26 13:38:27 MST 2012
#    Fixed parallel definitions for windows (removed -D).
#
308 309 310
#    Kathleen Biagas, Wed Sep 12 16:02:02 PDT 2012
#    Added VISIT_INSTALL_PROFILES_TO_HOST as a first-class VisIt option.
#
311 312 313
#    Kathleen Biagas, Mon Dec 17 16:56:38 MST 2012
#    Use CMake's FindMPI module for windows.
#
314 315 316 317 318
#    Cyrus Harrison, Thu Jan 10 10:03:50 PST 2013
#    Try to capture the full cmake invocation command line.
#    On non windows systems, generate a script that allows re-config
#    from scratch using the captured invocation command line.
#
319 320 321 322
#    Mark C. Miller, Tue Jan 15 17:15:43 PST 2013
#    Modified cmake invokation logic to ensure the CMAKE_INVOKE variable
#    is indeed (forced) cached so it winds up in CMakeCache.txt and
#    adjusted name of the shell script to recmake_visit.sh.
323
#
bonnell's avatar
bonnell committed
324 325 326
#    Mark C. Miller, Wed Feb  6 16:23:09 PST 2013
#    Fix missing '#' in first line of recmake_visit.sh file.
#
327 328 329 330 331 332 333
#    Kathleen Biagas, Tue Feb 26 13:58:12 MST 2013
#    Added VISIT_XXX_DEFAULT internal cache vars that store values set in
#    config-site cmake files via VISIT_OPTION_DEFAULT.  This allows for
#    VISIT_XXX vars to be overridden by changes to CMakeCache.txt.  If values
#    in the config-site cmake files change, they will still take precedence
#    over changes made to CMakeCache.txt (ie preserves old behavior).
#
334 335 336 337
#    Eric Brugger, Tue Mar 19 10:40:49 PDT 2013
#    Added code to only build the paraDIS reader if boost 1.36.0 or later
#    was installed on the system.
#
338 339 340 341 342 343 344 345 346
#    Eric Brugger, Wed Mar 20 17:23:28 PDT 2013
#    I modified the script to have VisIt use the system boost everywhere
#    instead of the internal boost if the system boost is usable by
#    paraDIS. This is to avoid using the system boost in the paraDIS
#    reader and the internal boost in the rest of visit. This fix was
#    recommended by Gunther. The other option was to add more of boost
#    to the internal boost so that it could be used by paraDIS, but that
#    seemed like more work.
#
bonnell's avatar
bonnell committed
347 348 349 350 351 352
#    Kathleen Biagas, Thur May 2 14:08:27 MST 2013
#    Don't bother finding bulk of thirdparty libs if building minimal plugins.
#
#    Kathleen Biagas, Wed May  8 16:24:01 PDT 2013
#    Remove EXODUS, no longer needed.
#
353 354 355
#    Eric Brugger, Thu May  9 17:09:27 PDT 2013
#    Removed support for mangled mesa.
#
bonnell's avatar
bonnell committed
356 357 358
#    Kathleen Biagas, Tue Sep  3 11:06:51 PDT 2013
#    Turn off SLIVR if we aren't using GLEW.
#
359 360 361
#   Kathleen Biagas, Tues Oct 1 09:33:47 MST 2013
#   Handle reorganization of windowsbuild directory.
#
cyrush's avatar
cyrush committed
362 363 364 365
#    Cyrus Harrison, on Oct 28 14:39:05 PDT 2013
#    Fix exported VTK targets for VTK-6. Fix VTK-6 include dirs 
#    for make install / package.
#
366 367 368 369
#    Kathleen Biagas, Wed Nov  6 17:42:32 PST 2013
#    Remove setting of CMAKE_Java_xxx, rely instead on the Java_xxx vars
#    set by FindJava.cmake
#
370 371 372
#    Kathleen Biagas, Tue Nov 26 10:14:29 PST 2013
#    Only add osxfixup dir if on APPLE.
#
373 374 375 376
#    Eric Brugger, Fri Feb 28 15:18:49 PST 2014
#    I added -DMPI_NO_CPPBIND to the VISIT_PARALLEL_CFLAGS and
#    VISIT_PARALLEL_CXXFLAGS.
#
377 378 379
#    Kathleen Biagas, Mon May 12 12:58:02 PDT 2014
#    Add VISIT_SELECTED_PLUGIN_ERROR macro.
#
380 381 382
#    Kathleen Biagas, Wed Oct 22 16:31:49 MST 2014
#    Always use -DNOMINMAX on Windows.
#
383 384 385
#    Cyrus Harrison, Tue Feb 10 20:06:07 PST 2015
#    Change boost support.
#
386 387 388
#    Kathleen Biagas, Tue Apr 14 14:56:12 MST 2015
#    Added find_file for MS HPC Scheduler.
#
389 390 391
#    Matthieu Dorier  via Cyrus Harrison, Thu Aug 20 09:07:08 PDT 2015
#    Added Damaris support.
#
loring's avatar
loring committed
392 393 394
#    Burlen Loring, Thu Oct  8 10:45:36 PDT 2015
#    Added define for aligned_alloc in visit-config.h
#
395 396 397
#    Eric Brugger, Wed Dec  9 12:05:18 PST 2015
#    Added support for VTKm.
#
398 399 400
#    Eric Brugger, Thu Jan 14 08:43:03 PST 2016
#    Added vtkm directory that builds vtkm library.
#
401 402
#****************************************************************************/

403
CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
404 405 406

IF (COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)
bonnell's avatar
bonnell committed
407 408 409
    if(CMAKE_MAJOR_VERSION GREATER 2)
        cmake_policy(SET CMP0033 OLD)
    endif()
410 411 412
    IF(WIN32 AND VISIT_QT5)
        cmake_policy(SET CMP0020 OLD)
    ENDIF()
413 414
ENDIF (COMMAND cmake_policy)

415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
#
# Try to capture the initial set of cmake command line args passed by
# the user for configuration.
# Recipe taken from http://stackoverflow.com/questions/10205986/how-to-capture-cmake-command-line-arguments
#
# Note: The entrires will live on CMakeCache.txt, so re-configuring with
# a command line that doesn't include an option won't remove it. You need
# to remove the CMakeCache.txt file, or override the value via the command line.
#
#
GET_CMAKE_PROPERTY(CACHE_VARS CACHE_VARIABLES)
FOREACH(CACHE_VAR ${CACHE_VARS})
  GET_PROPERTY(CACHE_VAR_HELPSTRING CACHE ${CACHE_VAR} PROPERTY HELPSTRING)
  IF(CACHE_VAR_HELPSTRING STREQUAL "No help, variable specified on the command line.")
    GET_PROPERTY(CACHE_VAR_TYPE CACHE ${CACHE_VAR} PROPERTY TYPE)
    IF(CACHE_VAR_TYPE STREQUAL "UNINITIALIZED")
      SET(CACHE_VAR_TYPE)
    ELSE(CACHE_VAR_TYPE STREQUAL "UNINITIALIZED")
      SET(CACHE_VAR_TYPE :${CACHE_VAR_TYPE})
    ENDIF()
    SET(CMAKE_INVOKE_ARGS "${CMAKE_INVOKE_ARGS} -D${CACHE_VAR}${CACHE_VAR_TYPE}=\"${${CACHE_VAR}}\"")
  ENDIF()
ENDFOREACH(CACHE_VAR ${CACHE_VARS})
# Record the full command line invocation.
439
SET(CMAKE_INVOKE "${CMAKE_COMMAND} ${CMAKE_INVOKE_ARGS} ${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Command used to invoke cmake" FORCE)
440 441
# Create a simple shell script that allows us to reinvoke cmake with the captured command line.
IF (NOT WIN32)
442
    FILE(WRITE ${CMAKE_BINARY_DIR}/recmake_visit.sh "#!/bin/sh\n"
443 444 445 446
                                                     "rm -f CMakeCache.txt\n"
                                                     "${CMAKE_INVOKE}\n")
ENDIF (NOT WIN32)

447 448 449 450 451 452 453 454 455

# Tell the CMake makefile generator to not have rules depend on
# themselves.  This causes extra rebuilds when the include path
# changes from turning a kit on or off.
SET(CMAKE_SKIP_RULE_DEPENDENCY 1)

# for now...
SET(BUILD_SHARED_LIBS 1)

456 457 458
# this turns on the FOLDER property for generators that may make use of it, like Visual Studio
# should have no effect for generators that do not use.
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
459 460 461 462 463 464 465

#-----------------------------------------------------------------------------
# Get this computer's hostname using cmake's cross platform helper function.
#----------------------------------------------------------------------------

SITE_NAME(HOSTNAME)

466 467 468
# Use NERSC_HOST environment variable to determine if we are running on Franklin
# or Hopper. If so, use that hostname instead of the result of SITE_NAME which is
# only the name of the login node we are running on.
469 470 471
IF(NOT "$ENV{VISIT_HOSTNAME}" STREQUAL "")
    SET(HOSTNAME "$ENV{VISIT_HOSTNAME}")
ENDIF(NOT "$ENV{VISIT_HOSTNAME}" STREQUAL "")
472 473


474
#-----------------------------------------------------------------------------
475 476
# Helper function for setting build options via config-site file.
# Supports optional argument pair: TYPE [CMAKE_TYPE], default type = PATH
477 478
#-----------------------------------------------------------------------------
FUNCTION(VISIT_OPTION_DEFAULT var)
479 480
  SET(opt_ARGS "")
  SET(opt_TYPE "PATH")
481
  SET(opt_ARG_PREV "[unset]")
482 483 484 485 486 487 488 489 490 491 492 493
  FOREACH(opt_ARG ${ARGN})
    ## if arg is TYPE:
    ##   we want to use the next value as the cmake var type
    ## otherwise:
    ##   we want to append the argument to the list of args used for "SET"
    IF( ${opt_ARG_PREV} STREQUAL "TYPE")
        SET(opt_TYPE ${opt_ARG})
    ELSEIF(NOT ${opt_ARG} STREQUAL "TYPE")
        LIST(APPEND opt_ARGS ${opt_ARG})
    ENDIF(${opt_ARG_PREV} STREQUAL "TYPE")
    SET(opt_ARG_PREV ${opt_ARG})
  ENDFOREACH(opt_ARG in ${ARGN})
494 495 496 497 498 499 500
  ## 
  SET(default_base "${var}_DEFAULT")
  SET(default_base_val  "${${default_base}}")
  IF(NOT "${default_base_val}" STREQUAL "${opt_ARGS}")
      SET("${default_base}" "${opt_ARGS}" CACHE INTERNAL "${var} default value" FORCE)
      SET(${var} "${opt_ARGS}" CACHE ${opt_TYPE} "${var} value" FORCE)
  ENDIF(NOT "${default_base_val}" STREQUAL "${opt_ARGS}")
501
ENDFUNCTION(VISIT_OPTION_DEFAULT var)
502

503 504
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/SetupITAPS.cmake)

bonnell's avatar
bonnell committed
505 506
SET(VTK_MINIMUM_VERSION "6.0.0" CACHE INTERNAL "minimum version of vtk that VisIt can use")

507 508 509 510 511
SET(NEKTAR++_MINIMUM_VERSION "4.0.0" CACHE INTERNAL "minimum version of Nektar++ that VisIt can use")

FUNCTION(SETUP_APP_VERSION name ver )
  IF(${ver} VERSION_LESS ${${name}_MINIMUM_VERSION}})
      MESSAGE(FATAL_ERROR "${name} version must be at least ${${name}_MINIMUM_VERSION}}")
bonnell's avatar
bonnell committed
512 513 514
  ENDIF()
  STRING( REGEX REPLACE "([0-9]+).[0-9]+.[0-9]+" "\\1" vmaj ${ver} )
  STRING( REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+" "\\1" vmin ${ver} )
515 516 517
  SET(${name}_VERSION "${ver}"  CACHE INTERNAL "")
  SET(${name}_MAJOR_VERSION   "${vmaj}" CACHE INTERNAL "")
  SET(${name}_MINOR_VERSION   "${vmin}" CACHE INTERNAL "")
bonnell's avatar
bonnell committed
518 519
ENDFUNCTION()

520 521 522
#-----------------------------------------------------------------------------
# Include this computer's config-site if one exists
#-----------------------------------------------------------------------------
523
IF (NOT WIN32)
524 525
  IF(VISIT_CONFIG_SITE)
      SET(VISIT_CONFIG_SITE_FILE ${VISIT_CONFIG_SITE})
526
  ELSE(VISIT_CONFIG_SITE)
527
      SET(VISIT_CONFIG_SITE_FILE "config-site/${HOSTNAME}.cmake")
528
  ENDIF(VISIT_CONFIG_SITE)
529 530 531 532 533 534 535 536 537

  MESSAGE(STATUS "Trying to include config-site file '${VISIT_CONFIG_SITE_FILE}'")
  INCLUDE(${VISIT_CONFIG_SITE_FILE} OPTIONAL RESULT_VARIABLE VISIT_CONFIG_SITE_FILE_FOUND)
  IF("${VISIT_CONFIG_SITE_FILE_FOUND}" STREQUAL  "NOTFOUND")
        MESSAGE(STATUS "NOT FOUND: '${VISIT_CONFIG_SITE_FILE}'")
  ELSE("${VISIT_CONFIG_SITE_FILE_FOUND}" STREQUAL  "NOTFOUND")
        MESSAGE(STATUS "Included: '${VISIT_CONFIG_SITE_FILE}'")
  ENDIF("${VISIT_CONFIG_SITE_FILE_FOUND}" STREQUAL  "NOTFOUND")

538 539
ENDIF (NOT WIN32)

540 541 542 543 544 545 546 547 548
#-----------------------------------------------------------------------------
# If the config-site file above has not set a VTK version set a
# default VTK version of 6.1.0.  
#-----------------------------------------------------------------------------
IF(NOT VTK_VERSION)
  IF(VISIT_VTK_VERSION)
      IF(${VISIT_VTK_VERSION} VERSION_LESS ${VTK_MINIMUM_VERSION})
          MESSAGE(FATAL_ERROR "VTK version must be at least ${VTK_MINIMUM_VERSION}")
      ENDIF()
549
      SETUP_APP_VERSION(VTK ${VISIT_VTK_VERSION})
550 551
  ELSE()
      MESSAGE(STATUS "VISIT_VTK_VERSION NOT FOUND assuming 6.1.0")
552
      SETUP_APP_VERSION(VTK 6.1.0)
553 554 555 556
  ENDIF()
ENDIF()


557 558 559 560 561 562 563 564 565
#-----------------------------------------------------------------------------
# If the config-site file above has not set a NEKTAR++ version set a
# default NEKTAR++ version of 4.0.0.  
#-----------------------------------------------------------------------------
IF(NOT NEKTAR++_VERSION)
  IF(VISIT_NEKTAR++_VERSION)
      IF(${VISIT_NEKTAR++_VERSION} VERSION_LESS ${NEKTAR++_MINIMUM_VERSION})
          MESSAGE(FATAL_ERROR "NEKTAR++ version must be at least ${NEKTAR++_MINIMUM_VERSION}")
      ENDIF()
566
      SETUP_APP_VERSION(NEKTAR++ ${VISIT_NEKTAR++_VERSION})
567 568
  ELSE()
      MESSAGE(STATUS "VISIT_NEKTAR++_VERSION NOT FOUND assuming 4.0.0")
569
      SETUP_APP_VERSION(NEKTAR++ 4.0.0)
570 571 572 573
  ENDIF()
ENDIF()


574 575 576 577 578 579 580 581
#-----------------------------------------------------------------------------
# If not already set, we use a default build type of Release
#-----------------------------------------------------------------------------

IF (NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build,
options are: Debug Release RelWithDebInfo MinSizeRel.")
ENDIF()
582 583 584 585 586 587

#-----------------------------------------------------------------------------
# Set compiler from config-site
#-----------------------------------------------------------------------------
SET(CMAKE_C_COMPILER ${VISIT_C_COMPILER})
SET(CMAKE_CXX_COMPILER ${VISIT_CXX_COMPILER})
588
SET(CMAKE_Fortran_COMPILER ${VISIT_FORTRAN_COMPILER})
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616

#-----------------------------------------------------------------------------
# VisIt project. Declare the project after including the input because
#                this lets us set up defaults in the config-site.
#-----------------------------------------------------------------------------

PROJECT(VISIT)

#-----------------------------------------------------------------------------
# Set extended platlform defs.
#-----------------------------------------------------------------------------
INCLUDE(${VISIT_SOURCE_DIR}/CMake/SetUpPlatformDefs.cmake)


#-----------------------------------------------------------------------------
# Setup out of source build indicator.
#-----------------------------------------------------------------------------
IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
    SET(VISIT_OUT_OF_SOURCE_BUILD 0)
ELSE("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
    SET(VISIT_OUT_OF_SOURCE_BUILD 1)
ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")

#-----------------------------------------------------------------------------
# Windows needs values that are only set at this point, so now include
# the windows cmake file.
#-----------------------------------------------------------------------------
IF (WIN32)
617 618 619 620
  IF (VISIT_CONFIG_SITE)
      MESSAGE(STATUS "Trying to include ${VISIT_CONFIG_SITE}")
      INCLUDE(${VISIT_CONFIG_SITE})
  ELSEIF (EXISTS ${VISIT_SOURCE_DIR}/config-site/${HOSTNAME}.cmake)
621 622
      MESSAGE(STATUS "Trying to include config-site/${HOSTNAME}.cmake")
      INCLUDE(config-site/${HOSTNAME}.cmake)
623
  ELSE (VISIT_CONFIG_SITE)
624 625
      MESSAGE(STATUS "Trying to include config-site/windows.cmake")
      INCLUDE(config-site/windows.cmake)
626
  ENDIF (VISIT_CONFIG_SITE)
627
  SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "VisIt builds with rpath set." FORCE)
628 629 630 631 632 633
  IF(NOT VISIT_WINDOWS_DIR)
    MESSAGE(FATAL_ERROR "VISIT_WINDOWS_DIR is not defined.")
  ENDIF()
  IF(NOT EXISTS ${VISIT_WINDOWS_DIR})
    MESSAGE(FATAL_ERROR "${VISIT_WINDOWS_DIR} does not exist.")
  ENDIF()
634 635 636 637 638 639
ENDIF (WIN32)

#-----------------------------------------------------------------------------
# Output directories.
#-----------------------------------------------------------------------------

640 641 642
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${VISIT_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
643

644 645 646
IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
  SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${VISIT_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
647

648 649 650
IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
      SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${VISIT_BINARY_DIR}/exe CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
651

652 653 654 655

SET(VISIT_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR})
SET(VISIT_EXECUTABLE_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR})
SET(CXX_TEST_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
656 657 658 659 660 661

#-----------------------------------------------------------------------------
# configure options
#-----------------------------------------------------------------------------
OPTION(VISIT_PARALLEL "Build VisIt's parallel compute engine." OFF)

662 663
OPTION(VISIT_TUVOK    "Build VisIt with support for the Tuvok volume rendering library." OFF)
OPTION(VISIT_SLIVR    "Build VisIt with support for the SLIVR volume rendering library." ON)
664 665
OPTION(VISIT_STATIC   "Build VisIt statically." OFF)
IF(VISIT_STATIC)
666
    ADD_DEFINITIONS(-DVISIT_STATIC -DGLEW_STATIC)
667
ENDIF(VISIT_STATIC)
668
OPTION(VISIT_OSX_USE_RPATH      "Use rpath instead of executable_path while installing" OFF)
669
OPTION(VISIT_PYTHON_SCRIPTING      "Build VisIt with Python scripting support." ON)
670
OPTION(VISIT_PYTHON_FILTERS        "Build VisIt with Python Engine Filter support." ON)
pugmire's avatar
pugmire committed
671 672 673 674
OPTION(VISIT_DDT      "Build VisIt with support for the DDT debugger." OFF)
IF(VISIT_DDT)
  ADD_DEFINITIONS(-DHAVE_DDT)
ENDIF(VISIT_DDT)
675

676 677 678 679
OPTION(VISIT_BUILD_ALL_PLUGINS     "Build all of VisIt's plugins." OFF)
OPTION(VISIT_BUILD_MINIMAL_PLUGINS "Build a minimal set of VisIt's plugins." OFF)
OPTION(VISIT_ZLIB "Use VisIt's internal libz" OFF)
OPTION(VISIT_JAVA "Build the VisIt Java client interface" OFF)
680
OPTION(VISIT_PARADIS "Build the VisIt paraDIS client interface" OFF)
681 682 683
OPTION(VISIT_SERVER_COMPONENTS_ONLY "Build only vcl, mdserver, engine and their plugins" OFF)
OPTION(VISIT_ENGINE_ONLY "Build only the compute engine and its plugins" OFF)
OPTION(VISIT_DBIO_ONLY "Build only visitconvert and engine plugins" OFF)
cyrush's avatar
cyrush committed
684
# If we're doing DBIO_ONLY then compile all sources with this flag so we don't
685 686 687 688 689 690 691
# ever have to do things like include visit-config.h to get it.
IF(VISIT_DBIO_ONLY)
    ADD_DEFINITIONS(-DDBIO_ONLY)
ENDIF(VISIT_DBIO_ONLY)
OPTION(VISIT_DISABLE_SELECT "Disable use of the select() function" OFF)
OPTION(VISIT_USE_NOSPIN_BCAST "Use VisIt's no-spin Bcast in parallel" ON)
OPTION(VISIT_INSTALL_THIRD_PARTY "Install VisIt's 3rd party I/O libs and includes to permit plugin development" OFF)
692
OPTION(VISIT_NOLINK_MPI_WITH_LIBRARIES "Do not link MPI with VisIt's parallel shared libraries; just with executables" OFF)
ghweber's avatar
ghweber committed
693
OPTION(VISIT_CREATE_SOCKET_RELAY_EXECUTABLE "Create a separate executable that forwards VisIt's socket connection between engine and component launcher" OFF)
694
OPTION(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH "Install rpath relative to executable location using \$ORIGIN tag" OFF)
695 696
OPTION(VISIT_FORTRAN "Enable compilation of Fortran example progams" OFF)
OPTION(VISIT_DATA_MANUAL_EXAMPLES "Build Getting Data Into VisIt examples" OFF)
697

698
OPTION(IGNORE_THIRD_PARTY_LIB_PROBLEMS "Ignore problems finding requested third party libraries")
699
OPTION(VISIT_FORCE_SSH_TUNNELING "Force ssh tunnelling for sockets" OFF)
cyrush's avatar
cyrush committed
700
OPTION(VISIT_CREATE_APPBUNDLE_PACKAGE "Create DMG file with Mac App bundle with make package" OFF)
701 702
IF(WIN32)
  OPTION(VISIT_MAKE_NSIS_INSTALLER "Create an installer package using NSIS" OFF)
703 704 705 706
  OPTION(VISIT_WINDOWS_APPLICATION "Create Windows-style applications with no console" ON)
  IF(VISIT_WINDOWS_APPLICATION)
      SET(VISIT_APPLICATION_STYLE "WIN32")
  ENDIF(VISIT_WINDOWS_APPLICATION)
707
ENDIF(WIN32)
708 709 710
IF(VISIT_MESA_DIR)
  OPTION(VISIT_USE_MANGLED_MESA "Enable use of mangled Mesa classes in VisIt" OFF)
ENDIF(VISIT_MESA_DIR)
bonnell's avatar
bonnell committed
711

712
OPTION(VISIT_INSTALL_AS_BETA "Install as beta (symlink beta instead of current to installed version)." OFF)
713
OPTION(VISIT_MPICH_INSTALL "Install MPICH into VisIt binary distribution" OFF)
714 715 716 717 718 719
IF(APPLE OR WIN32)
    OPTION(VISIT_USE_X "Use X11" OFF)
ELSE(APPLE OR WIN32)
    OPTION(VISIT_USE_X "Use X11" ON)
ENDIF(APPLE OR WIN32)
OPTION(VISIT_USE_GLEW "Use GLEW to call GL functions." ON)
720

camp's avatar
camp committed
721
OPTION(VISIT_THREAD "Build VisIt with thread support." OFF)
722 723
OPTION(VISIT_BUILD_AVTEXAMPLES  "Enable building of avtexamples" ON)
OPTION(VISIT_BUILD_DIAGNOSTICS  "Enable building of diagnostices" ON)
camp's avatar
camp committed
724

whitlocb's avatar
whitlocb committed
725 726
OPTION(VISIT_ENABLE_XDB "Enable Intelligent Light XDB database plugin." OFF) # OFF for now

727 728
SET(VISIT_INSTALL_PROFILES_TO_HOSTS "" CACHE STRING "Install specified host profiles (no action if empty)." )

729 730
MACRO(VISIT_3RDPARTY_VAR libvar comment)
    IF(NOT DEFINED VISIT_${libvar})
cyrush's avatar
cyrush committed
731
        # Create an empty entry for this path variable
732
        SET(VISIT_${libvar} "" CACHE PATH "${comment}")
733 734 735 736 737 738 739 740 741 742 743 744 745
    ELSE(NOT DEFINED VISIT_${libvar})
        IF(DEFINED ${libvar})
            # Ensure VISIT_FOO_DIR=FOO_DIR (override from CL)
            SET(VISIT_${libvar} ${${libvar}} CACHE PATH "${comment}" FORCE)
        ELSE(DEFINED ${libvar})
            # Set FOO_DIR=VISIT_FOO_DIR (default from config-site file)
            SET(${libvar} ${VISIT_${libvar}})
        ENDIF(DEFINED ${libvar})
    ENDIF(NOT DEFINED VISIT_${libvar})
ENDMACRO(VISIT_3RDPARTY_VAR libvar comment)

MACRO(VISIT_3RDPARTY_DEP libvar comment)
    IF(NOT DEFINED VISIT_${libvar})
cyrush's avatar
cyrush committed
746
        # Create an entry for this string variable
747
        SET(VISIT_${libvar} "" CACHE STRING "${comment}")
748 749 750 751 752 753 754 755 756 757
    ELSE(NOT DEFINED VISIT_${libvar})
        IF(DEFINED ${libvar})
            # Ensure VISIT_FOO_LIBDEP=FOO_LIBDEP (override from CL)
            SET(VISIT_${libvar} ${${libvar}} CACHE STRING "${comment}" FORCE)
        ELSE(DEFINED ${libvar})
            # Set FOO_LIBDEP=VISIT_FOO_LIBDEP (default from config-site file)
            SET(${libvar} ${VISIT_${libvar}})
        ENDIF(DEFINED ${libvar})
    ENDIF(NOT DEFINED VISIT_${libvar})
ENDMACRO(VISIT_3RDPARTY_DEP libvar comment)
758

cyrush's avatar
cyrush committed
759
# Define options that let us pick our standard libraries: VTK,Mesa,Qt,Python
760
# and so on.
761 762 763
VISIT_3RDPARTY_VAR(VTK_DIR    "Path containing the VTK library's bin and lib")
VISIT_3RDPARTY_VAR(QT_BIN     "Path to the Qt library's bin (path containing qmake)")
VISIT_3RDPARTY_VAR(PYTHON_DIR "Path containing the Python library's include and lib")
764 765 766
IF (NOT WIN32)
  VISIT_3RDPARTY_VAR(MESA_DIR   "Path containing the Mesa library's include and lib")
ENDIF (NOT WIN32)
767 768
VISIT_3RDPARTY_VAR(ICET_DIR   "Path containing the Ice-T library's include and lib")
VISIT_3RDPARTY_VAR(TCMALLOC_DIR   "Path containing the tcmalloc library's include and lib")
769

770 771
# Libraries some third-parties are dependent upon
IF(WIN32)
772 773
  VISIT_3RDPARTY_VAR(JPEG_DIR   "Path containing the jpeg library's include and lib")
  VISIT_3RDPARTY_VAR(SZIP_DIR   "Path containing the szip library's include and lib")
774 775
ENDIF(WIN32)

cyrush's avatar
cyrush committed
776
# Define the options that let us pick I/O library installation locations. When
777 778
# the library option is defined then we also define the variable name passed as
# the 3rd argument. That variable is what is used in our various Find routines.
779 780 781 782 783
#
# Note: Define LIBDEP ONLY for libs a plugin is INdirectly dependent on (e.g.
#       needs to link but not to compile). Use the plugin's .xml file for
#       libs a plugin is DIRECTLY dependent on (e.g. needs to both compile
#       and link).
784 785
VISIT_3RDPARTY_VAR(ADIOS_DIR     "Path containing the ADIOS library's include and lib")
VISIT_3RDPARTY_VAR(ADVIO_DIR     "Path containing the AdvIO library's include and lib")
allens's avatar
allens committed
786
VISIT_3RDPARTY_VAR(BOOST_DIR     "Path containing the BOOST library's include and lib")
787 788 789 790
VISIT_3RDPARTY_VAR(BOXLIB_DIR    "Path containing the Boxlib library's include and lib")
VISIT_3RDPARTY_VAR(CCMIO_DIR     "Path containing the CCMIO library's include and lib")
VISIT_3RDPARTY_VAR(CFITSIO_DIR   "Path containing the CFITSIO library's include and lib")
VISIT_3RDPARTY_VAR(CGNS_DIR      "Path containing the CGNS library's include and lib")
791
VISIT_3RDPARTY_DEP(CGNS_LIBDEP   "CGNS library dependencies")
792
VISIT_3RDPARTY_VAR(DAMARIS_DIR   "Path containing the Damaris library's include and lib")
cyrush's avatar
cyrush committed
793
VISIT_3RDPARTY_VAR(EAVL_DIR      "Path containing the eavl library's include and lib")
794 795
VISIT_3RDPARTY_VAR(FASTBIT_DIR   "Path containing the Fastbit library's include and lib")
VISIT_3RDPARTY_VAR(GDAL_DIR      "Path containing the GDAL library's include and lib")
796
VISIT_3RDPARTY_VAR(GFORTRAN_DIR  "Path containing the GFortran library's include and lib")
797 798 799 800 801
VISIT_3RDPARTY_VAR(HDF4_DIR      "Path containing the HDF4 library's include and lib")
VISIT_3RDPARTY_DEP(HDF4_LIBDEP   "HDF4 library dependencies")
VISIT_3RDPARTY_VAR(HDF5_DIR      "Path containing the HDF5 library's include and lib")
VISIT_3RDPARTY_DEP(HDF5_LIBDEP   "HDF5 library dependencies")
VISIT_3RDPARTY_VAR(H5PART_DIR    "Path containing the H5Part library's include and lib")
802
VISIT_3RDPARTY_DEP(H5PART_LIBDEP "H5Part library dependencies")
803
VISIT_3RDPARTY_VAR(MFEM_DIR      "Path containing the mfem library's include and lib")
804
VISIT_3RDPARTY_VAR(MILI_DIR      "Path containing the Mili library's include and lib")
allens's avatar
allens committed
805 806
VISIT_3RDPARTY_VAR(NEKTAR++_DIR  "Path containing the Nektar++ library's include and lib")
VISIT_3RDPARTY_DEP(NEKTAR++_LIBDEP "Nektar++ library dependencies")
807
VISIT_3RDPARTY_VAR(OPENGL_DIR    "Path containing the OpenGL library's include and lib")
808
VISIT_3RDPARTY_VAR(NETCDF_DIR    "Path containing the NETCDF library's include and lib")
809
VISIT_3RDPARTY_DEP(NETCDF_LIBDEP "NETCDF library dependencies")
810
VISIT_3RDPARTY_VAR(PYSIDE_DIR    "Path containing the PySide installation")
811
VISIT_3RDPARTY_VAR(R_DIR         "Path containing the R library's include and lib")
812 813
VISIT_3RDPARTY_VAR(SILO_DIR      "Path containing the Silo library's include and lib")
VISIT_3RDPARTY_DEP(SILO_LIBDEP   "Silo library dependencies")
814
VISIT_3RDPARTY_VAR(UINTAH_DIR    "Path containing the Uintah library's include and lib")
815
VISIT_3RDPARTY_VAR(VISUS_DIR     "Path containing the Visus library's include and lib")
816
VISIT_3RDPARTY_VAR(VTKM_DIR      "Path containing the VTKm library's include and lib")
817
VISIT_3RDPARTY_VAR(XDMF_DIR      "Path containing the Xdmf library's include and lib")
818
VISIT_3RDPARTY_DEP(XDMF_LIBDEP   "Xdmf library dependencies")
819 820
VISIT_3RDPARTY_VAR(XERCESC_DIR   "Path containing the Xerces-C library's include and lib")
VISIT_3RDPARTY_VAR(XSD_DIR       "Path containing the XSD library's include and lib")
821
VISIT_3RDPARTY_VAR(MDSPLUS_DIR   "Path containing the MDSplus library's include and lib")
822
VISIT_3RDPARTY_VAR(MANTA_DIR     "Path containing the Manta library's include and lib")
823 824
VISIT_3RDPARTY_VAR(ZLIB_DIR      "Path containing the zlib library's include and lib")

825 826 827 828 829 830 831 832 833 834 835 836 837 838
#-----------------------------------------------------------------------------
# Read the version
#-----------------------------------------------------------------------------
FILE(STRINGS VERSION VERSION)
IF(NOT VERSION)
    SET(VERSION "2.0.0")
ENDIF(NOT VERSION)
SET(VISIT_VERSION ${VERSION})

#-----------------------------------------------------------------------------
# Set up some installation related value and macros (needs version).
#-----------------------------------------------------------------------------

IF(WIN32)
839
    # override cmake's default of %Program Files% for CMAKE_INSTALL_PREFIX
cyrush's avatar
cyrush committed
840
    # if it wasn't specified via command line,
841 842
    IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      IF( NOT APPENDED_VISIT_VERSION_TO_INSTALL_PATH)
cyrush's avatar
cyrush committed
843
        SET(CMAKE_INSTALL_PREFIX "${VISIT_BINARY_DIR}/VisIt ${VISIT_VERSION}"
844 845
            CACHE PATH "Install path prefix, prepended onto install directories" FORCE)
        SET(APPENDED_VISIT_VERSION_TO_INSTALL_PATH TRUE CACHE INTERNAL "")
846 847 848 849
      ENDIF( NOT APPENDED_VISIT_VERSION_TO_INSTALL_PATH)
    ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

    # set up directories
850
    SET(VISIT_INSTALLED_VERSION ${CMAKE_INSTALL_PREFIX}
bonnell's avatar
bonnell committed
851
        CACHE PATH "VisIt install directory" FORCE)
cyrush's avatar
cyrush committed
852
    SET(VISIT_INSTALLED_VERSION_BIN ${CMAKE_INSTALL_PREFIX}
853
        CACHE PATH "VisIt bin install directory" FORCE)
cyrush's avatar
cyrush committed
854
    SET(VISIT_INSTALLED_VERSION_LIB ${CMAKE_INSTALL_PREFIX}/lib
855
        CACHE PATH "VisIt lib install directory" FORCE)
cyrush's avatar
cyrush committed
856
    SET(VISIT_INSTALLED_VERSION_INCLUDE ${CMAKE_INSTALL_PREFIX}/include
857
        CACHE PATH "VisIt include install directory" FORCE)
cyrush's avatar
cyrush committed
858
    SET(VISIT_INSTALLED_VERSION_PLUGINS ${CMAKE_INSTALL_PREFIX}
859
        CACHE PATH "VisIt plugins install directory" FORCE)
cyrush's avatar
cyrush committed
860
    SET(VISIT_INSTALLED_VERSION_ARCHIVES ${CMAKE_INSTALL_PREFIX}/lib
bonnell's avatar
bonnell committed
861
        CACHE PATH "3rd party I/O archives install directory" FORCE)
862 863
    SET(VISIT_INSTALLED_VERSION_RESOURCES ${CMAKE_INSTALL_PREFIX}/resources
        CACHE PATH "VisIt resources install directory" FORCE)
864 865 866
ELSE(WIN32)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/DetermineVisItArchitecture.cmake)
    DETERMINE_VISIT_ARCHITECTURE(VISIT_INSTALL_PLATFORM)
cyrush's avatar
cyrush committed
867
    SET(VISIT_INSTALLED_VERSION ${VISIT_VERSION}/${VISIT_INSTALL_PLATFORM}
868
        CACHE PATH "VisIt install directory" FORCE)
cyrush's avatar
cyrush committed
869
    SET(VISIT_INSTALLED_VERSION_BIN ${VISIT_INSTALLED_VERSION}/bin
870
        CACHE PATH "VisIt bin install directory" FORCE)
cyrush's avatar
cyrush committed
871
    SET(VISIT_INSTALLED_VERSION_LIB ${VISIT_INSTALLED_VERSION}/lib
872
        CACHE PATH "VisIt lib install directory" FORCE)
cyrush's avatar
cyrush committed
873
    SET(VISIT_INSTALLED_VERSION_INCLUDE ${VISIT_INSTALLED_VERSION}/include
874
        CACHE PATH "VisIt include install directory" FORCE)
cyrush's avatar
cyrush committed
875
    SET(VISIT_INSTALLED_VERSION_PLUGINS ${VISIT_INSTALLED_VERSION}/plugins
876
        CACHE PATH "VisIt plugins install directory" FORCE)
cyrush's avatar
cyrush committed
877
    SET(VISIT_INSTALLED_VERSION_ARCHIVES ${VISIT_INSTALLED_VERSION}/archives
878
        CACHE PATH "3rd party I/O archives install directory" FORCE)
879 880
    SET(VISIT_INSTALLED_VERSION_RESOURCES ${VISIT_INSTALLED_VERSION}/resources
        CACHE PATH "VisIt resources install directory" FORCE)
881 882 883 884 885

    IF(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH)
        SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
        SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
    ENDIF(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH)
886
    #
887 888 889 890 891 892 893 894 895 896 897 898 899
    # Note that the last line in the EXECUTE_PROCESS command below should
    # have a "\" before the ${CMAKE_INSTALL_PREFIX} to be truely correct.
    # The code creates a symbolic link from "current" to the current visit
    # version number.  Because of the coding error it succeeds when doing
    # a "make install" and fails when doing a "make package", which is
    # exactly what we want.  We do this because CPACK may create an
    # invalid tar file if the distribution contains a link to a directory.
    # This happens because CPACK removes the symbolic link and replaces all
    # the files in the directory pointed to by the symbolic link with hard
    # links.  It only stores 100 characters of path information in the hard
    # link so long paths may get truncated resulting in invalid files.  We
    # have a bunch of files with paths greater than 100 character so this
    # fails in our case.
900
    #
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917
    IF(VISIT_INSTALL_AS_BETA)
        INSTALL(CODE "
          MESSAGE(\"Symlinking beta to ${VISIT_VERSION}\")
          EXECUTE_PROCESS(WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}
            COMMAND \${CMAKE_COMMAND} -E create_symlink
            \"${VISIT_VERSION}\"
            \"${CMAKE_INSTALL_PREFIX}/beta\")
        ")
    ELSE(VISIT_INSTALL_AS_BETA)
        INSTALL(CODE "
          MESSAGE(\"Symlinking current to ${VISIT_VERSION}\")
          EXECUTE_PROCESS(WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}
            COMMAND \${CMAKE_COMMAND} -E create_symlink
            \"${VISIT_VERSION}\"
            \"${CMAKE_INSTALL_PREFIX}/current\")
        ")
    ENDIF(VISIT_INSTALL_AS_BETA)
918 919
ENDIF(WIN32)
MARK_AS_ADVANCED(
cyrush's avatar
cyrush committed
920 921
VISIT_INSTALLED_VERSION_BIN
VISIT_INSTALLED_VERSION_LIB
922
VISIT_INSTALLED_VERSION_PLUGINS
923 924
VISIT_INSTALLED_VERSION_ARCHIVES
VISIT_INSTALLED_VERSION_INCLUDE
925 926
)

loring's avatar
loring committed
927 928 929
# experimental!!
# ctest/cdash testing support
SET(BUILD_TESTING OFF CACHE BOOL "Enable ctest hooks into VisIt's regression suite")
930
IF(BUILD_TESTING)
loring's avatar
loring committed
931
    # enable native cmake testing
932 933 934 935 936
    INCLUDE(CTest)
    CONFIGURE_FILE(
        "${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in"
        "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake"
        @ONLY)
loring's avatar
loring committed
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
    # notes:
    # * visit test sources aren't in the source tree
    # * and baseline images are currently with test sources
    # * test data is generated from a set of programs
    #   that need to be built, also not in the source tree,
    #   but configured by this cmake lists file
    SET(VISIT_TEST_DIR "${VISIT_SOURCE_DIR}/../test"
        CACHE PATH "Path to VisIt's regression suite")
    SET(VISIT_BASELINE_DIR "${VISIT_SOURCE_DIR}/../test/baseline"
        CACHE PATH "Path to baseline images used by VisIt's regression suite")
    SET(VISIT_DATA_DIR "${CMAKE_BINARY_DIR}/data"
        CACHE PATH "Path to data used by VisIt's regression suite")
    # make it obvous if we do not have any of these, as
    # this will likely be a source of confusion for the
    # uninitiated
loring's avatar
loring committed
952 953 954
    IF ((NOT EXISTS ${VISIT_TEST_DIR}) OR (NOT EXISTS ${VISIT_BASELINE_DIR})
       OR ((NOT EXISTS ${VISIT_DATA_DIR}) AND (NOT EXISTS "${VISIT_SOURCE_DIR}/../data")))
        MESSAGE(FATAL_ERROR
loring's avatar
loring committed
955 956 957 958 959 960 961 962
           "CTest based testing requires a checkout of trunk/test and trunk/data")
    ENDIF()
    # add a phony target to be sure that data for tests is
    # generated/updated during the build
    ADD_CUSTOM_TARGET(testing ALL)
    ADD_DEPENDENCIES(testing testdata)
    # configure tests
    SUBDIRS(${VISIT_TEST_DIR})
963
ENDIF()
964

965
MACRO(VISIT_INSTALL_TARGETS_RELATIVE dest_dir)
966 967 968 969 970 971
    IF(VISIT_STATIC)
        # Skip installation of static libraries when we build statically
        FOREACH(T ${ARGN})
            GET_TARGET_PROPERTY(pType ${T} TYPE)
            IF(NOT ${pType} STREQUAL "STATIC_LIBRARY")
                INSTALL(TARGETS ${T}
972 973 974 975
                    RUNTIME DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/${dest_dir}
                    BUNDLE  DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/${dest_dir}
                    LIBRARY DESTINATION ${VISIT_INSTALLED_VERSION_LIB}/${dest_dir}
                    ARCHIVE DESTINATION ${VISIT_INSTALLED_VERSION_ARCHIVES}/${dest_dir}
cyrush's avatar
cyrush committed
976 977
                    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                                GROUP_READ GROUP_WRITE GROUP_EXECUTE
bonnell's avatar
bonnell committed
978
                                WORLD_READ             WORLD_EXECUTE
979
                    CONFIGURATIONS "" None Debug Release RelWithDebInfo MinSizeRel
980 981 982 983 984
                )
            ENDIF(NOT ${pType} STREQUAL "STATIC_LIBRARY")
        ENDFOREACH(T)
    ELSE(VISIT_STATIC)
        INSTALL(TARGETS ${ARGN}
985 986 987 988
            RUNTIME DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/${dest_dir}
            BUNDLE  DESTINATION ${VISIT_INSTALLED_VERSION_BIN}/${dest_dir}
            LIBRARY DESTINATION ${VISIT_INSTALLED_VERSION_LIB}/${dest_dir}
            ARCHIVE DESTINATION ${VISIT_INSTALLED_VERSION_ARCHIVES}/${dest_dir}
cyrush's avatar
cyrush committed
989 990
            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                        GROUP_READ GROUP_WRITE GROUP_EXECUTE
bonnell's avatar
bonnell committed
991
                        WORLD_READ             WORLD_EXECUTE
992
            CONFIGURATIONS "" None Debug Release RelWithDebInfo MinSizeRel
993 994
        )
    ENDIF(VISIT_STATIC)
995 996 997 998
ENDMACRO(VISIT_INSTALL_TARGETS_RELATIVE)

MACRO(VISIT_INSTALL_TARGETS)
    VISIT_INSTALL_TARGETS_RELATIVE("" ${ARGN})
999 1000 1001
ENDMACRO(VISIT_INSTALL_TARGETS)

# Install the headers for directories that we need in order to build plugins
1002 1003 1004
IF(VISIT_HEADERS_SKIP_INSTALL)
    MESSAGE(STATUS "Skipping VisIt headers installation")
ELSE(VISIT_HEADERS_SKIP_INSTALL)
1005
    INSTALL(DIRECTORY avt common engine gui launcher mdserver third_party_builtin viewer visit_vtk visitpy vtkm vtkqt winutil
1006
        DESTINATION ${VISIT_INSTALLED_VERSION_INCLUDE}/visit
cyrush's avatar
cyrush committed
1007 1008
        FILE_PERMISSIONS OWNER_READ OWNER_WRITE
                         GROUP_READ GROUP_WRITE
1009
                         WORLD_READ
cyrush's avatar
cyrush committed
1010 1011
        DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                              GROUP_READ GROUP_WRITE GROUP_EXECUTE
1012
                              WORLD_READ             WORLD_EXECUTE
1013
        CONFIGURATIONS "" None Debug Release RelWithDebInfo MinSizeRel
1014 1015 1016 1017 1018 1019
        FILES_MATCHING PATTERN "*.h"
        PATTERN "*.hpp"
        PATTERN ".svn" EXCLUDE
        PATTERN "CMakeFiles" EXCLUDE
    )
ENDIF(VISIT_HEADERS_SKIP_INSTALL)
1020 1021 1022

#-----------------------------------------------------------------------------
# Detect packages here. We could probably write macros that we can include from
cyrush's avatar
cyrush committed
1023
# elsewhere for this.
1024 1025 1026 1027 1028 1029 1030
#-----------------------------------------------------------------------------
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
allens's avatar
allens committed
1031

1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
IF(VISIT_USE_X)
    INCLUDE(${CMAKE_ROOT}/Modules/FindX11.cmake)
    IF(NOT X11_X11_LIB)
        SET(VISIT_USE_X OFF)
        SET(HAVE_LIBX11 0)
    ELSE(NOT X11_X11_LIB)
        SET(HAVE_LIBX11 1)
    ENDIF(NOT X11_X11_LIB)
ELSE(VISIT_USE_X)
    SET(HAVE_LIBX11 0)
    SET(CMAKE_X_LIBS "" CACHE INTERNAL "X11 libs.")
    SET(CMAKE_X_CFLAGS "" CACHE INTERNAL "X11 extra flags.")
    SET(CMAKE_HAS_X 0 CACHE INTERNAL "Is X11 around.")
ENDIF(VISIT_USE_X)
1046 1047
INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)

1048 1049 1050 1051 1052 1053 1054 1055

# Configure Nektar++ support. 
# Do it before the other libraries like boost because many can depend on it.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindNektar++.cmake)
IF(NEKTAR++_FOUND)
    SET(HAVE_LIBNEKTAR++ 1)
ENDIF(NEKTAR++_FOUND)

1056 1057 1058 1059
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItDamaris.cmake)
IF(DAMARIS_FOUND)
    SET(HAVE_DAMARIS 1)
ENDIF(DAMARIS_FOUND)
1060

allens's avatar
allens committed
1061 1062 1063 1064 1065
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItBoost.cmake)
IF(BOOST_FOUND)
  SET(HAVE_BOOST 1)
ENDIF(BOOST_FOUND)

1066

cyrush's avatar
cyrush committed
1067
IF( (VISIT_PYTHON_SCRIPTING OR VISIT_PYTHON_FILTERS) AND NOT VISIT_DBIO_ONLY)
1068
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItPython.cmake)
cyrush's avatar
cyrush committed
1069
ENDIF((VISIT_PYTHON_SCRIPTING OR VISIT_PYTHON_FILTERS) AND NOT VISIT_DBIO_ONLY)
1070 1071 1072 1073

IF(VISIT_JAVA)
    INCLUDE(${CMAKE_ROOT}/Modules/FindJava.cmake)
    ENABLE_LANGUAGE(Java)
1074
    SET(VISIT_Java_FLAGS -source 1.4)
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
ENDIF(VISIT_JAVA)

CHECK_INCLUDE_FILES (fcntl.h     HAVE_FCNTL_H)
CHECK_INCLUDE_FILES (inttypes.h  HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (malloc.h    HAVE_MALLOC_H)
CHECK_INCLUDE_FILES (limits.h    HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (memory.h    HAVE_MEMORY_H)
CHECK_INCLUDE_FILES (stdint.h    HAVE_STDINT_H)
CHECK_INCLUDE_FILES (stdlib.h    HAVE_STDLIB_H)
CHECK_INCLUDE_FILES (strings.h   HAVE_STRINGS_H)
CHECK_INCLUDE_FILES (string.h    HAVE_STRING_H)
CHECK_INCLUDE_FILES (sys/time.h  HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES (sys/stat.h  HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (unistd.h    HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (zlib.h      HAVE_ZLIB_H)
CHECK_INCLUDE_FILES (stdbool.h   HAVE_STDBOOL_H)

1093 1094 1095 1096 1097 1098 1099 1100
# Configure Mesa support.
IF(NOT WIN32 AND VISIT_MESA_DIR AND NOT VISIT_DBIO_ONLY)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItMesa.cmake)
    IF(MESA_FOUND)
        SET(HAVE_OSMESA 1)
    ENDIF(MESA_FOUND)
ENDIF(NOT WIN32 AND VISIT_MESA_DIR AND NOT VISIT_DBIO_ONLY)

1101
# Configure OpenGL support.
miller86's avatar
miller86 committed
1102
IF(NOT VISIT_DBIO_ONLY)
1103 1104 1105 1106
    IF(VISIT_OPENGL_DIR)
        SET(OPENGL_FOUND ON)
        SET(OPENGL_GLU_FOUND ON)
        SET(OPENGL_INCLUDE_DIR ${VISIT_OPENGL_DIR}/include)
whitlocb's avatar
whitlocb committed
1107 1108
        # Hack for BG/Q.
        IF(BLUEGENEQ)
1109
            SET(LIBGL OSMesa)
whitlocb's avatar
whitlocb committed
1110
        ELSE(BLUEGENEQ)
1111
            SET(LIBGL GL)
whitlocb's avatar
whitlocb committed
1112
        ENDIF(BLUEGENEQ)
1113
        IF(VISIT_STATIC)
1114
            SET(OPENGL_gl_LIBRARY ${VISIT_OPENGL_DIR}/lib/lib${LIBGL}.a)
1115 1116
            SET(OPENGL_glu_LIBRARY ${VISIT_OPENGL_DIR}/lib/libGLU.a)
        ELSE(VISIT_STATIC)
1117
            SET(OPENGL_gl_LIBRARY ${VISIT_OPENGL_DIR}/lib/lib${LIBGL}.so)
1118 1119 1120 1121 1122 1123 1124
            SET(OPENGL_glu_LIBRARY ${VISIT_OPENGL_DIR}/lib/libGLU.so)
        ENDIF(VISIT_STATIC)
        SET(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
        MESSAGE(STATUS "Found OpenGL ${OPENGL_gl_LIBRARY}")
    ELSE(VISIT_OPENGL_DIR)
        INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
    ENDIF(VISIT_OPENGL_DIR)
miller86's avatar
miller86 committed
1125
ENDIF(NOT VISIT_DBIO_ONLY)
1126

1127 1128 1129 1130 1131
IF(VISIT_R_DIR)
    # Configure R support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindR.cmake)
ENDIF(VISIT_R_DIR)

1132 1133 1134
# Configure VTK support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItVTK.cmake)

camp's avatar
camp committed
1135 1136 1137 1138
# Enable thread build of VisIt
IF(VISIT_THREAD)
    ADD_DEFINITIONS(-DVISIT_ATOMIC_USE_GCC_ATOMIC)
    ADD_DEFINITIONS(-DVISIT_THREADS)
1139 1140 1141 1142 1143

    IF(APPLE)
        ADD_DEFINITIONS(-DTURN_OFF_THREAD_SET_AFFINITY)
    ENDIF(APPLE)

camp's avatar
camp committed
1144 1145 1146 1147 1148
    MESSAGE(STATUS "Threading for VisIt: ON")
ELSE(VISIT_THREAD)
    MESSAGE(STATUS "Threading for VisIt: OFF")
ENDIF(VISIT_THREAD)

1149 1150 1151 1152 1153 1154 1155
IF(VISIT_OSPRAY)
    ADD_DEFINITIONS(-DVISIT_OSPRAY)
    MESSAGE(STATUS "OSPRAY for VisIt: ON")
ELSE(VISIT_OSPRAY)
    MESSAGE(STATUS "OSPRAY for VisIt: OFF")
ENDIF(VISIT_OSPRAY)

1156 1157 1158 1159 1160
#-----------------------------------------------------------------------------
# If we are doing a static build or the VTK Python wrappers do not exist:
#   Disable python filters.
#-----------------------------------------------------------------------------

1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174
# If we did not find Python then turn off VISIT_PYTHON_SCRIPTING
IF(VISIT_PYTHON_SCRIPTING AND NOT PYTHONLIBS_FOUND)
    SET(VISIT_PYTHON_SCRIPTING OFF)
    MESSAGE(STATUS "Python scripting disabled because Python was not found.")
ENDIF(VISIT_PYTHON_SCRIPTING AND NOT PYTHONLIBS_FOUND)

# Disable Python scripting if we're doing a static build for engine-only or server-components-only.
IF(VISIT_PYTHON_SCRIPTING AND VISIT_STATIC)
    IF(VISIT_ENGINE_ONLY OR VISIT_SERVER_COMPONENTS_ONLY)
        SET(VISIT_PYTHON_SCRIPTING OFF)
        MESSAGE(STATUS "Python scripting disabled because an engine-only or server-components-only build was selected.")
    ENDIF(VISIT_ENGINE_ONLY OR VISIT_SERVER_COMPONENTS_ONLY)
ENDIF(VISIT_PYTHON_SCRIPTING AND VISIT_STATIC)

1175 1176 1177 1178 1179 1180
# Disable Python filters if we don't have Python.
IF(VISIT_PYTHON_FILTERS AND NOT PYTHONLIBS_FOUND)
    SET(VISIT_PYTHON_FILTERS OFF)
    MESSAGE(STATUS "Python Engine Filters disabled because Python was not found.")
ENDIF(VISIT_PYTHON_FILTERS AND NOT PYTHONLIBS_FOUND)

1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192
# VTK Python's wrappers are not available with a static build of VTK.
IF(VISIT_PYTHON_FILTERS AND VISIT_STATIC)
    SET(VISIT_PYTHON_FILTERS OFF)
    MESSAGE(STATUS "Python Engine Filters disabled because a static build of VisIt was selected.")
ENDIF(VISIT_PYTHON_FILTERS AND VISIT_STATIC)

# Disable python filters if the VTK Python's wrappers are not found.
IF(VISIT_PYTHON_FILTERS AND NOT VTK_PYTHON_WRAPPERS_FOUND)
    SET(VISIT_PYTHON_FILTERS OFF)
    MESSAGE(STATUS "Python Engine Filters disabled because VTK python wrappers are not installed.")
ENDIF(VISIT_PYTHON_FILTERS AND NOT VTK_PYTHON_WRAPPERS_FOUND)

1193 1194 1195 1196 1197 1198 1199
# Disable python filters if 'VISIT_NOLINK_MPI_WITH_LIBRARIES' is true.
# The mpicom python module (a shared lib) must be linked to mpi.
IF(VISIT_PYTHON_FILTERS AND VISIT_NOLINK_MPI_WITH_LIBRARIES)
    SET(VISIT_PYTHON_FILTERS OFF)
    MESSAGE(STATUS "Python Engine Filters disabled because VISIT_NOLINK_MPI_WITH_LIBRARIES was selected.")
ENDIF(VISIT_PYTHON_FILTERS AND VISIT_NOLINK_MPI_WITH_LIBRARIES)

miller86's avatar
miller86 committed
1200 1201 1202 1203 1204
IF(VISIT_PYTHON_FILTERS AND VISIT_DBIO_ONLY)
    SET(VISIT_PYTHON_FILTERS OFF)
    MESSAGE(STATUS "Python Engine Filters disabled because VISIT_DBIO_ONLY was selected.")
ENDIF(VISIT_PYTHON_FILTERS AND VISIT_DBIO_ONLY)

1205
# Configure Qt4 support.
1206
IF(NOT VISIT_DBIO_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_SERVER_COMPONENTS_ONLY)
hkrishna's avatar
hkrishna committed
1207
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItQt.cmake)
1208
ENDIF(NOT VISIT_DBIO_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_SERVER_COMPONENTS_ONLY)
1209

cyrush's avatar
cyrush committed
1210
# Configure PySide Support
hkrishna's avatar
hkrishna committed
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
# But not for Qt5 yet..
IF(NOT DEFINED VISIT_QT5)
    IF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND
                              AND NOT VISIT_DBIO_ONLY
                              AND NOT VISIT_ENGINE_ONLY
                              AND NOT VISIT_SERVER_COMPONENTS_ONLY)
        INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindPySide.cmake)
        IF(PYSIDE_FOUND)
            SET(HAVE_PYSIDE 1)
        ENDIF(PYSIDE_FOUND)
    ENDIF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND
                                 AND NOT VISIT_DBIO_ONLY
                                 AND NOT VISIT_ENGINE_ONLY
                                 AND NOT VISIT_SERVER_COMPONENTS_ONLY)
ENDIF(NOT DEFINED VISIT_QT5)
cyrush's avatar
cyrush committed
1226

1227
# Treat GLEW as a 3rd party builtin.
1228 1229 1230 1231 1232 1233 1234 1235 1236
IF(VISIT_USE_GLEW)
    SET(GLEW_FOUND 1)
    ADD_DEFINITIONS(-DHAVE_LIBGLEW)
    SET(GLEW_INCLUDE_DIR ${VISIT_SOURCE_DIR}/third_party_builtin/glew/glew/include)
    SET(GLEW_LIBRARY_DIR ${VISIT_SOURCE_DIR}/lib)
    SET(GLEW_LIB visitGLEW)
ELSE(VISIT_USE_GLEW)
    # We're not using GLEW but we need to substitute GL
    SET(GLEW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
bonnell's avatar
bonnell committed
1237
    VISIT_OPTION_DEFAULT(VISIT_SLIVR false TYPE BOOL)
1238
ENDIF(VISIT_USE_GLEW)
1239 1240 1241 1242 1243 1244

# Set up the tuvok library if it was enabled.
IF(VISIT_TUVOK)
    SET(TUVOK_LIB tuvok ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} GLEW)
ENDIF(VISIT_TUVOK)

1245 1246 1247
# Set up boost (interval) library
SET(HAVE_BILIB 1)

1248 1249
# Set up the SLIVR library if it was enabled.
IF(VISIT_SLIVR)
cyrush's avatar
cyrush committed
1250
    SET(SLIVR_INCLUDE_DIR
1251 1252 1253 1254 1255 1256 1257 1258
        ${VISIT_SOURCE_DIR}/third_party_builtin/slivr/teem-1.9.0-src/src
        ${VISIT_SOURCE_DIR}/third_party_builtin/slivr/teem-1.9.0-src/src/teem
        ${VISIT_SOURCE_DIR}/third_party_builtin/slivr
        ${VISIT_SOURCE_DIR}/third_party_builtin/slivr/slivr
    )
    SET(SLIVR_GUI_IMPL QvisCMap2Display.C QvisCMap2Widget.C)
    SET(SLIVR_GUI_HDR QvisCMap2Display.h QvisCMap2Widget.h)
    SET(SLIVR_LIB slivrG slivrV)
1259
    ADD_DEFINITIONS(-DHAVE_LIBSLIVR)
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269
ENDIF(VISIT_SLIVR)

# Include Ice-T support if we can.
IF(VISIT_PARALLEL)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindIceT.cmake)
ENDIF(VISIT_PARALLEL)

# Include TCMALLOC support if we can.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindTCMALLOC.cmake)

1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
# zlib
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindZlib.cmake)

# szip and jpeg
IF(WIN32)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindJPEG.cmake)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindSzip.cmake)
ENDIF(WIN32)

# dl and large file support.
1280 1281 1282 1283 1284
IF(CMAKE_HOST_UNIX)
  SET(DL_LIB dl)
  ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE)
ENDIF(CMAKE_HOST_UNIX)

1285
IF(NOT VISIT_BUILD_MINIMAL_PLUGINS OR VISIT_SELECTED_DATABASE_PLUGINS)
bonnell's avatar
bonnell committed
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328
    # Configure HDF5 support. 
    # Do it before the other libraries since many can depend on it.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindHDF5.cmake)
    IF(HDF5_FOUND)
        SET(HAVE_LIBHDF5 1)
    ENDIF(HDF5_FOUND)

    # Configure adios support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindADIOS.cmake)
    IF(ADIOS_FOUND)
        SET(HAVE_LIBADIOS 1)
    ENDIF(ADIOS_FOUND)

    # Configure advio support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindADVIO.cmake)
    IF(ADVIO_FOUND)
        SET(HAVE_LIBADVIO 1)
    ENDIF(ADVIO_FOUND)

    # Configure Boxlib support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindBoxlib.cmake)
    IF(BOXLIB_FOUND)
        SET(HAVE_LIBBOXLIB 1)
    ENDIF(BOXLIB_FOUND)

    # Configure ccmio support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindCCMIO.cmake)
    IF(CCMIO_FOUND)
        SET(HAVE_LIBCCMIO 1)
    ENDIF(CCMIO_FOUND)

    # Configure cfitsio support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindCFITSIO.cmake)
    IF(CFITSIO_FOUND)
        SET(HAVE_LIBCFITSIO 1)
    ENDIF(CFITSIO_FOUND)

    # Configure CGNS support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindCGNS.cmake)
    IF(CGNS_FOUND)
        SET(HAVE_LIBCGNS 1)
    ENDIF(CGNS_FOUND)

cyrush's avatar
cyrush committed
1329 1330
    # Configure eavl support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindEAVL.cmake)
1331 1332 1333
    IF(EAVL_FOUND)
        SET(HAVE_LIBEAVL 1)
    ENDIF(EAVL_FOUND)
cyrush's avatar
cyrush committed
1334

bonnell's avatar
bonnell committed
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357
    # Configure Fastbit support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindFastBit.cmake)
    IF(FASTBIT_FOUND)
        SET(HAVE_LIBFASTBIT 1)
    ENDIF(FASTBIT_FOUND)

    # Configure gdal support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindGDAL.cmake)
    IF(GDAL_FOUND)
        SET(HAVE_LIBGDAL 1)
    ENDIF(GDAL_FOUND)

    # Configure HDF4 support.
    IF(VISIT_STATIC)
      # There's a problem including HDF4 and Netcdf in the same executable due
      # to some netcdf-like symbols in libmfhdf
      MESSAGE(STATUS "HDF4 disabled for static builds due to collision with NetCDF.")
    ELSE(VISIT_STATIC)
      INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindHDF4.cmake)
      IF(HDF4_FOUND)
          SET(HAVE_LIBHDF4 1)
      ENDIF(HDF4_FOUND)
    ENDIF(VISIT_STATIC)
1358

bonnell's avatar
bonnell committed
1359 1360 1361 1362 1363 1364 1365 1366 1367
    # Configure h5part support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindH5Part.cmake)
    IF(H5PART_FOUND)
        SET(HAVE_LIBH5PART 1)
    ENDIF(H5PART_FOUND)

    # Configure ITAPS support -- it's treated specially.
    CONFIGURE_ITAPS()

1368 1369 1370
    # Configure mfem support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindMFEM.cmake)
    IF(MFEM_FOUND)
1371
        SET(HAVE_LIBMFEM 1)
1372 1373
    ENDIF(MFEM_FOUND)

bonnell's avatar
bonnell committed
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
    # Configure Mili support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindMili.cmake)
    IF(MILI_FOUND)
        SET(HAVE_LIBMILI 1)
    ENDIF(MILI_FOUND)

    # Configure netcdf support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindNetcdf.cmake)
    IF(NETCDF_FOUND)
        SET(HAVE_LIBNETCDF 1)
    ENDIF(NETCDF_FOUND)

    # Configure Silo support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindSilo.cmake)
    IF(SILO_FOUND)
        SET(HAVE_LIBSILO 1)
    ENDIF(SILO_FOUND)

    # Configure Xdmf support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindXdmf.cmake)
    IF(XDMF_FOUND)
        SET(HAVE_LIBXDMF 1)
    ENDIF(XDMF_FOUND)

    # Configure MDSplus support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindMDSplus.cmake)
    IF(MDSPLUS_FOUND)
        SET(HAVE_LIBMDSPLUS 1)
    ENDIF(MDSPLUS_FOUND)
1403 1404 1405 1406 1407 1408

    # Configure Uintah support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindUintah.cmake)
    IF(UINTAH_FOUND)
        SET(HAVE_LIBUINTAH 1)
    ENDIF(UINTAH_FOUND)
1409

1410 1411 1412 1413 1414 1415
    # Configure Visus support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisus.cmake)
    IF(VISUS_FOUND)
        SET(HAVE_LIBVISUS 1)
    ENDIF(VISUS_FOUND)

1416 1417 1418 1419 1420 1421
    # Configure VTKm support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVTKm.cmake)
    IF(VTKM_FOUND)
        SET(HAVE_LIBVTKM 1)
    ENDIF(VTKM_FOUND)

1422 1423 1424 1425 1426
    # Configure GFortran support.
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindGFortran.cmake)
    IF(GFORTRAN_FOUND)
        SET(HAVE_LIBGFORTRAN 1)
    ENDIF(GFORTRAN_FOUND)
1427
ENDIF()
1428 1429 1430 1431 1432 1433

# Configure Manta support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindManta.cmake)
IF(MANTA_FOUND)
    SET(HAVE_LIBMANTA 1)
ENDIF(MANTA_FOUND)
1434

1435

1436
IF (WIN32 AND VISIT_MAKE_NSIS_INSTALLER)
1437
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindNSIS.cmake)
1438
ENDIF (WIN32 AND VISIT_MAKE_NSIS_INSTALLER)
1439

1440 1441 1442 1443 1444

IF(VISIT_STATIC)
    SET(BUILD_SHARED_LIBS 0)
ENDIF(VISIT_STATIC)

1445 1446 1447 1448
IF(VISIT_FORTRAN)
    ENABLE_LANGUAGE(Fortran)
ENDIF(VISIT_FORTRAN)

1449
FUNCTION(DETECT_MPI_SETTINGS COMP mlibs mflags mlflags mrpath)
1450 1451 1452 1453 1454 1455 1456 1457 1458 1459
    # Unset any variables that may have been set before by FindMPI
    UNSET(MPI_FOUND CACHE)
    UNSET(MPI_INCLUDE_PATH CACHE)
    UNSET(MPI_LIB CACHE)
    UNSET(MPI_COMPILE_FLAGS CACHE)
    UNSET(MPI_LIBRARIES CACHE)
    UNSET(MPI_LIBRARY CACHE)
    UNSET(MPI_EXTRA_LIBRARY CACHE)
    UNSET(MPI_LINK_FLAGS CACHE)
    UNSET(MPI_COMPILER CACHE)
1460
    UNSET(MPI_RPATH CACHE)
1461 1462 1463 1464 1465 1466 1467 1468 1469

    # Set the compiler and call FindMPI
    SET(MPI_COMPILER ${COMP})
    INCLUDE(${CMAKE_ROOT}/Modules/FindMPI.cmake)

    # Return the values
    IF(NOT MPI_FOUND)
        MESSAGE(FATAL_ERROR  "Failed to setup MPI using compiler wrapper: ${COMP}")
    ELSE(NOT MPI_FOUND)
1470 1471 1472 1473 1474 1475
        # Take the MPI include path and split it into -I's
        SET(MPI_INCLUDE_PATH_CONV "")
        FOREACH(I ${MPI_INCLUDE_PATH})
            SET(MPI_INCLUDE_PATH_CONV "${MPI_INCLUDE_PATH_CONV} -I${I}")
        ENDFOREACH(I)

1476
        SET(${mlibs}   ${MPI_LIBRARIES} CACHE STRING "MPI libraries")
1477
        SET(${mflags}  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK ${MPI_INCLUDE_PATH_CONV} ${MPI_COMPILE_FLAGS}" CACHE STRING "Parallel compiler flags")
1478
        SET(${mlflags} "${MPI_LINK_FLAGS}" CACHE STRING "Parallel linker flags")
1479 1480 1481 1482 1483

        #
        # Detect all mpi library paths, we need these to keep the RPATH intact
        # for installs that link to MPI.
        #
1484 1485 1486 1487
        SET(MPI_RPATH "")
        FOREACH(MLIB ${MPI_LIBRARIES})
            GET_FILENAME_COMPONENT(MLIB_PATH ${MLIB} PATH)
            # make sure it is not an implicit path - we need to skip these
loring's avatar
loring committed
1488 1489
            LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${MLIB_PATH}" pidx)
            IF("${pidx}" EQUAL -1)
1490
                LIST(APPEND MPI_RPATH ${MLIB_PATH})
loring's avatar
loring committed
1491
            ENDIF()
1492 1493 1494
        ENDFOREACH(MLIB ${MPI_LIBRARIES})
        LIST(REMOVE_DUPLICATES MPI_RPATH)
        SET(${mrpath} "${MPI_RPATH}<