Commit 0c1471f1 authored by VTK Developers's avatar VTK Developers Committed by Brad King

Add modular VTK build system

Add module.cmake, CMakeLists.txt, and other build system files.

The modular VTK build system is not yet mature.  The monolithic build
files had a lot of infrastructure.  The modular build files reproduce
much of the functionality but some features will need to be restored
later.  Document status and tasks in "TODO-Modularization.txt".

Co-Author: Marcus D. Hanwell <marcus.hanwell@kitware.com>
Co-Author: Chris Harris <chris.harris@kitware.com>
Co-Author: Brad King <brad.king@kitware.com>
Co-Author: Nikhil Shetty <nikhil.shetty@kitware.com>
parent cdd4d6fd
......@@ -14,4 +14,4 @@ pre-commit crlf=input
*.txt whitespace=tab-in-indent,-blank-at-eol
*.cmake whitespace=tab-in-indent,-blank-at-eol
/Utilities/vtksqlite/vtk_sqlite3.c hooks.MaxObjectKiB=4096
/ThirdParty/sqlite/vtksqlite/vtk_sqlite3.c hooks.MaxObjectKiB=4096
set(Module_SRCS
vtkAMRBaseParticlesReader.cxx
vtkAMRBaseReader.cxx
vtkAMRCutPlane.cxx
vtkAMRDataSetCache.cxx
vtkAMREnzoParticlesReader.cxx
vtkAMREnzoReader.cxx
vtkAMREnzoReaderInternal.cxx
vtkAMRFlashParticlesReader.cxx
vtkAMRFlashReader.cxx
vtkAMRFlashReaderInternal.cxx
vtkAMRGaussianPulseSource.cxx
vtkAMRResampleFilter.cxx
vtkAMRSliceFilter.cxx
vtkAMRToMultiBlockFilter.cxx
vtkAMRUtilities.cxx
)
set_source_files_properties(
vtkAMRBaseReader
vtkAMRBaseParticlesReader
ABSTRACT
)
set_source_files_properties(
vtkAMREnzoReaderInternal
vtkAMRFlashReaderInternal
vtkAMRUtilities
WRAP_EXCLUDE
)
vtk_module_library(vtkAMRCore ${Module_SRCS})
## Set the name of the KIT being tested
SET(KIT AMR)
## List all test sources
SET(MyTests
set(MyTests
TestFlashReader.cxx
TestEnzoReader.cxx
)
## Create test source list
CREATE_TEST_SOURCELIST(Tests ${KIT}CxxTests.cxx
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
${MyTests}
EXTRA_INCLUDE vtkTestDriver.h
)
ADD_EXECUTABLE( ${KIT}CxxTests ${Tests})
TARGET_LINK_LIBRARIES( ${KIT}CxxTests vtkAMR vtkFiltering vtkParallel )
vtk_module_test_executable(${vtk-module}CxxTests ${Tests})
set(TestsToRun ${Tests})
remove(TestsToRun ${vtk-module}CxxTests.cxx)
## Add all executables
FOREACH(test ${MyTests})
GET_FILENAME_COMPONENT(t ${test} NAME_WE)
ADD_TEST(${t} ${CXX_TEST_PATH}/${KIT}CxxTests ${t} -D ${VTK_DATA_ROOT})
ENDFOREACH(test)
\ No newline at end of file
foreach(test ${TestsToRun})
get_filename_component(t ${test} NAME_WE)
add_test(NAME ${vtk-module}Cxx-${t}
COMMAND ${vtk-module}CxxTests ${t} -D ${VTK_DATA_ROOT})
endforeach()
vtk_module(vtkAMRCore
GROUPS
StandAlone
DEPENDS
vtkParallelCore
vtkFiltersGeneral
vtkhdf5
vtkIOXML
TEST_DEPENDS
vtkTestingCore
vtkTestingRendering
)
......@@ -27,7 +27,7 @@
#include "vtksys/SystemTools.hxx"
#define H5_USE_16_API
#include <hdf5.h> // for the HDF data loading engine
#include "vtk_hdf5.h" // for the HDF data loading engine
#include "vtkAMREnzoReaderInternal.h"
......
......@@ -37,7 +37,7 @@
#include "vtkUnsignedShortArray.h"
#define H5_USE_16_API
#include <hdf5.h>
#include "vtk_hdf5.h"
#include <sstream>
#include <vector>
......
......@@ -15,7 +15,7 @@
#include "vtkAMREnzoReaderInternal.h"
#define H5_USE_16_API
#include <hdf5.h> // for the HDF5 library
#include "vtk_hdf5.h" // for the HDF5 library
#include "vtksys/SystemTools.hxx"
#include "vtkCellData.h"
......
......@@ -25,7 +25,7 @@
#include "vtkAMRFlashReaderInternal.h"
#define H5_USE_16_API
#include <hdf5.h> // for the HDF data loading engine
#include "vtk_hdf5.h" // for the HDF data loading engine
#include <vector>
#include <cassert>
......
......@@ -37,7 +37,7 @@
#include <map>
#define H5_USE_16_API
#include <hdf5.h>
#include "vtk_hdf5.h"
#include "vtkAMRFlashReaderInternal.h"
......
......@@ -39,7 +39,7 @@
#include "vtkByteSwap.h"
#define H5_USE_16_API
#include <hdf5.h>
#include "vtk_hdf5.h"
//==============================================================================
// I N T E R N A L F L A S H R E A D E R
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ FIND_PATH(ODBC_INCLUDE_DIRECTORIES sql.h
)
FIND_LIBRARY( ODBC_LIBRARY
NAMES iodbc unixodbc
NAMES odbc iodbc unixodbc
PATHS
/usr/lib
/usr/lib/odbc
......
This diff is collapsed.
# - Find the PostgreSQL installation.
# Usage:
# In your CMakeLists.txt file do something like this:
# ...
# # PostgreSQL
# FIND_PACKAGE(PostgreSQL)
# ...
# if( PostgreSQL_FOUND )
# include_directories(${PostgreSQL_INCLUDE_DIRS})
# link_directories(${PostgreSQL_LIBRARY_DIRS})
# endif( PostgreSQL_FOUND )
# ...
# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement.
#
#
# In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory
# will be C:\Program Files\PostgreSQL.
#
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# ----------------------------------------------------------------------------
# History:
# This module is derived from the module originally found in the VTK source tree.
#
# ----------------------------------------------------------------------------
# Note:
# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
# version mumber of the implementation of PostgreSQL.
# In Windows the default installation of PostgreSQL uses that as part of the path.
# E.g C:\Program Files\PostgreSQL\8.4.
# Currently, the following version numbers are known to this module:
# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
#
# To use this variable just do something like this:
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
# before calling FIND_PACKAGE(PostgreSQL) in your CMakeLists.txt file.
# This will mean that the versions you set here will be found first in the order
# specified before the default ones are searched.
#
# ----------------------------------------------------------------------------
# You may need to manually set:
# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
# If FindPostgreSQL.cmake cannot find the include files or the library files.
#
# ----------------------------------------------------------------------------
# The following variables are set if PostgreSQL is found:
# PostgreSQL_FOUND - Set to true when PostgreSQL is found.
# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
#
# ----------------------------------------------------------------------------
# If you have installed PostgreSQL in a non-standard location.
# (Please note that in the following comments, it is assumed that <Your Path>
# points to the root directory of the include directory of PostgreSQL.)
# Then you have three options.
# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and
# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
# installed PostgreSQL, e.g. <Your Path>.
#
# ----------------------------------------------------------------------------
set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}")
set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT})
if(PostgreSQL_ROOT_DIRECTORIES)
file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES)
endif(PostgreSQL_ROOT_DIRECTORIES)
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
"9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
# Define additional search paths for root directories.
if ( WIN32 )
foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} )
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" )
endforeach(suffix)
endif( WIN32 )
set( PostgreSQL_ROOT_DIRECTORIES
${PostgreSQL_ROOT_DIRECTORIES}
${PostgreSQL_ROOT}
${PostgreSQL_ADDITIONAL_SEARCH_PATHS}
)
#
# Look for an installation.
#
find_path(PostgreSQL_INCLUDE_DIR
NAMES libpq-fe.h
PATHS
# Look in other places.
${PostgreSQL_ROOT_DIRECTORIES}
PATH_SUFFIXES
postgresql
include
# Help the user find it if we cannot.
DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
)
# The PostgreSQL library.
set (PostgreSQL_LIBRARY_TO_FIND pq)
# Setting some more prefixes for the library
set (PostgreSQL_LIB_PREFIX "")
if ( WIN32 )
set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
endif()
find_library( PostgreSQL_LIBRARY
NAMES ${PostgreSQL_LIBRARY_TO_FIND}
PATHS
${PostgreSQL_ROOT_DIRECTORIES}
PATH_SUFFIXES
lib
)
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
# Did we find anything?
set( PostgreSQL_FOUND 0 )
if ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
set( PostgreSQL_FOUND 1 )
else ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
if ( POSTGRES_REQUIRED )
message( FATAL_ERROR "PostgreSQL is required. ${PostgreSQL_ROOT_DIR_MESSAGE}" )
endif ( POSTGRES_REQUIRED )
endif (EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
if(EXISTS "${PostgreSQL_INCLUDE_DIR}")
set(PostgreSQL_INCLUDE_DIRS
${PostgreSQL_INCLUDE_DIR}
)
endif(EXISTS "${PostgreSQL_INCLUDE_DIR}")
if(EXISTS "${PostgreSQL_LIBRARY_DIR}")
set(PostgreSQL_LIBRARY_DIRS
${PostgreSQL_LIBRARY_DIR}
)
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
endif(EXISTS "${PostgreSQL_LIBRARY_DIR}")
#message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
#message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}")
#message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
endif(PostgreSQL_FOUND)
if(NOT PostgreSQL_FOUND)
if(NOT PostgreSQL_FIND_QUIETLY)
message(STATUS "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}")
else(NOT PostgreSQL_FIND_QUIETLY)
if(PostgreSQL_FIND_REQUIRED)
message(FATAL_ERROR "PostgreSQL was not found. ${PostgreSQL_DIR_MESSAGE}")
endif(PostgreSQL_FIND_REQUIRED)
endif(NOT PostgreSQL_FIND_QUIETLY)
endif(NOT PostgreSQL_FOUND)
This diff is collapsed.
# Perform a reverse topological sort on the given LIST.
#
# topological_sort(my_list "MY_" "_EDGES")
#
# LIST is the name of a variable containing a list of elements to be
# sorted in reverse topological order. Each element in the list has a
# set of outgoing edges (for example, those other list elements that
# it depends on). In the resulting reverse topological ordering
# (written back into the variable named LIST), an element will come
# later in the list than any of the elements that can be reached by
# following its outgoing edges and the outgoing edges of any vertices
# they target, recursively. Thus, if the edges represent dependencies
# on build targets, for example, the reverse topological ordering is
# the order in which one would build those targets.
#
# For each element E in this list, the edges for E are contained in
# the variable named ${PREFIX}${E}${SUFFIX}. If no such variable
# exists, then it is assumed that there are no edges. For example, if
# my_list contains a, b, and c, one could provide a dependency graph
# using the following variables:
#
# MY_A_EDGES b
# MY_B_EDGES
# MY_C_EDGES a b
#
# With the involcation of topological_sort shown above and these
# variables, the resulting reverse topological ordering will be b, a,
# c.
##############################################################################
# Modified from Boost Utilities
#
# Copyright 2010 Kitware, Inc.
##############################################################################
# Copyright 2007 Douglas Gregor <doug.gregor@gmail.com>
# Copyright 2007 Troy Straszheim
#
# Distributed under the Boost Software License, Version 1.0.
##############################################################################
# Boost Software License - Version 1.0 - August 17th, 2003
#
# Permission is hereby granted, free of charge, to any person or organization
# obtaining a copy of the software and accompanying documentation covered by
# this license (the "Software") to use, reproduce, display, distribute,
# execute, and transmit the Software, and to prepare derivative works of the
# Software, and to permit third-parties to whom the Software is furnished to
# do so, all subject to the following:
#
# The copyright notices in the Software and this entire statement, including
# the above license grant, this restriction and the following disclaimer,
# must be included in all copies of the Software, in whole or in part, and
# all derivative works of the Software, unless such copies or derivative
# works are solely in the form of machine-executable object code generated by
# a source language processor.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
##############################################################################
function(topological_sort LIST PREFIX SUFFIX)
# Clear the stack and output variable
set(VERTICES "${${LIST}}")
set(STACK)
set(${LIST})
# Loop over all of the vertices, starting the topological sort from
# each one.
foreach(VERTEX ${VERTICES})
# If we haven't already processed this vertex, start a depth-first
# search from where.
if (NOT FOUND_${VERTEX})
# Push this vertex onto the stack with all of its outgoing edges
string(REPLACE ";" " " NEW_ELEMENT
"${VERTEX};${${PREFIX}${VERTEX}${SUFFIX}}")
list(APPEND STACK ${NEW_ELEMENT})
# We've now seen this vertex
set(FOUND_${VERTEX} TRUE)
# While the depth-first search stack is not empty
list(LENGTH STACK STACK_LENGTH)
while(STACK_LENGTH GREATER 0)
# Remove the vertex and its remaining out-edges from the top
# of the stack
list(GET STACK -1 OUT_EDGES)
list(REMOVE_AT STACK -1)
# Get the source vertex and the list of out-edges
separate_arguments(OUT_EDGES)
list(GET OUT_EDGES 0 SOURCE)
list(REMOVE_AT OUT_EDGES 0)
# While there are still out-edges remaining
list(LENGTH OUT_EDGES OUT_DEGREE)
while (OUT_DEGREE GREATER 0)
# Pull off the first outgoing edge
list(GET OUT_EDGES 0 TARGET)
list(REMOVE_AT OUT_EDGES 0)
if (NOT FOUND_${TARGET})
# We have not seen the target before, so we will traverse
# its outgoing edges before coming back to our
# source. This is the key to the depth-first traversal.
# We've now seen this vertex
set(FOUND_${TARGET} TRUE)
# Push the remaining edges for the current vertex onto the
# stack
string(REPLACE ";" " " NEW_ELEMENT
"${SOURCE};${OUT_EDGES}")
list(APPEND STACK ${NEW_ELEMENT})
# Setup the new source and outgoing edges
set(SOURCE ${TARGET})
set(OUT_EDGES
${${PREFIX}${SOURCE}${SUFFIX}})
endif(NOT FOUND_${TARGET})
list(LENGTH OUT_EDGES OUT_DEGREE)
endwhile (OUT_DEGREE GREATER 0)
# We have finished all of the outgoing edges for
# SOURCE; add it to the resulting list.
list(APPEND ${LIST} ${SOURCE})
# Check the length of the stack
list(LENGTH STACK STACK_LENGTH)
endwhile(STACK_LENGTH GREATER 0)
endif (NOT FOUND_${VERTEX})
endforeach(VERTEX)
set(${LIST} ${${LIST}} PARENT_SCOPE)
endfunction(topological_sort)
# This file sets up include directories, link directories, and
# compiler settings for a project to use VTK. It should not be
# included directly, but rather through the VTK_USE_FILE setting
# obtained from VTKConfig.cmake.
if(VTK_USE_FILE_INCLUDED)
return()
endif()
set(VTK_USE_FILE_INCLUDED 1)
# Update CMAKE_MODULE_PATH so includes work.
list(APPEND CMAKE_MODULE_PATH ${VTK_CMAKE_DIR})
# Add compiler flags needed to use VTK.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${VTK_REQUIRED_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${VTK_REQUIRED_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}")
# Add preprocessor definitions needed to use VTK.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
# Add include directories needed to use VTK.
include_directories(${VTK_INCLUDE_DIRS})
# Add link directories needed to use VTK.
link_directories(${VTK_LIBRARY_DIRS})
#-----------------------------------------------------------------------------
#
# VTKConfig.cmake - VTK CMake configuration file for external projects.
#
# This file is configured by VTK and used by the UseVTK.cmake module
# to load VTK's settings for an external project.
@VTK_CONFIG_CODE@
# The C and C++ flags added by VTK to the cmake-configured flags.
SET(VTK_REQUIRED_C_FLAGS "@VTK_REQUIRED_C_FLAGS@")
SET(VTK_REQUIRED_CXX_FLAGS "@VTK_REQUIRED_CXX_FLAGS@")
SET(VTK_REQUIRED_EXE_LINKER_FLAGS "@VTK_REQUIRED_EXE_LINKER_FLAGS@")
SET(VTK_REQUIRED_SHARED_LINKER_FLAGS "@VTK_REQUIRED_SHARED_LINKER_FLAGS@")
SET(VTK_REQUIRED_MODULE_LINKER_FLAGS "@VTK_REQUIRED_MODULE_LINKER_FLAGS@")
# The VTK version number
SET(VTK_MAJOR_VERSION "@VTK_MAJOR_VERSION@")
SET(VTK_MINOR_VERSION "@VTK_MINOR_VERSION@")
SET(VTK_BUILD_VERSION "@VTK_BUILD_VERSION@")
# The location of the UseVTK.cmake file.
SET(VTK_CMAKE_DIR "@VTK_CONFIG_CMAKE_DIR@")
SET(VTK_USE_FILE "${VTK_CMAKE_DIR}/UseVTK.cmake")