Skip to content
Snippets Groups Projects
Commit b0833cad authored by Lars Bilke's avatar Lars Bilke
Browse files

Added VTK as a external project.

This will be used instead of the custom catalyst vtk editions making
it much more easier to add new vtk libraries to the automatic build,
see #869.

Catalyst will be used in the future but just for in-situ vis configs.
parent df2d1310
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,11 @@ include(scripts/cmake/packaging/Pack.cmake) ...@@ -102,7 +102,11 @@ include(scripts/cmake/packaging/Pack.cmake)
option(Boost_USE_STATIC_LIBS "This option has to be set from the command line (before boost gets found)!" OFF) option(Boost_USE_STATIC_LIBS "This option has to be set from the command line (before boost gets found)!" OFF)
include(scripts/cmake/ExternalProjectBoost.cmake) include(scripts/cmake/ExternalProjectBoost.cmake)
option(OGS_SYSTEM_VTK_ONLY "If On VTK / ParaView will be searched if installed and will not be build locally." OFF) option(OGS_SYSTEM_VTK_ONLY "If On VTK / ParaView will be searched if installed and will not be build locally." OFF)
include(scripts/cmake/ExternalProjectCatalyst.cmake) if(OGS_INSITU)
include(scripts/cmake/ExternalProjectCatalyst.cmake)
else()
include(scripts/cmake/ExternalProjectVtk.cmake)
endif()
include_directories( SYSTEM ${Boost_INCLUDE_DIRS} ) include_directories( SYSTEM ${Boost_INCLUDE_DIRS} )
if(OGS_USE_EIGEN) if(OGS_USE_EIGEN)
......
...@@ -4,6 +4,8 @@ macro(ADD_CATALYST_DEPENDENCY target) ...@@ -4,6 +4,8 @@ macro(ADD_CATALYST_DEPENDENCY target)
# see http://stackoverflow.com/questions/18642155 # see http://stackoverflow.com/questions/18642155
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS}) set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
elseif(VTK_FOUND)
include( ${VTK_USE_FILE} )
endif() endif()
if(TARGET VtkRescan) if(TARGET VtkRescan)
......
...@@ -53,21 +53,6 @@ if(ParaView_FOUND AND VTKIO_LIB_FOUND) ...@@ -53,21 +53,6 @@ if(ParaView_FOUND AND VTKIO_LIB_FOUND)
message(STATUS "Using ParaView in ${ParaView_DIR}") message(STATUS "Using ParaView in ${ParaView_DIR}")
return() return()
elseif(NOT ParaView_DIR) elseif(NOT ParaView_DIR)
# If ParaView was not found check for VTK
find_package(VTK 6.1 COMPONENTS ${PARAVIEW_MODULES} NO_MODULE QUIET)
if(VTK_FOUND)
include( ${VTK_USE_FILE} )
foreach(DIR ${VTK_INCLUDE_DIRS})
if("${DIR}" MATCHES ".*vtknetcdf.*")
include_directories(SYSTEM ${DIR}/../cxx ${DIR}/include)
elseif("${DIR}" MATCHES ".*vtk.*")
include_directories(SYSTEM ${DIR}/vtknetcdf/include)
endif()
endforeach()
include_directories(SYSTEM ${VTK_DIR}/../ThirdParty/netcdf/vtknetcdf/cxx)
message(STATUS "Using VTK in ${VTK_DIR}")
return()
else()
# If nothing was found build ParaView as an external project # If nothing was found build ParaView as an external project
set(ParaView_DIR ${CMAKE_BINARY_DIR}/External/catalyst/src/Catalyst-build CACHE PATH "" FORCE) set(ParaView_DIR ${CMAKE_BINARY_DIR}/External/catalyst/src/Catalyst-build CACHE PATH "" FORCE)
endif() endif()
...@@ -96,9 +81,7 @@ else() ...@@ -96,9 +81,7 @@ else()
endif() endif()
message(STATUS "Building ParaView as an external project in the build directory") message(STATUS "Building ParaView as an external project in the build directory")
if(CMAKE_VERSION VERSION_LESS 3.0.0)
message(FATAL_ERROR "CMake 3.0.0 or higher is required for building VTK / ParaView!")
endif()
ExternalProject_Add(Catalyst ExternalProject_Add(Catalyst
PREFIX ${CMAKE_BINARY_DIR}/External/catalyst PREFIX ${CMAKE_BINARY_DIR}/External/catalyst
GIT_REPOSITORY ${CATALYST_GIT_URL} GIT_REPOSITORY ${CATALYST_GIT_URL}
......
include(ThirdPartyLibVersions)
include(ExternalProject)
if(NOT DEFINED VTK_DIR AND DEFINED ENV{VTK_DIR})
set(VTK_DIR $ENV{VTK_DIR})
endif()
# CLI modules
set(VTK_MODULES vtkIOXML vtkIOParallelXML)
# GUI modules
if(OGS_BUILD_GUI)
set(VTK_MODULES ${VTK_MODULES}
vtkRenderingCore
vtkRenderingOpenGL
vtknetcdf
vtkIOLegacy
vtkIOImage
vtkGUISupportQt
vtkRenderingAnnotation
vtkFiltersExtraction
vtkFiltersGeometry
vtkFiltersTexture
vtkFiltersModeling
vtkFiltersSources
vtkImagingCore
vtkInteractionWidgets
vtkInteractionStyle
vtkIOExport
vtkRenderingFreeType
)
endif()
set(CATALYST_LIBRARIES ${VTK_MODULES} CACHE STRING "" FORCE)
if(OGS_BUILD_GUI)
# Replace vtknetcdf with vtkNetCDF vtkNetCDF_cxx
list(REMOVE_ITEM CATALYST_LIBRARIES vtknetcdf)
list(APPEND CATALYST_LIBRARIES vtkNetCDF vtkNetCDF_cxx)
endif()
find_package(VTK 6.1 COMPONENTS ${VTK_MODULES} NO_MODULE QUIET)
if(VTK_FOUND)
message(STATUS "Using VTK in ${VTK_DIR}")
foreach(DIR ${VTK_INCLUDE_DIRS})
if("${DIR}" MATCHES ".*vtknetcdf.*")
include_directories(SYSTEM ${DIR}/../cxx ${DIR}/include)
elseif("${DIR}" MATCHES ".*vtk.*")
include_directories(SYSTEM ${DIR}/vtknetcdf/include)
endif()
endforeach()
include_directories(SYSTEM ${VTK_DIR}/../ThirdParty/netcdf/vtknetcdf/cxx)
return()
endif()
set(VTK_DIR ${CMAKE_BINARY_DIR}/External/vtk/src/vtk-build CACHE PATH "" FORCE)
message(STATUS "Building VTK as an external project in the build directory")
if(WIN32)
set(VTK_MAKE_COMMAND
msbuild /p:Configuration=Release /m:${NUM_PROCESSORS} VTK.sln &&
msbuild /p:Configuration=Debug /m:${NUM_PROCESSORS} /m VTK.sln)
else()
if($ENV{CI})
set(VTK_MAKE_COMMAND make)
else()
set(VTK_MAKE_COMMAND make -j ${NUM_PROCESSORS})
endif()
endif()
# Enable just the modules we selected
set(VTK_CMAKE_ARGS -DVTK_Group_StandAlone:bool=off -DVTK_Group_Rendering:bool=off)
foreach(arg ${VTK_MODULES})
list(APPEND VTK_CMAKE_ARGS -DModule_${arg}:bool=on)
endforeach()
ExternalProject_Add(vtk
PREFIX ${CMAKE_BINARY_DIR}/External/vtk
URL ${OGS_VTK_URL}
CMAKE_ARGS -Wno-dev
CMAKE_CACHE_ARGS ${VTK_CMAKE_ARGS}
BUILD_COMMAND ${VTK_MAKE_COMMAND}
INSTALL_COMMAND ""
)
if(NOT ${VTK_FOUND})
# Rerun cmake in initial build
add_custom_target(VtkRescan ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} DEPENDS vtk)
else()
add_custom_target(VtkRescan) # dummy target for caching
endif()
...@@ -4,9 +4,9 @@ set(OGS_BOOST_MD5 "b8839650e61e9c1c0a89f371dd475546") ...@@ -4,9 +4,9 @@ set(OGS_BOOST_MD5 "b8839650e61e9c1c0a89f371dd475546")
set(OGS_EIGEN_URL "http://opengeosys.s3.amazonaws.com/ogs6-lib-sources/eigen-3.2.5.tar.gz") set(OGS_EIGEN_URL "http://opengeosys.s3.amazonaws.com/ogs6-lib-sources/eigen-3.2.5.tar.gz")
set(OGS_EIGEN_MD5 "8cc513ac6ec687117acadddfcacf551b") set(OGS_EIGEN_MD5 "8cc513ac6ec687117acadddfcacf551b")
set(OGS_VTK_VERSION 6.1.0) set(OGS_VTK_VERSION 6.3.0)
set(OGS_VTK_URL "http://www.vtk.org/files/release/6.1/VTK-6.1.0.tar.gz") set(OGS_VTK_URL "http://www.vtk.org/files/release/6.3/VTK-6.3.0.tar.gz")
set(OGS_VTK_MD5 "25e4dfb3bad778722dcaec80cd5dab7d") set(OGS_VTK_MD5 "0231ca4840408e9dd60af48b314c5b6d")
set(OGS_TIFF_URL "https://github.com/ufz/tiff/archive/4.0.1.zip") set(OGS_TIFF_URL "https://github.com/ufz/tiff/archive/4.0.1.zip")
set(OGS_TIFF_MD5 "8d5c18654bda9c731d8a6e2dc958751b") set(OGS_TIFF_MD5 "8d5c18654bda9c731d8a6e2dc958751b")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment