CMakeLists.txt 74.1 KB
Newer Older
1
2
#*****************************************************************************
#
3
# Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
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
# Produced at the Lawrence Livermore National Laboratory
# LLNL-CODE-400142
# 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
51
52
#
#   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
#   of off64_t. In theory, we might need to set CMAKE_REQUIRED_INCLUDES 
#   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
73
74
75
#    Kathleen Bonnell, Wed Feb  3 11:28:41 PST 2010
#    Encapsulated VISIT_INSTALL_x_PLUGINS into one Macro that accepts a 
#    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
78
79
#
#    Kathleen Bonnell, Tue Feb 16 14:04:16 MST 2010
#    Removed conditional setting of VISIT_RENDERING_SIZE_LIMIT, in case 
#    initial configure pass was missing something. Install our zlib on windows.
80
#
cyrush's avatar
cyrush committed
81
82
83
#    Cyrus Harrison, Sun Feb 21 19:12:33 PST 2010
#    Added support for enable/disable of Python Engine Filters.
#
brugger's avatar
   
brugger committed
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.
#
91
92
93
#    Kathleen Bonnell, Wed Mar 17 10:06:44 MST 2010 
#    Change cmake minimum required to 2.8.0, to support FILE(COPY .
#
94
95
96
97
#    Kathleen Bonnell, Thu April 1 19:29:24 MST 2010 
#    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.
#
brugger's avatar
   
brugger committed
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.
#
bonnell's avatar
bonnell committed
121
122
123
#    Kathleen Bonnell, Tue May 11 13:01:44 MST 2010 
#    Set HAVE_SELECT to TRUE on windows. 
#
124
125
126
127
#    Kathleen Bonnell, Fri Jun 4 7:58:34 PDT 2010
#    Changed logic for finding SVN_REVISION so check is not performed on
#    any platform if not building from a working copy. 
#
brugger's avatar
   
brugger committed
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.
brugger's avatar
   
brugger committed
132
#
brugger's avatar
   
brugger committed
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
145
146
147
148
#
#    Kathleen Bonnell, Thu Aug 5 9:34:52 PDT 2010 
#    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.
#
152
153
#****************************************************************************/

154
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

IF (COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)
ENDIF (COMMAND cmake_policy)


# 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)


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

SITE_NAME(HOSTNAME)

176
177
178
179
180
181
182
#-----------------------------------------------------------------------------
# Add an option to not force cache for 3rd party
#----------------------------------------------------------------------------

OPTION(VISIT_OPTION_DEFAULT_NOFORCE
  "Do not force replacement in cache." OFF)

183
184
185
186
#-----------------------------------------------------------------------------
# Include this computer's config-site if one exists
#-----------------------------------------------------------------------------
FUNCTION(VISIT_OPTION_DEFAULT var)
187
188
189
190
191
192
193
194
195
196
  IF(VISIT_OPTION_DEFAULT_NOFORCE)
    # MESSAGE(STATUS "VISIT_OPTION_DEFAULT_NOFORCE is on.")
    IF(NOT ${var})
      MESSAGE(STATUS "Setting ${var}.")
      SET(${var} ${ARGN} CACHE PATH "${var} default value")
    ELSE()
      MESSAGE(STATUS "Not setting ${var}.")
    ENDIF()
  ELSE()
    # MESSAGE(STATUS "VISIT_OPTION_DEFAULT_NOFORCE is off.")
197
    SET(${var} ${ARGN} CACHE PATH "${var} default value" FORCE)
198
  ENDIF()
199
200
201
202
203
204
205
206
207
208
209
210
211
212
ENDFUNCTION(VISIT_OPTION_DEFAULT var)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/SetupITAPS.cmake)

IF (NOT WIN32)
  MESSAGE(STATUS "Trying to include config-site/${HOSTNAME}.cmake")
  INCLUDE(config-site/${HOSTNAME}.cmake OPTIONAL)
ENDIF (NOT WIN32)


#-----------------------------------------------------------------------------
# Set compiler from config-site
#-----------------------------------------------------------------------------
SET(CMAKE_C_COMPILER ${VISIT_C_COMPILER})
SET(CMAKE_CXX_COMPILER ${VISIT_CXX_COMPILER})
213
SET(CMAKE_Fortran_COMPILER ${VISIT_FORTRAN_COMPILER})
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

#-----------------------------------------------------------------------------
# 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)
  MESSAGE(STATUS "Trying to include config-site/windows.cmake")
  INCLUDE(config-site/windows.cmake)
244
  SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "VisIt builds with rpath set." FORCE)
bonnell's avatar
bonnell committed
245
  SET(VISIT_WIN_ICON_RESOURCE ${VISIT_WINDOWS_DIR}/resources/visitresources.rc)
246
247
248
249
250
251
ENDIF (WIN32)

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

252
253
254
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)
255

256
257
258
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)
259

260
261
262
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)
263

264
265
266
267

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})
268
269
270
271
272
273

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

274
275
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)
276
277
OPTION(VISIT_STATIC   "Build VisIt statically." OFF)
IF(VISIT_STATIC)
278
    ADD_DEFINITIONS(-DVISIT_STATIC -DGLEW_STATIC)
279
280
ENDIF(VISIT_STATIC)
OPTION(VISIT_PYTHON_SCRIPTING      "Build VisIt with Python scripting support." ON)
281
OPTION(VISIT_PYTHON_FILTERS        "Build VisIt with Python Engine Filter support." ON)
cyrush's avatar
cyrush committed
282

283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
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)
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)
# If we're doing DBIO_ONLY then compile all sources with this flag so we don't 
# 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)
298
OPTION(VISIT_NOLINK_MPI_WITH_LIBRARIES "Do not link MPI with VisIt's parallel shared libraries; just with executables" OFF)
299
OPTION(VISIT_CREATE_SOCKET_RELAY "Create a separate executable that forwards VisIt's socket connection between engine and component launcher" OFF)
300
OPTION(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH "Install rpath relative to executable location using \$ORIGIN tag" OFF)
301
302
OPTION(VISIT_FORTRAN "Enable compilation of Fortran example progams" OFF)
OPTION(VISIT_DATA_MANUAL_EXAMPLES "Build Getting Data Into VisIt examples" OFF)
303

304
305
OPTION(IGNORE_THIRD_PARTY_LIB_PROBLEMS "Ignore problems finding requested third party libraries")

306

307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
MACRO(VISIT_3RDPARTY_VAR vvar comment libvar)
    # Create a path variable 
    SET(${vvar} "${vvar}-NOTFOUND" CACHE PATH "${comment}")
    # If the variable is not set to NOTFOUND (this means that the user passed 
    # it on the cmake command line or defined it in a config-site) then we 
    # define libvar so our find routines can later use it.
    IF(NOT "${${vvar}}" STREQUAL "${vvar}-NOTFOUND")
        SET(${libvar} ${${vvar}})
    ENDIF(NOT "${${vvar}}" STREQUAL "${vvar}-NOTFOUND")
ENDMACRO(VISIT_3RDPARTY_VAR vvar comment libvar)

MACRO(VISIT_3RDPARTY_DEP vvar comment libvar)
    # Create a string variable 
    SET(${vvar} "${vvar}-NOTSET" CACHE STRING "${comment}")
    # If the var is not set to NOTSET (this means that the user passed it on 
322
323
    # the cmake command line or defined it in a config-site) then we define 
    # libvar so our find routines can later use it.
324
    IF(NOT "${${vvar}}" STREQUAL "${vvar}-NOTSET")
325
        SET(${libvar} ${${vvar}})
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
    ENDIF(NOT "${${vvar}}" STREQUAL "${vvar}-NOTSET")
ENDMACRO(VISIT_3RDPARTY_DEP vvar comment libvar)

# Define options that let us pick our standard libraries: VTK,Mesa,Qt,Python 
# and so on.
VISIT_3RDPARTY_VAR(VISIT_VTK_DIR    "Path containing the VTK library's bin and lib" VTK_DIR)
VISIT_3RDPARTY_VAR(VISIT_QT_BIN     "Path to the Qt library's bin (path containing qmake)" QT_BIN)
VISIT_3RDPARTY_VAR(VISIT_PYTHON_DIR "Path containing the Python library's include and lib" PYTHON_DIR)
VISIT_3RDPARTY_VAR(VISIT_MESA_DIR   "Path containing the Mesa library's include and lib" MESA_DIR)
VISIT_3RDPARTY_VAR(VISIT_ICET_DIR   "Path containing the Ice-T library's include and lib" ICET_DIR)
VISIT_3RDPARTY_VAR(VISIT_TCMALLOC_DIR   "Path containing the tcmalloc library's include and lib" TCMALLOC_DIR)

# Define the options that let us pick I/O library installation locations. When 
# 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.
341
342
343
344
345
#
# 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).
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
VISIT_3RDPARTY_VAR(VISIT_ADIOS_DIR     "Path containing the ADIOS library's include and lib" ADIOS_DIR)
VISIT_3RDPARTY_VAR(VISIT_ADVIO_DIR     "Path containing the AdvIO library's include and lib" ADVIO_DIR)
VISIT_3RDPARTY_VAR(VISIT_BOXLIB2D_DIR  "Path containing the Boxlib 2D library's include and lib" BOXLIB2D_DIR)
VISIT_3RDPARTY_VAR(VISIT_BOXLIB3D_DIR  "Path containing the Boxlib 3D library's include and lib" BOXLIB3D_DIR)
VISIT_3RDPARTY_VAR(VISIT_CCMIO_DIR     "Path containing the CCMIO library's include and lib" CCMIO_DIR)
VISIT_3RDPARTY_VAR(VISIT_CFITSIO_DIR   "Path containing the CFITSIO library's include and lib" CFITSIO_DIR)
VISIT_3RDPARTY_VAR(VISIT_CGNS_DIR      "Path containing the CGNS library's include and lib" CGNS_DIR)
VISIT_3RDPARTY_VAR(VISIT_EXODUSII_DIR  "Path containing the ExodusII library's include and lib" EXODUSII_DIR)
VISIT_3RDPARTY_VAR(VISIT_FASTBIT_DIR   "Path containing the Fastbit library's include and lib" FASTBIT_DIR)
VISIT_3RDPARTY_VAR(VISIT_GDAL_DIR      "Path containing the GDAL library's include and lib" GDAL_DIR)
VISIT_3RDPARTY_VAR(VISIT_HDF4_DIR      "Path containing the HDF4 library's include and lib" HDF4_DIR)
VISIT_3RDPARTY_DEP(VISIT_HDF4_LIBDEP   "HDF4 library dependencies" HDF4_LIBDEP)
VISIT_3RDPARTY_VAR(VISIT_HDF5_DIR      "Path containing the HDF5 library's include and lib" HDF5_DIR)
VISIT_3RDPARTY_DEP(VISIT_HDF5_LIBDEP   "HDF5 library dependencies" HDF5_LIBDEP)
VISIT_3RDPARTY_VAR(VISIT_H5PART_DIR    "Path containing the H5Part library's include and lib" H5PART_DIR)
VISIT_3RDPARTY_VAR(VISIT_MILI_DIR      "Path containing the Mili library's include and lib" MILI_DIR)
VISIT_3RDPARTY_VAR(VISIT_NETCDF_DIR    "Path containing the NETCDF library's include and lib" NETCDF_DIR)
VISIT_3RDPARTY_VAR(VISIT_SILO_DIR      "Path containing the Silo library's include and lib" SILO_DIR)
VISIT_3RDPARTY_DEP(VISIT_SILO_LIBDEP   "Silo library dependencies" SILO_LIBDEP)
VISIT_3RDPARTY_VAR(VISIT_VISUS_DIR     "Path containing the ViSUS library's include and lib" VISUS_DIR)
366
VISIT_3RDPARTY_VAR(VISIT_XDMF_DIR      "Path containing the Xdmf library's include and lib" XDMF_DIR)
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#-----------------------------------------------------------------------------
# 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)
381
382
383
384
    # override cmake's default of %Program Files% for CMAKE_INSTALL_PREFIX
    # if it wasn't specified via command line, 
    IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      IF( NOT APPENDED_VISIT_VERSION_TO_INSTALL_PATH)
bonnell's avatar
bonnell committed
385
        SET(CMAKE_INSTALL_PREFIX "${VISIT_BINARY_DIR}/VisIt ${VISIT_VERSION}" 
386
387
            CACHE PATH "Install path prefix, prepended onto install directories" FORCE)
        SET(APPENDED_VISIT_VERSION_TO_INSTALL_PATH TRUE CACHE INTERNAL "")
388
389
390
391
      ENDIF( NOT APPENDED_VISIT_VERSION_TO_INSTALL_PATH)
    ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

    # set up directories
392
    SET(VISIT_INSTALLED_VERSION ${CMAKE_INSTALL_PREFIX}
bonnell's avatar
bonnell committed
393
        CACHE PATH "VisIt install directory" FORCE)
394
395
396
397
398
399
400
401
402
403
    SET(VISIT_INSTALLED_VERSION_BIN ${CMAKE_INSTALL_PREFIX} 
        CACHE PATH "VisIt bin install directory" FORCE)
    SET(VISIT_INSTALLED_VERSION_LIB ${CMAKE_INSTALL_PREFIX}/lib 
        CACHE PATH "VisIt lib install directory" FORCE)
    SET(VISIT_INSTALLED_VERSION_INCLUDE ${CMAKE_INSTALL_PREFIX}/include 
        CACHE PATH "VisIt include install directory" FORCE)
    SET(VISIT_INSTALLED_VERSION_HELP ${CMAKE_INSTALL_PREFIX}/help 
        CACHE PATH "VisIt help install directory" FORCE)
    SET(VISIT_INSTALLED_VERSION_PLUGINS ${CMAKE_INSTALL_PREFIX} 
        CACHE PATH "VisIt plugins install directory" FORCE)
bonnell's avatar
bonnell committed
404
405
    SET(VISIT_INSTALLED_VERSION_ARCHIVES ${CMAKE_INSTALL_PREFIX}/lib 
        CACHE PATH "3rd party I/O archives install directory" FORCE)
406
407
408
ELSE(WIN32)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/DetermineVisItArchitecture.cmake)
    DETERMINE_VISIT_ARCHITECTURE(VISIT_INSTALL_PLATFORM)
409
410
411
412
413
414
415
416
417
418
419
420
421
422
    SET(VISIT_INSTALLED_VERSION ${VISIT_VERSION}/${VISIT_INSTALL_PLATFORM} 
        CACHE PATH "VisIt install directory")
    SET(VISIT_INSTALLED_VERSION_BIN ${VISIT_INSTALLED_VERSION}/bin 
        CACHE PATH "VisIt bin install directory")
    SET(VISIT_INSTALLED_VERSION_LIB ${VISIT_INSTALLED_VERSION}/lib 
        CACHE PATH "VisIt lib install directory")
    SET(VISIT_INSTALLED_VERSION_INCLUDE ${VISIT_INSTALLED_VERSION}/include 
        CACHE PATH "VisIt include install directory")
    SET(VISIT_INSTALLED_VERSION_HELP ${VISIT_INSTALLED_VERSION}/help 
        CACHE PATH "VisIt help install directory")
    SET(VISIT_INSTALLED_VERSION_PLUGINS ${VISIT_INSTALLED_VERSION}/plugins 
        CACHE PATH "VisIt plugins install directory")
    SET(VISIT_INSTALLED_VERSION_ARCHIVES ${VISIT_INSTALLED_VERSION}/archives 
        CACHE PATH "3rd party I/O archives install directory")
423
424
425
426
427

    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)
brugger's avatar
   
brugger committed
428
    #
brugger's avatar
   
brugger committed
429
430
431
432
433
434
435
436
437
438
439
440
441
    # 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.
brugger's avatar
   
brugger committed
442
    #
brugger's avatar
   
brugger committed
443
444
445
446
447
448
449
    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\")
    ")
450
451
452
453
454
455
ENDIF(WIN32)
MARK_AS_ADVANCED(
VISIT_INSTALLED_VERSION_BIN 
VISIT_INSTALLED_VERSION_LIB 
VISIT_INSTALLED_VERSION_HELP 
VISIT_INSTALLED_VERSION_PLUGINS
456
457
VISIT_INSTALLED_VERSION_ARCHIVES
VISIT_INSTALLED_VERSION_INCLUDE
458
459
460
461
462
463
464
465
466
467
468
469
470
)

MACRO(VISIT_INSTALL_TARGETS)
    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}
                    RUNTIME DESTINATION ${VISIT_INSTALLED_VERSION_BIN}
                    BUNDLE  DESTINATION ${VISIT_INSTALLED_VERSION_BIN}
                    LIBRARY DESTINATION ${VISIT_INSTALLED_VERSION_LIB}
                    ARCHIVE DESTINATION ${VISIT_INSTALLED_VERSION_ARCHIVES}
bonnell's avatar
bonnell committed
471
472
473
                    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                                GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                                WORLD_READ             WORLD_EXECUTE
474
                    CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
475
476
477
478
479
480
481
482
483
                )
            ENDIF(NOT ${pType} STREQUAL "STATIC_LIBRARY")
        ENDFOREACH(T)
    ELSE(VISIT_STATIC)
        INSTALL(TARGETS ${ARGN}
            RUNTIME DESTINATION ${VISIT_INSTALLED_VERSION_BIN}
            BUNDLE  DESTINATION ${VISIT_INSTALLED_VERSION_BIN}
            LIBRARY DESTINATION ${VISIT_INSTALLED_VERSION_LIB}
            ARCHIVE DESTINATION ${VISIT_INSTALLED_VERSION_ARCHIVES}
bonnell's avatar
bonnell committed
484
485
486
            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                        GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                        WORLD_READ             WORLD_EXECUTE
487
            CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
488
        )
489
490
491
492
493
494
495
        IF(APPLE)
            FOREACH(target ${ARGN})
                GET_TARGET_PROPERTY(type ${target} TYPE)
                IF(${type} STREQUAL "SHARED_LIBRARY")
                    SET(filename lib${target}.dylib)
                    INSTALL(CODE 
                        "EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
496
                             COMMAND /bin/sh ${VISIT_SOURCE_DIR}/CMake/osxfixup -lib \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${VISIT_INSTALLED_VERSION_LIB}/${filename}\"
497
498
499
500
501
502
503
504
505
506
507
508
                             OUTPUT_VARIABLE OSXOUT)
                         MESSAGE(STATUS \"\${OSXOUT}\")
                        ")
                ELSEIF(${type} STREQUAL "EXECUTABLE")
                    GET_TARGET_PROPERTY(filename ${target} OUTPUT_NAME)
                    IF(filename STREQUAL "filename-NOTFOUND")
                        SET(filename ${target})
                    ENDIF(filename STREQUAL "filename-NOTFOUND")
                    GET_TARGET_PROPERTY(bundle ${target} MACOSX_BUNDLE)
                    IF(${bundle} STREQUAL "ON")
                        INSTALL(CODE 
                            "EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
509
                                COMMAND /bin/sh ${VISIT_SOURCE_DIR}/CMake/osxfixup -bundle \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${VISIT_INSTALLED_VERSION_BIN}\" ${filename}
510
511
512
513
514
515
                                OUTPUT_VARIABLE OSXOUT)
                             MESSAGE(STATUS \"\${OSXOUT}\")
                            ")
                    ELSE(${bundle} STREQUAL "ON")
                        INSTALL(CODE 
                            "EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
516
                                COMMAND /bin/sh ${VISIT_SOURCE_DIR}/CMake/osxfixup -exe \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${VISIT_INSTALLED_VERSION_BIN}/${filename}\"
517
518
519
520
521
522
523
                                OUTPUT_VARIABLE OSXOUT)
                             MESSAGE(STATUS \"\${OSXOUT}\")
                            ")
                    ENDIF(${bundle} STREQUAL "ON")
                ENDIF(${type} STREQUAL "SHARED_LIBRARY")
            ENDFOREACH(target)
        ENDIF(APPLE)
524
525
526
    ENDIF(VISIT_STATIC)
ENDMACRO(VISIT_INSTALL_TARGETS)

527
MACRO(VISIT_INSTALL_PLUGINS type)
528
    IF(NOT VISIT_STATIC)
529
530
531
        IF(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH)
            SET_TARGET_PROPERTIES(${ARGN} PROPERTIES INSTALL_RPATH "$ORIGIN/../../lib")
        ENDIF(VISIT_RPATH_RELATIVE_TO_EXECUTABLE_PATH)
532
        IF(NOT WIN32)
533
534
535
            INSTALL(TARGETS ${ARGN}
                LIBRARY DESTINATION ${VISIT_INSTALLED_VERSION_PLUGINS}/${type}
                RUNTIME DESTINATION ${VISIT_INSTALLED_VERSION_PLUGINS}/${type}
bonnell's avatar
bonnell committed
536
537
538
                PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                            GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                            WORLD_READ             WORLD_EXECUTE
539
540
                CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
            )
541
542
543
544
545
        ELSE(NOT WIN32)
            # ${BUILD_TYPE} refers to the configuration option chosen (Release,
            # Debug, etc). It is a var that will be given a value during compile
            # not configure, so the dollar sign must be escaped in the string
            # below.  Then during install, ${BUILD_TYPE} will be expanded.
546
            FOREACH(target ${ARGN})
547
548
549
                # SET(filename "${VISIT_BINARY_DIR}/exe/\${BUILD_TYPE}/${type}/lib${target}.dll")
# JRC 21Jul2010: The files are built directly under exe
                SET(filename "${VISIT_BINARY_DIR}/exe/\${BUILD_TYPE}/lib${target}.dll")
550
                INSTALL(FILES ${filename}
551
552
                    DESTINATION ${VISIT_INSTALLED_VERSION_PLUGINS}/${type}
                    COMPONENT RUNTIME
bonnell's avatar
bonnell committed
553
554
555
                    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                                GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                                WORLD_READ             WORLD_EXECUTE
556
557
                    CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
                )
558
559
            ENDFOREACH(target)
        ENDIF(NOT WIN32)
560
561
562
563
564
        IF(APPLE)
            FOREACH(target ${ARGN})
                SET(filename lib${target}.dylib)
                INSTALL(CODE 
                    "EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
565
                         COMMAND /bin/sh ${VISIT_SOURCE_DIR}/CMake/osxfixup -lib \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${VISIT_INSTALLED_VERSION_PLUGINS}/${type}/${filename}\"
566
567
568
569
570
                         OUTPUT_VARIABLE OSXOUT)
                     MESSAGE(STATUS \"\${OSXOUT}\")
                    ")
            ENDFOREACH(target)
        ENDIF(APPLE)
571
    ENDIF(NOT VISIT_STATIC)
572
573
574
575
576
577
578
579
ENDMACRO(VISIT_INSTALL_PLUGINS)

MACRO(VISIT_INSTALL_DATABASE_PLUGINS)
    VISIT_INSTALL_PLUGINS(databases ${ARGN})
ENDMACRO(VISIT_INSTALL_DATABASE_PLUGINS)

MACRO(VISIT_INSTALL_OPERATOR_PLUGINS)
    VISIT_INSTALL_PLUGINS(operators ${ARGN})
580
581
582
ENDMACRO(VISIT_INSTALL_OPERATOR_PLUGINS)

MACRO(VISIT_INSTALL_PLOT_PLUGINS)
583
    VISIT_INSTALL_PLUGINS(plots ${ARGN})
584
585
586
587
588
ENDMACRO(VISIT_INSTALL_PLOT_PLUGINS)

# Install the headers for directories that we need in order to build plugins
INSTALL(DIRECTORY avt common engine gui launcher mdserver third_party_builtin viewer visit_vtk visitpy vtkqt winutil
    DESTINATION ${VISIT_INSTALLED_VERSION_INCLUDE}/visit
bonnell's avatar
bonnell committed
589
590
591
592
593
594
    FILE_PERMISSIONS OWNER_READ OWNER_WRITE 
                     GROUP_READ GROUP_WRITE 
                     WORLD_READ
    DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                          GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                          WORLD_READ             WORLD_EXECUTE
595
    CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
596
597
598
599
600
    FILES_MATCHING PATTERN "*.h"
    PATTERN ".svn" EXCLUDE
    PATTERN "CMakeFiles" EXCLUDE
)

601
602
603
604
605
606
MACRO(VISIT_PLUGIN_TARGET_PREFIX) 
    IF(WIN32)
        SET_TARGET_PROPERTIES(${ARGN} PROPERTIES PREFIX "../lib")
    ENDIF(WIN32)
ENDMACRO(VISIT_PLUGIN_TARGET_PREFIX)

607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
#-----------------------------------------------------------------------------
# Detect packages here. We could probably write macros that we can include from
# elsewhere for this. 
#-----------------------------------------------------------------------------
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)
INCLUDE(${CMAKE_ROOT}/Modules/FindX11.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)

IF(VISIT_PYTHON_SCRIPTING)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItPython.cmake)
ENDIF(VISIT_PYTHON_SCRIPTING)

IF(VISIT_JAVA)
    INCLUDE(${CMAKE_ROOT}/Modules/FindJava.cmake)

    ENABLE_LANGUAGE(Java)
    SET(CMAKE_Java_COMPILER ${JAVA_COMPILE})
    SET(CMAKE_Java_FLAGS -source 1.4)
    SET(CMAKE_Java_ARCHIVE ${JAVA_ARCHIVE})
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)

# Configure OpenGL support.
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)

652
653
654
# Configure Mesa support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItMesa.cmake)

655
656
657
# Configure VTK support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItVTK.cmake)

658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
#-----------------------------------------------------------------------------
# If we are doing a static build or the VTK Python wrappers do not exist:
#   Disable python filters.
#-----------------------------------------------------------------------------

# 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)

675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# Configure Qt4 support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItQt4.cmake)

# Treat GLEW as a 3rd party builtin for now
SET(GLEW_FOUND 1)
SET(HAVE_LIBGLEW 1)
SET(GLEW_INCLUDE_DIR ${VISIT_SOURCE_DIR}/third_party_builtin/glew/glew/include)
SET(GLEW_LIBRARY_DIR ${VISIT_SOURCE_DIR}/lib)
SET(GLEW_LIB GLEW)

# 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)

miller86's avatar
miller86 committed
690
691
# Set up boost (interval) library
SET(HAVE_BILIB 1)
692
693
694
SET(BOOST_INCLUDE_DIR ${VISIT_SOURCE_DIR}/third_party_builtin/bilib/boost_1_42_0    CACHE PATH "Path to boost lib")

 
miller86's avatar
miller86 committed
695

696
697
698
699
700
701
702
703
704
705
706
# Set up the SLIVR library if it was enabled.
IF(VISIT_SLIVR)
    SET(SLIVR_INCLUDE_DIR 
        ${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)
707
    ADD_DEFINITIONS(-DHAVE_LIBSLIVR)
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
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)

# 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(BOXLIB2D_FOUND)
    SET(HAVE_LIBBOXLIB2D 1)
ENDIF(BOXLIB2D_FOUND)
IF(BOXLIB3D_FOUND)
    SET(HAVE_LIBBOXLIB3D 1)
ENDIF(BOXLIB3D_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)

# 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.
770
IF(VISIT_STATIC)
771
772
  # There's a problem including HDF4 and Netcdf in the same executable due
  # to some netcdf-like symbols in libmfhdf
773
774
775
776
777
778
779
  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)
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825

# Configure HDF5 support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindHDF5.cmake)
IF(HDF5_FOUND)
    SET(HAVE_LIBHDF5 1)
ENDIF(HDF5_FOUND)

# 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()

# 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)

    # Configure ExodusII support (Depends on NETCDF)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindExodusII.cmake)
    IF(EXODUSII_FOUND)
        SET(HAVE_LIBEXODUSII 1)
    ENDIF(EXODUSII_FOUND)
ENDIF(NETCDF_FOUND)

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

# Configure ViSUS support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisus.cmake)
IF(VISUS_FOUND)
    SET(HAVE_LIBVISUS 1)
ENDIF(VISUS_FOUND)

826
827
828
829
830
831
# Configure Xdmf support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindXdmf.cmake)
IF(XDMF_FOUND)
    SET(HAVE_LIBXDMF 1)
ENDIF(XDMF_FOUND)

832
833
834
835

IF(CMAKE_HOST_UNIX)
  SET(ZLIB_LIB z)
  SET(DL_LIB dl)
836
  ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE)
837
838
ELSE(CMAKE_HOST_UNIX)
  IF(WIN32)
839
840
    SET(ZLIB_LIBRARY_DIR ${VISIT_WINDOWS_DIR}/ThirdParty/zlib/lib/${VISIT_MSVC_VERSION})
    IF(EXISTS ${ZLIB_LIBRARY_DIR}/zlib1.dll)
841
      SET(ZLIB_LIB ${ZLIB_LIBRARY_DIR}/zlib1.lib)
842
843
844
      EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy 
                      ${ZLIB_LIBRARY_DIR}/zlib1.dll
                      ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ThirdParty)
845
846
      INSTALL(FILES ${ZLIB_LIBRARY_DIR}/zlib1.dll
          DESTINATION ${VISIT_INSTALLED_VERSION_BIN}
bonnell's avatar
bonnell committed
847
848
849
          PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE 
                      GROUP_READ GROUP_WRITE GROUP_EXECUTE 
                      WORLD_READ             WORLD_EXECUTE
850
851
852
          CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel
          )

853
    ENDIF()
854
855
856
857
858
  ELSE(WIN32)
      SET(ZLIB_LIB vtkzlib)
  ENDIF(WIN32)
ENDIF(CMAKE_HOST_UNIX)

859
860
861
862
IF (WIN32)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindNSIS.cmake)
ENDIF (WIN32)

863
864
865
866
867

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

868
869
870
871
IF(VISIT_FORTRAN)
    ENABLE_LANGUAGE(Fortran)
ENDIF(VISIT_FORTRAN)

872
FUNCTION(DETECT_MPI_SETTINGS COMP mlibs mflags mlflags mrpath)
873
874
875
876
877
878
879
880
881
882
    # 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)
883
    UNSET(MPI_RPATH CACHE)
884
885
886
887
888
889
890
891
892

    # 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)
893
894
895
896
897
898
        # 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)

899
        SET(${mlibs}   ${MPI_LIBRARIES} CACHE STRING "MPI libraries")
brugger's avatar
   
brugger committed
900
        SET(${mflags}  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK ${MPI_INCLUDE_PATH_CONV} ${MPI_COMPILE_FLAGS}" CACHE STRING "Parallel compiler flags")
901
        SET(${mlflags} "${MPI_LINK_FLAGS}" CACHE STRING "Parallel linker flags")
902
903
904
905
906

        #
        # Detect all mpi library paths, we need these to keep the RPATH intact
        # for installs that link to MPI.
        #
907
908
909
910
911
912
913
914
915
916
917
        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
            LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${MLIB_PATH} pidx)
            IF(${pidx} EQUAL -1)
                LIST(APPEND MPI_RPATH ${MLIB_PATH})
            ENDIF(${pidx} EQUAL -1)
        ENDFOREACH(MLIB ${MPI_LIBRARIES})
        LIST(REMOVE_DUPLICATES MPI_RPATH)
        SET(${mrpath} "${MPI_RPATH}" CACHE STRING "Parallel rpath(s)")
918

919
920
921
    ENDIF(NOT MPI_FOUND)
ENDFUNCTION(DETECT_MPI_SETTINGS)

922
923
924
IF(VISIT_PARALLEL)
    IF(VISIT_MPI_COMPILER)
        MESSAGE(STATUS "Setting up MPI using compiler wrapper")
925
926

        # Detect the MPI settings that C++ wants
927
        DETECT_MPI_SETTINGS(${VISIT_MPI_COMPILER}
928
929
930
            VISIT_PARALLEL_LIBS
            VISIT_PARALLEL_CFLAGS
            VISIT_PARALLEL_LINKER_FLAGS
931
            VISIT_PARALLEL_RPATH
932
933
934
935
        )
        SET(VISIT_PARALLEL_CXXFLAGS ${VISIT_PARALLEL_CFLAGS} CACHE STRING "Parallel CXXFLAGS")

        # Detect the MPI settings that Fortran wants
936
        IF(VISIT_FORTRAN AND VISIT_MPI_FORTRAN_COMPILER)
937
938
939
940
            DETECT_MPI_SETTINGS(${VISIT_MPI_FORTRAN_COMPILER} 
                VISIT_PARALLEL_FORTRAN_LIBS
                VISIT_PARALLEL_FORTRAN_FLAGS
                VISIT_PARALLEL_FORTRAN_LINKER_FLAGS
whitlocb's avatar
whitlocb committed
941
                VISIT_PARALLEL_RPATH
942
            )
943
944
        ENDIF(VISIT_FORTRAN AND VISIT_MPI_FORTRAN_COMPILER)

945
946
    ELSE(VISIT_MPI_COMPILER)
        MESSAGE(STATUS "Setting up MPI using user defined flags")
947
        IF(VISIT_MPI_LIBS OR VISIT_MPI_FORTRAN_LIBS)
948
            SET(VISIT_PARALLEL_LIBS          ${VISIT_MPI_LIBS} CACHE STRING "MPI libraries")
949
950
            SET(VISIT_PARALLEL_FORTRAN_LIBS  ${VISIT_MPI_FORTRAN_LIBS} CACHE STRING "MPI libraries for Fortran")

951
            IF(VISIT_MPI_C_FLAGS)
brugger's avatar
   
brugger committed
952
                SET(VISIT_PARALLEL_CFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK ${VISIT_MPI_C_FLAGS}" CACHE STRING "Parallel CFLAGS")
953
            ELSE(VISIT_MPI_C_FLAGS)
brugger's avatar
   
brugger committed
954
                SET(VISIT_PARALLEL_CFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK" CACHE STRING "Parallel CFLAGS")
955
            ENDIF(VISIT_MPI_C_FLAGS)
956

957
            IF(VISIT_MPI_CXX_FLAGS)
brugger's avatar
   
brugger committed
958
                SET(VISIT_PARALLEL_CXXFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK ${VISIT_MPI_CXX_FLAGS}" CACHE STRING "Parallel CXXFLAGS")
959
            ELSE(VISIT_MPI_CXX_FLAGS)
brugger's avatar
   
brugger committed
960
                SET(VISIT_PARALLEL_CXXFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK" CACHE STRING "Parallel CXXFLAGS")
961
            ENDIF(VISIT_MPI_CXX_FLAGS)
962
963

            IF(VISIT_MPI_FORTRAN_FLAGS)
brugger's avatar
   
brugger committed
964
                SET(VISIT_PARALLEL_FORTRANFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK ${VISIT_MPI_FORTRAN_FLAGS}" CACHE STRING "Parallel Fortran flags")
965
            ELSE(VISIT_MPI_FORTRAN_FLAGS)
brugger's avatar
   
brugger committed
966
                SET(VISIT_PARALLEL_FORTRANFLAGS  "-DPARALLEL -DMPICH_IGNORE_CXX_SEEK" CACHE STRING "Parallel flags for Fortran")
967
968
            ENDIF(VISIT_MPI_FORTRAN_FLAGS)

969
970
971
972
973
            IF(VISIT_MPI_LD_FLAGS)
                SET(VISIT_PARALLEL_LINKER_FLAGS "${VISIT_MPI_LD_FLAGS}" CACHE STRING "Parallel LDFLAGS")
            ELSE(VISIT_MPI_LD_FLAGS)
                SET(VISIT_PARALLEL_LINKER_FLAGS "" CACHE STRING "Parallel LDFLAGS")
            ENDIF(VISIT_MPI_LD_FLAGS)
974
        ELSE(VISIT_MPI_LIBS OR VISIT_MPI_FORTRAN_LIBS)
975
976
            MESSAGE(FATAL_ERROR "To build parallel VisIt, you must at a minimum define VISIT_MPI_COMPILER or VISIT_MPI_LIBS.
                    You may also define VISIT_MPI_LD_FLAGS, VISIT_MPI_CXX_FLAGS." )
977
        ENDIF(VISIT_MPI_LIBS OR VISIT_MPI_FORTRAN_LIBS)
978
979
980
981
982
983
984
    ENDIF(VISIT_MPI_COMPILER)

    MESSAGE(STATUS "Parallel version of VisIt")
    MESSAGE(STATUS "    VISIT_PARALLEL_CFLAGS = ${VISIT_PARALLEL_CFLAGS}")
    MESSAGE(STATUS "    VISIT_PARALLEL_CXXFLAGS = ${VISIT_PARALLEL_CXXFLAGS}")
    MESSAGE(STATUS "    VISIT_PARALLEL_LINKER_FLAGS = ${VISIT_PARALLEL_LINKER_FLAGS}")
    MESSAGE(STATUS "    VISIT_PARALLEL_LIBS = ${VISIT_PARALLEL_LIBS}")
985
986
    MESSAGE(STATUS "    VISIT_PARALLEL_RPATH = ${VISIT_PARALLEL_RPATH}")

987
988
989
990
991
992
    IF(VISIT_FORTRAN AND VISIT_PARALLEL_FORTRAN_LIBS)
        MESSAGE(STATUS "")
        MESSAGE(STATUS "    VISIT_PARALLEL_FORTRAN_FLAGS = ${VISIT_PARALLEL_FORTRAN_FLAGS}")
        MESSAGE(STATUS "    VISIT_PARALLEL_FORTRAN_LINKER_FLAGS = ${VISIT_PARALLEL_FORTRAN_LINKER_FLAGS}")
        MESSAGE(STATUS "    VISIT_PARALLEL_FORTRAN_LIBS = ${VISIT_PARALLEL_FORTRAN_LIBS}")
    ENDIF(VISIT_FORTRAN AND VISIT_PARALLEL_FORTRAN_LIBS)
993
994
995
996
ELSE(VISIT_PARALLEL)
    MESSAGE(STATUS "Serial version of VisIt")
ENDIF(VISIT_PARALLEL)

997
998
FUNCTION(ADD_PARALLEL_EXECUTABLE target)
    ADD_EXECUTABLE(${target} ${ARGN})
999
1000
    IF(VISIT_PARALLEL_CXXFLAGS)
        SET(PAR_COMPILE_FLAGS "")
1001
        FOREACH(X ${VISIT_PARALLEL_CXXFLAGS})
1002
            SET(PAR_COMPILE_FLAGS "${PAR_COMPILE_FLAGS} ${X}")
1003
        ENDFOREACH(X)
1004
1005
1006
        SET_TARGET_PROPERTIES(${target} PROPERTIES
            COMPILE_FLAGS ${PAR_COMPILE_FLAGS}
        )
1007

1008
1009
        IF(VISIT_PARALLEL_LINKER_FLAGS)
            SET(PAR_LINK_FLAGS "")
1010
            FOREACH(X ${VISIT_PARALLEL_LINKER_FLAGS})
1011
                SET(PAR_LINK_FLAGS "${PAR_LINK_FLAGS} ${X}")
1012
            ENDFOREACH(X)
1013
1014
1015
1016
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                LINK_FLAGS ${PAR_LINK_FLAGS}
            )
        ENDIF(VISIT_PARALLEL_LINKER_FLAGS)
1017
1018
1019
1020
1021
1022
        # If we're on doing this "nolink mpi" option, we rely on the
        # PARALLEL_TARGET_LINK_LIBRARIES function to actually link the
        # target with MPI.
        IF(NOT VISIT_NOLINK_MPI_WITH_LIBRARIES) # This is a new if test
            TARGET_LINK_LIBRARIES(${target} ${VISIT_PARALLEL_LIBS})
        ENDIF(NOT VISIT_NOLINK_MPI_WITH_LIBRARIES)
1023
1024
1025
1026

        IF(VISIT_PARALLEL_RPATH)
            SET(PAR_RPATHS "")
            FOREACH(X ${CMAKE_INSTALL_RPATH})
brugger's avatar
   
brugger committed
1027
                SET(PAR_RPATHS "${PAR_RPATHS} ${X}")
1028
1029
            ENDFOREACH(X)
            FOREACH(X ${VISIT_PARALLEL_RPATH})
brugger's avatar
   
brugger committed
1030
                SET(PAR_RPATHS "${PAR_RPATHS} ${X}")
1031
1032
1033
1034
1035
            ENDFOREACH(X)
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                INSTALL_RPATH ${PAR_RPATHS}
            )
        ENDIF(VISIT_PARALLEL_RPATH)
1036
1037
1038
    ENDIF(VISIT_PARALLEL_CXXFLAGS)
ENDFUNCTION(ADD_PARALLEL_EXECUTABLE)

1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
FUNCTION(ADD_PARALLEL_FORTRAN_EXECUTABLE target)
    ADD_EXECUTABLE(${target} ${ARGN})
    IF(VISIT_PARALLEL_FORTRAN_FLAGS)
        SET(PAR_COMPILE_FLAGS "")
        FOREACH(X ${VISIT_PARALLEL_FORTRAN_FLAGS})
            SET(PAR_COMPILE_FLAGS "${PAR_COMPILE_FLAGS} ${X}")
        ENDFOREACH(X)
        SET_TARGET_PROPERTIES(${target} PROPERTIES
            COMPILE_FLAGS ${PAR_COMPILE_FLAGS}
        )
1049

1050
1051
1052
1053
1054
1055
1056
1057
        IF(VISIT_PARALLEL_FORTRAN_LINKER_FLAGS)
            SET(PAR_LINK_FLAGS "")
            FOREACH (X ${VISIT_PARALLEL_FORTRAN_LINKER_FLAGS})
                SET(PAR_LINK_FLAGS "${PAR_LINK_FLAGS} ${X}")
            ENDFOREACH (X)
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                LINK_FLAGS ${PAR_LINK_FLAGS}
            )
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
        IF(VISIT_PARALLEL_RPATH)
            SET(PAR_RPATHS "")
            FOREACH(X ${CMAKE_INSTALL_RPATH})
                LIST(APPEND PAR_RPATHS ${X})
            ENDFOREACH(X)
            FOREACH(X ${VISIT_PARALLEL_RPATH})
                LIST(APPEND PAR_RPATHS ${X})
            ENDFOREACH(X)
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                INSTALL_RPATH ${PAR_RPATHS}
            )
        ENDIF(VISIT_PARALLEL_RPATH)
1070
1071
1072
1073
1074
        ENDIF(VISIT_PARALLEL_FORTRAN_LINKER_FLAGS)
        TARGET_LINK_LIBRARIES(${target} ${VISIT_PARALLEL_FORTRAN_LIBS})
    ENDIF(VISIT_PARALLEL_FORTRAN_FLAGS)
ENDFUNCTION(ADD_PARALLEL_FORTRAN_EXECUTABLE)

1075
1076
1077
1078
1079
1080
1081
1082
FUNCTION(PARALLEL_EXECUTABLE_LINK_LIBRARIES target)
    IF(VISIT_NOLINK_MPI_WITH_LIBRARIES)
        TARGET_LINK_LIBRARIES(${target} ${ARGN} link_mpi_libs)
    ELSE(VISIT_NOLINK_MPI_WITH_LIBRARIES)
        TARGET_LINK_LIBRARIES(${target} ${ARGN})
    ENDIF(VISIT_NOLINK_MPI_WITH_LIBRARIES)
ENDFUNCTION(PARALLEL_EXECUTABLE_LINK_LIBRARIES)

1083
1084
FUNCTION(ADD_PARALLEL_LIBRARY target)
    ADD_LIBRARY(${target} ${ARGN})
1085
1086
1087
1088
    IF(VISIT_PARALLEL_CXXFLAGS)
        SET(PAR_COMPILE_FLAGS "")
        FOREACH (X ${VISIT_PARALLEL_CXXFLAGS})
            SET(PAR_COMPILE_FLAGS "${PAR_COMPILE_FLAGS} ${X}")
1089
        ENDFOREACH(X)
1090
1091
1092
1093
1094
        SET_TARGET_PROPERTIES(${target} PROPERTIES
            COMPILE_FLAGS ${PAR_COMPILE_FLAGS}
        )
        IF(VISIT_PARALLEL_LINKER_FLAGS)
            SET(PAR_LINK_FLAGS "")
1095
            FOREACH(X ${VISIT_PARALLEL_LINKER_FLAGS})
1096
                SET(PAR_LINK_FLAGS "${PAR_LINK_FLAGS} ${X}")
1097
            ENDFOREACH(X)
1098
1099
1100
1101
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                LINK_FLAGS ${PAR_LINK_FLAGS}
            )
        ENDIF(VISIT_PARALLEL_LINKER_FLAGS)
1102
1103
1104
1105

        IF(VISIT_PARALLEL_RPATH)
            SET(PAR_RPATHS "")
            FOREACH(X ${CMAKE_INSTALL_RPATH})
brugger's avatar
   
brugger committed
1106
                SET(PAR_RPATHS "${PAR_RPATHS} ${X}")
1107
1108
            ENDFOREACH(X)
            FOREACH(X ${VISIT_PARALLEL_RPATH})
brugger's avatar
   
brugger committed
1109
                SET(PAR_RPATHS "${PAR_RPATHS} ${X}")
1110
1111
1112
1113
1114
1115
            ENDFOREACH(X)
            SET_TARGET_PROPERTIES(${target} PROPERTIES
                INSTALL_RPATH ${PAR_RPATHS}
            )
        ENDIF(VISIT_PARALLEL_RPATH)

1116
1117
1118
        IF(NOT VISIT_NOLINK_MPI_WITH_LIBRARIES)
            TARGET_LINK_LIBRARIES(${target} ${VISIT_PARALLEL_LIBS})
        ENDIF(NOT VISIT_NOLINK_MPI_WITH_LIBRARIES)
1119
1120
1121
1122
1123
1124
    ENDIF(VISIT_PARALLEL_CXXFLAGS)
ENDFUNCTION(ADD_PARALLEL_LIBRARY)

# Set up easy to use includes for the common directory
SET(VISIT_COMMON_INCLUDES
    ${VISIT_BINARY_DIR}/include
1125
    ${VISIT_BINARY_DIR}/include/visit
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
    ${VISIT_SOURCE_DIR}/include
    ${VISIT_SOURCE_DIR}/common/Exceptions/Database
    ${VISIT_SOURCE_DIR}/common/Exceptions/Pipeline
    ${VISIT_SOURCE_DIR}/common/Exceptions/Plotter
    ${VISIT_SOURCE_DIR}/common/comm
    ${VISIT_SOURCE_DIR}/common/expr
    ${VISIT_SOURCE_DIR}/common/icons
    ${VISIT_SOURCE_DIR}/common/misc
    ${VISIT_SOURCE_DIR}/common/parser
    ${VISIT_SOURCE_DIR}/common/plugin
    ${VISIT_SOURCE_DIR}/common/proxybase
    ${VISIT_SOURCE_DIR}/common/state
    ${VISIT_SOURCE_DIR}/common/utility
    ${VISIT_SOURCE_DIR}/common/common/misc
    ${VISIT_SOURCE_DIR}/common/common/plugin
    ${VISIT_SOURCE_DIR}/common/common/state
    ${VISIT_SOURCE_DIR}/common/common/utility
    )


# Override the OPENGL_glu_LIBRARY returned by CMake on the Mac because the
# AGL framework does NOT contain gluTess functions. We want to instead use
# Mesa's GLU functions.
IF(APPLE)
1150
    SET(OPENGL_glu_LIBRARY ${MESA_LIBRARY_DIR}/libMesaGLU.dylib CACHE INTERNAL "AGL lib for OSX")   
1151
1152
ENDIF(APPLE)

1153
1154
1155
1156
1157
1158
1159
# We use libGLU for its tessellation abilities but it requires libGL sometimes.
IF(UNIX AND NOT APPLE)
    SET(TESSELLATION_LIBRARY ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
ELSE(UNIX AND NOT APPLE)
    SET(TESSELLATION_LIBRARY ${OPENGL_glu_LIBRARY})
ENDIF(UNIX AND NOT APPLE)

1160
1161
1162
# Windows-specific settings
IF (WIN32)
  ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
1163
1164
  # we want GTE 1400
  IF (MSVC_VERSION GREATER 1399)
1165
1166
1167
      ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
      ADD_DEFINITIONS(-D_SCL_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
      ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
1168
  ENDIF (MSVC_VERSION GREATER 1399)
1169
1170
1171

  # cmake automatically uses _DEBUG and MDd for Debug flags, but our
  # third-party libs are NOT debug versions, so we won't be able to
bonnell's avatar
bonnell committed
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
  # link against them if those defines are used.  Replace those flags:
  # When we allow users to supply their own third-party libs, then
  # this will have to be rethought -- they may want to be able to c
  # change them and this currently forces.

  MACRO(REPLACE_FLAG OLD_FLAG NEW_FLAG FLAG_TYPE FLAG_STRING)
      STRING(REPLACE "${OLD_FLAG}" "${NEW_FLAG}" TMP "${${FLAG_TYPE}}")
      SET(${FLAG_TYPE} "${TMP}" CACHE STRING "${FLAG_STRING}" FORCE)
  ENDMACRO(REPLACE_FLAG)

  # Remove /_DEBUG From debug builds
  REPLACE_FLAG("/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG 
               "Flags used by the compiler during debug builds")
  REPLACE_FLAG("/D_DEBUG" "" CMAKE_C_FLAGS_DEBUG 
               "Flags used by the compiler during debug builds")
  REPLACE_FLAG("/D_DEBUG" "" CMAKE_EXE_LINKER_FLAGS_DEBUG 
               "Flags used by the linker during debug builds")
  REPLACE_FLAG("/D_DEBUG" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG 
               "Flags used by the linker during debug builds")
  # Change /MDd to /MD for debug builds
  REPLACE_FLAG("/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG 
               "Flags used by the compiler during debug builds")
  REPLACE_FLAG("/MDd" "/MD" CMAKE_C_FLAGS_DEBUG 
               "Flags used by the compiler during debug builds")
  REPLACE_FLAG("/MDd" "/MD" CMAKE_EXE_LINKER_FLAGS_DEBUG 
               "Flags used by the linker during debug builds")
  REPLACE_FLAG("/MDd" "/MD" CMAKE_MODULE_LINKER_FLAGS_DEBUG 
               "Flags used by the linker during debug builds")

  # Change /Zi to /ZI for CXX flags
  REPLACE_FLAG("/Zi" "/ZI" CMAKE_CXX_FLAGS_DEBUG 
               "Flags used by the compiler during debug builds")

  # Remove /machine:I386 from linker flags
  REPLACE_FLAG("/machine:I386" "" CMAKE_EXE_LINKER_FLAGS
               "Flags used by the linker")
  REPLACE_FLAG("/machine:I386" "" CMAKE_MODULE_LINKER_FLAGS
               "Flags used by the linker during creation of modules.")
  REPLACE_FLAG("/machine:I386" "" CMAKE_SHARED_LINKER_FLAGS
               "Flags used by the linker during creation of dll's.")
1212
1213
1214
1215
1216
1217
1218
1219
ENDIF (WIN32)

#-----------------------------------------------------------------------------
# Read the SVN revision
#-----------------------------------------------------------------------------
#dummy revision, in case commands fail
SET(VISIT_SVN_REVISION "Unknown") 
# Get the subversion revision number
brugger's avatar
   
brugger committed
1220
1221
1222
IF(EXISTS SVN_REVISION)
    FILE(STRINGS SVN_REVISION VISIT_SVN_REVISION)
ELSE(EXISTS SVN_REVISION)
1223
1224
1225
1226
1227
    IF (EXISTS ${VISIT_SOURCE_DIR}/.svn)
        # Only try and determine the version number if it looks like
        # we're in a working copy (a .svn directory should be present)
        FIND_PACKAGE(Subversion)
        IF(Subversion_FOUND)
brugger's avatar
   
brugger committed
1228
1229
            Subversion_WC_INFO(${PROJECT_SOURCE_DIR} VISIT)
            SET(VISIT_SVN_REVISION "${VISIT_WC_REVISION}")
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
        ELSE(Subversion_FOUND)
            IF(WIN32)
                INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindTortoiseSVN.cmake)
                IF(TortoiseSVN_FOUND)
                    TortoiseSVN_WC_INFO(${PROJECT_SOURCE_DIR} VISIT)
                    SET(VISIT_SVN_REVISION "${VISIT_WC_REVISION}")
                ENDIF(TortoiseSVN_FOUND)
            ENDIF(WIN32)
        ENDIF(Subversion_FOUND)
    ENDIF (EXISTS ${VISIT_SOURCE_DIR}/.svn)
brugger's avatar
   
brugger committed
1240
ENDIF(EXISTS SVN_REVISION)
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255

#-----------------------------------------------------------------------------
# Create visit-config.h
#-----------------------------------------------------------------------------

# Set the slash characters based on the platform
IF(WIN32)
    SET(VISIT_SLASH_CHAR   "'\\\\'")
    SET(VISIT_SLASH_STRING "\"\\\\\"")
ELSE(WIN32)
    SET(VISIT_SLASH_CHAR   "'/'")
    SET(VISIT_SLASH_STRING "\"/\"")
ENDIF(WIN32)

# Check for plugin extension
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
IF(VISIT_STATIC)
    SET(VISIT_PLUGIN_EXTENSION   ".a")
ELSE(VISIT_STATIC)
    IF(WIN32)
        SET(VISIT_PLUGIN_EXTENSION   ".dll")
    ELSE(WIN32)
        IF(APPLE)
            SET(VISIT_PLUGIN_EXTENSION   ".dylib")
        ELSE(APPLE)
            SET(VISIT_PLUGIN_EXTENSION   ".so")
        ENDIF(APPLE)
    ENDIF(WIN32)
ENDIF(VISIT_STATIC)
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286

# Check for type sizes, endian
SET(SIZEOF_BOOLEAN              ${CMAKE_SIZEOF_BOOLEAN})
SET(SIZEOF_CHAR                 ${CMAKE_SIZEOF_CHAR})
SET(SIZEOF_DOUBLE               ${CMAKE_SIZEOF_DOUBLE})
SET(SIZEOF_FLOAT                ${CMAKE_SIZEOF_FLOAT})
SET(SIZEOF_INT                  ${CMAKE_SIZEOF_INT})
SET(SIZEOF_LONG                 ${CMAKE_SIZEOF_LONG})
SET(SIZEOF_LONG_DOUBLE          ${CMAKE_SIZEOF_LONG_DOUBLE})
SET(SIZEOF_LONG_FLOAT           ${CMAKE_SIZEOF_LONG_FLOAT})
SET(SIZEOF_LONG_LONG            ${CMAKE_SIZEOF_LONG_LONG})
SET(SIZEOF_SHORT                ${CMAKE_SIZEOF_SHORT})
SET(SIZEOF_UNSIGNED_CHAR        ${CMAKE_SIZEOF_UNSIGNED_CHAR})
SET(SIZEOF_UNSIGNED_INT         ${CMAKE_SIZEOF_UNSIGNED_INT})
SET(SIZEOF_UNSIGNED_LONG        ${CMAKE_SIZEOF_UNSIGNED_LONG})
SET(SIZEOF_UNSIGNED_LONG_LONG   ${CMAKE_SIZEOF_UNSIGNED_LONG_LONG})
SET(SIZEOF_UNSIGNED_SHORT       ${CMAKE_SIZEOF_UNSIGNED_SHORT})
SET(SIZEOF_VOID_P               ${CMAKE_SIZEOF_VOID_P})
1287
SET(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE)
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
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
CHECK_TYPE_SIZE("off64_t" SIZEOF_OFF64_T)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)

# Check for threads
IF(WIN32)
    SET(HAVE_THREADS  1)
ELSE(WIN32)
    SET(HAVE_THREADS  ${CMAKE_USE_PTHREADS})
ENDIF(WIN32)

# manually check for socklen_t as CHECK_SYMBOL_EXISTS
# doesn't appear to work on linux (at least) 
IF ("HAVE_SOCKLEN_T" MATCHES "^HAVE_SOCKLEN_T$")
    MESSAGE(STATUS "Check for socklen_t")
    TRY_COMPILE(HAVE_SOCKLEN_T
        ${CMAKE_CURRENT_BINARY_DIR}
        ${VISIT_SOURCE_DIR}/CMake/TestSocklenT.c
        OUTPUT_VARIABLE SLT
    )
    IF (HAVE_SOCKLEN_T)
        SET(HAVE_SOCKLEN_T 1 CACHE INTERNAL "support for socklen_t")
        MESSAGE(STATUS "Check for socklen_t - found")
    ELSE(HAVE_SOCKLEN_T)
        SET(HAVE_SOCKLEN_T 0 CACHE INTERNAL "support for socklen_t")
        MESSAGE(STATUS "Check for socklen_t - not found")
    ENDIF (HAVE_SOCKLEN_T)
ENDIF ("HAVE_SOCKLEN_T" MATCHES "^HAVE_SOCKLEN_T$")

# Check for setbuf being a public member in fstream. We could test via
# TRY_COMPILE in CMake 2.6.2. I think this is only false on the Suns, which
# we kind of stopped supporting anyway.
SET(NO_SETBUF 1)

# Check for PTY support
IF(NOT WIN32)
    SET(VISIT_USE_PTY 1)
    INCLUDE(${VISIT_SOURCE_DIR}/CMake/TestPTY.cmake)
ENDIF(NOT WIN32)

FUNCTION(CHECK_ISFINITE_EXISTS VAR)
    MESSAGE(STATUS "Check for isfinite")
    TRY_COMPILE(tmpVar
            ${CMAKE_CURRENT_BINARY_DIR}
            ${VISIT_SOURCE_DIR}/CMake/Testisfinite.cpp
            CMAKE_FLAGS -DLINK_LIBRARIES:STRING=m
            OUTPUT_VARIABLE outvar)
    IF(tmpVar)
        SET(${VAR} 1 CACHE INTERNAL "isfinite found")
        MESSAGE(STATUS "Check for isfinite - found")
    ELSE(tmpVar)
        MESSAGE(STATUS "Check for isfinite - not found")
        IF (NOT WIN32)
            MESSAGE("Check for isfinite - ${outvar}")
        ENDIF (NOT WIN32)
    ENDIF(tmpVar)
ENDFUNCTION(CHECK_ISFINITE_EXISTS)

FUNCTION(CHECK_STRTOF_PROTOTYPE VAR)
    MESSAGE(STATUS "Check for strtof prototype")
    TRY_COMPILE(tmpVar
            ${CMAKE_CURRENT_BINARY_DIR}
            ${VISIT_SOURCE_DIR}/CMake/Teststrtofprototype.cpp
            OUTPUT_VARIABLE outvar)
    IF(tmpVar)
        SET(${VAR} 1 CACHE INTERNAL "strtof prototype")
        MESSAGE(STATUS "Check for strtof prototype - found")
    ELSE(tmpVar)
        MESSAGE(STATUS "Check for strtof prototype - not found")
    ENDIF(tmpVar)
ENDFUNCTION(CHECK_STRTOF_PROTOTYPE)

FUNCTION(CHECK_FTIME_PROTOTYPE VAR)
    MESSAGE(STATUS "Check for ftime prototype")
    TRY_COMPILE(tmpVar
            ${CMAKE_CURRENT_BINARY_DIR}
            ${VISIT_SOURCE_DIR}/CMake/Testftimeprototype.cpp
            OUTPUT_VARIABLE outvar)
    IF(tmpVar)
        SET(${VAR} 1 CACHE INTERNAL "ftime prototype")
        MESSAGE(STATUS "Check for ftime prototype - found")
    ELSE(tmpVar)
        MESSAGE(STATUS "Check for ftime prototype - not found")
    ENDIF(tmpVar)
ENDFUNCTION(CHECK_FTIME_PROTOTYPE)

# Check for some functions
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
CHECK_FUNCTION_EXISTS(div HAVE_DIV)
CHECK_FUNCTION_EXISTS(setenv HAVE_SETENV)
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
CHECK_STRTOF_PROTOTYPE(HAVE_STRTOF_PROTOTYPE)
CHECK_FTIME_PROTOTYPE(HAVE_FTIME_PROTOTYPE)
CHECK_ISFINITE_EXISTS(HAVE_ISFINITE)

# If we're not disabling the select() call then check for it.
IF(NOT VISIT_DISABLE_SELECT)
bonnell's avatar
bonnell committed
1385
1386
1387
1388
1389
    IF(WIN32)
        SET(HAVE_SELECT TRUE)
    ELSE(WIN32)
        CHECK_FUNCTION_EXISTS(select HAVE_SELECT)
    ENDIF(WIN32)
1390
1391
ENDIF(NOT VISIT_DISABLE_SELECT)

1392
1393
MESSAGE(STATUS "Setting VISIT_RENDERING_SIZE_LIMIT to ${OSMESA_SIZE_LIMIT}")
SET(VISIT_RENDERING_SIZE_LIMIT ${OSMESA_SIZE_LIMIT} CACHE INTERNAL "rendering size limit")
1394
1395
1396
1397

CONFIGURE_FILE(${VISIT_SOURCE_DIR}/include/visit-cmake.h.in
               ${VISIT_BINARY_DIR}/include/visit-config.h @ONLY IMMEDIATE)

1398
1399
1400
1401
CONFIGURE_FILE(${VISIT_SOURCE_DIR}/include/visit-python-cmake.h.in
               ${VISIT_BINARY_DIR}/include/visit-python-config.h @ONLY IMMEDIATE)


1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
#-----------------------------------------------------------------------------
# Create common/misc/ConfigureInfo.C 
#-----------------------------------------------------------------------------

# Store some configure information into a C file (like version, SVN version
# and platform things that change).
CONFIGURE_FILE(${VISIT_SOURCE_DIR}/common/misc/ConfigureInfo.C.in
               ${VISIT_BINARY_DIR}/common/misc/ConfigureInfo.C @ONLY IMMEDIATE)

#-----------------------------------------------------------------------------
# Create CMake/PluginVsInstall.cmake
#-----------------------------------------------------------------------------

# The normal plugin case. We redefine these when we build against an installed
# version of VisIt
SET(VISIT_INCLUDE_DIR ${VISIT_SOURCE_DIR}  CACHE INTERNAL "Path to VisIt's includes")
SET(VISIT_LIBRARY_DIR ${VISIT_SOURCE_DIR}/lib CACHE INTENAL "Path to VisIt's libraries")
1419
1420
1421
1422
1423
IF(NOT WIN32)
    SET(VISIT_PLUGIN_DIR  ${VISIT_BINARY_DIR}/plugins CACHE INTERNAL "Path to VisIt's plugins")
ELSE(NOT WIN32)
    SET(VISIT_PLUGIN_DIR  ${VISIT_EXECUTABLE_DIR} CACHE INTERNAL "Path to VisIt's plugins")
ENDIF(NOT WIN32)
1424

1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
# Obtain compiler version information for inclusion in PluginVsInstall.cmake
# Note: This code block makes use of indirect variable reference (${${...}})
IF(NOT WIN32)

    # known different ways to get a compiler to spit out its version
    SET(CMAKE_COMPILER_VERSION_FLAGS "--version" "-V" "-v")

    FOREACH(CMAKE_COMPILER_NAME CMAKE_C_COMPILER CMAKE_CXX_COMPILER)
        FOREACH(CMAKE_COMPILER_VERSION_FLAG ${CMAKE_COMPILER_VERSION_FLAGS})

            EXECUTE_PROCESS(COMMAND ${${CMAKE_COMPILER_NAME}}
                ${CMAKE_COMPILER_VERSION_FLAG} TIMEOUT 3 
                RESULT_VARIABLE COMPILER_VERSION_RETURN
                OUTPUT_VARIABLE COMPILER_VERSION_STDOUT
                ERROR_VARIABLE COMPILER_VERSION_STDERR)

            # If stderr=="" AND $?==0 AND stdout!=""...
            IF("${COMPILER_VERSION_STDERR}" STREQUAL "" AND
                ${COMPILER_VERSION_RETURN} EQUAL 0 AND
                NOT ("${COMPILER_VERSION_STDOUT}" STREQUAL ""))

                # Looks like we got something useful from the compiler.
                # Reformat it so it looks like a cmake comment and break
                # out of the loop over version flags.
                STRING(REGEX REPLACE "\n" "\n# "
                    ${CMAKE_COMPILER_NAME}_VERSION_MESSAGE
                    "${COMPILER_VERSION_STDOUT}")
                BREAK()

            ENDIF("${COMPILER_VERSION_STDERR}" STREQUAL "" AND
                ${COMPILER_VERSION_RETURN} EQUAL 0 AND
                NOT ("${COMPILER_VERSION_STDOUT}" STREQUAL ""))

        ENDFOREACH(CMAKE_COMPILER_VERSION_FLAG ${CMAKE_COMPILER_VERSION_FLAGS})
    ENDFOREACH(CMAKE_COMPILER_NAME CMAKE_C_COMPILER CMAKE_CXX_COMPILER)

ENDIF(NOT WIN32)

1463
1464
1465
1466
1467
1468
# Store some configure information into a C file (like version, SVN version
# and platform things that change).
CONFIGURE_FILE(${VISIT_SOURCE_DIR}/CMake/PluginVsInstall.cmake.in
               ${VISIT_BINARY_DIR}/CMake/PluginVsInstall.cmake @ONLY IMMEDIATE)
INSTALL(FILES ${VISIT_BINARY_DIR}/CMake/PluginVsInstall.cmake
    DESTINATION ${VISIT_INSTALLED_VERSION_INCLUDE}
bonnell's avatar
bonnell committed
1469
1470
1471
    PERMISSIONS OWNER_READ OWNER_WRITE 
                GROUP_READ GROUP_WRITE 
                WORLD_READ
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
)

#-----------------------------------------------------------------------------
# Set flags & options from config-site files after everything is set up since
# setting them beforehand can upset some of CMake's own find routines. Use
# quotes to unite the strings or CMake will create a list.
#-----------------------------------------------------------------------------
SET(CMAKE_VERBOSE_MAKEFILE ${VISIT_VERBOSE_MAKEFILE})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIT_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIT_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${VISIT_EXE_LINKER_FLAGS}")

#-----------------------------------------------------------------------------
# Top-level subdirectories
#-----------------------------------------------------------------------------

FUNCTION(CREATE_PLUGIN_DEPENDENCIES target comp type)
    FOREACH(P ${ARGN})
        # Like E + Pseudocolor + Plot_ser
        SET(deptarget "${comp}${P}${type}")
        SET(dependencies ${dependencies} ${deptarget})
    ENDFOREACH(P)
    # Construct a variable that contains the names of the dependencies so we 
    # can use that later when we link the target's main exe.
    SET(cachevar "${target}_${comp}${type}")
    SET(${cachevar} ${dependencies} CACHE INTERNAL "dependencies for ${target}")
1498
    #MESSAGE("${cachevar} = ${${cachevar}}")
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
ENDFUNCTION(CREATE_PLUGIN_DEPENDENCIES)

ADD_SUBDIRECTORY(third_party_builtin)
ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(visit_vtk)
ADD_SUBDIRECTORY(avt)
IF(VISIT_DBIO_ONLY)
    ADD_SUBDIRECTORY(tools)
ELSE(VISIT_DBIO_ONLY)
    ADD_SUBDIRECTORY(engine)
ENDIF(VISIT_DBIO_ONLY)
IF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
    ADD_SUBDIRECTORY(launcher)
    ADD_SUBDIRECTORY(mdserver)
    IF(UNIX)
        ADD_SUBDIRECTORY(sim)
    ENDIF(UNIX)
ENDIF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
    ADD_SUBDIRECTORY(vtkqt)
    ADD_SUBDIRECTORY(winutil)
    ADD_SUBDIRECTORY(viewer)
    ADD_SUBDIRECTORY(gui)
    IF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND)
1523
1524
1525
1526
        IF(NOT VISIT_STATIC)
            ADD_SUBDIRECTORY(visitpy)
            ADD_SUBDIRECTORY(ultrawrapper)
        ENDIF(NOT VISIT_STATIC)
1527
1528
1529
1530
1531
    ENDIF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND)
    IF(VISIT_JAVA)
        ADD_SUBDIRECTORY(java)
    ENDIF(VISIT_JAVA)
ENDIF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
1532

1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
FUNCTION(ADD_TARGET_DEFINITIONS target newDefs)
    GET_TARGET_PROPERTY(currentDefs ${target} COMPILE_DEFINITIONS)
    IF(${currentDefs} MATCHES NOTFOUND)
        SET(allDefs ${newDefs})
    ELSE(${currentDefs} MATCHES NOTFOUND)
        SET(allDefs ${currentDefs} ${newDefs})
    ENDIF(${currentDefs} MATCHES NOTFOUND)
    SET_TARGET_PROPERTIES(${target} PROPERTIES
            COMPILE_DEFINITIONS ${allDefs}
        )
ENDFUNCTION(ADD_TARGET_DEFINITIONS)

1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
MACRO(ADD_TARGET_XXX_FLAGS target XXX)
    GET_TARGET_PROPERTY(currentFlags ${target} ${XXX})
    IF(NOT ${currentFlags} MATCHES NOTFOUND)
        FOREACH(flag ${currentFlags})
            SET(allFlags "${allFlags} ${flag}")
        ENDFOREACH(flag)
    ENDIF(NOT ${currentFlags} MATCHES NOTFOUND)
    FOREACH(flag ${ARGN})
        SET(allFlags "${allFlags} ${flag}")
    ENDFOREACH(flag)
    SET_TARGET_PROPERTIES(${target} PROPERTIES
        ${XXX} "${allFlags}"
    )
ENDMACRO(ADD_TARGET_XXX_FLAGS)

FUNCTION(ADD_TARGET_COMPILE_FLAGS target)
    ADD_TARGET_XXX_FLAGS(${target} COMPILE_FLAGS ${ARGN})
ENDFUNCTION(ADD_TARGET_COMPILE_FLAGS target)

FUNCTION(ADD_TARGET_LINK_FLAGS target)
    ADD_TARGET_XXX_FLAGS(${target} LINK_FLAGS ${ARGN})
ENDFUNCTION(ADD_TARGET_LINK_FLAGS target)

1568
1569
1570
1571
1572
1573
IF(NOT VISIT_DBIO_ONLY)
   ADD_SUBDIRECTORY(plots)
   ADD_SUBDIRECTORY(operators)
ENDIF(NOT VISIT_DBIO_ONLY)
ADD_SUBDIRECTORY(databases)

1574
1575
1576
1577
1578
IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
    # Must come after plugins in case we're doing a static build
    ADD_SUBDIRECTORY(tools)
ENDIF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)

1579
1580
1581
1582
1583
1584
1585
1586
# Now that plugins have been added, do the mains last if we're creating static
# binaries. This is needed to link the plugins into the exe.
IF(VISIT_STATIC)
    ADD_SUBDIRECTORY(engine/main)
    IF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
        ADD_SUBDIRECTORY(mdserver/main)
    ENDIF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
    IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
1587
        ADD_SUBDIRECTORY(gui/main)
1588
        ADD_SUBDIRECTORY(viewer/main)
1589
1590
1591
        IF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND)
            ADD_SUBDIRECTORY(visitpy)
        ENDIF(VISIT_PYTHON_SCRIPTING AND PYTHONLIBS_FOUND)
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
    ENDIF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ENDIF(VISIT_STATIC)

ADD_SUBDIRECTORY(bin)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(help)
ADD_SUBDIRECTORY(svn_bin)

#-----------------------------------------------------------------------------
# Add the "data" directory if it exists
#-----------------------------------------------------------------------------
IF(NOT WIN32 AND IS_DIRECTORY ${VISIT_SOURCE_DIR}/../data)
    IF(VISIT_OUT_OF_SOURCE_BUILD)
        ADD_SUBDIRECTORY(${VISIT_SOURCE_DIR}/../data ${CMAKE_CURRENT_BINARY_DIR}/data )
    ELSE(VISIT_OUT_OF_SOURCE_BUILD)
        ADD_SUBDIRECTORY(${VISIT_SOURCE_DIR}/../data ${VISIT_SOURCE_DIR}/../data)
    ENDIF(VISIT_OUT_OF_SOURCE_BUILD)
ENDIF(NOT WIN32 AND IS_DIRECTORY ${VISIT_SOURCE_DIR}/../data)