Commit 6f70057e authored by Andrew Bauer's avatar Andrew Bauer
Browse files

Adding option to automatically build the Nektar reader plugin.

The Nektar reader requires BLAS and LAPACK so I need to build
those as well. I'm removing the external Nektar plugin as well
to avoid confusion. The nektar reader plugin requires a
fortran compiler so we need to make sure one exists before
we allow the nektar reader to be enabled.

Change-Id: I939c6e69b0850e84faf0e124d5ace3ca1768ef25
parent 389a28e2
#=============================================================================
# Copyright 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.)
if(NOT DEFINED CMAKE_Fortran_COMPILER)
set(_desc "Looking for a Fortran compiler")
message(STATUS ${_desc})
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/CMakeLists.txt"
"cmake_minimum_required(VERSION 2.4)
project(CheckFortran Fortran)
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_Fortran_COMPILER \\\"\${CMAKE_Fortran_COMPILER}\\\")\\n\"
\"set(CMAKE_Fortran_FLAGS \\\"\${CMAKE_Fortran_FLAGS}\\\")\\n\"
)
")
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE result
)
include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/result.cmake OPTIONAL)
if(CMAKE_Fortran_COMPILER AND "${result}" STREQUAL "0")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"${_desc} passed with the following output:\n"
"${output}\n")
else()
set(CMAKE_Fortran_COMPILER NOTFOUND)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"${_desc} failed with the following output:\n"
"${output}\n")
endif()
message(STATUS "${_desc} - ${CMAKE_Fortran_COMPILER}")
set(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}" CACHE FILEPATH "Fortran compiler")
mark_as_advanced(CMAKE_Fortran_COMPILER)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" CACHE STRING "Fortran flags")
mark_as_advanced(CMAKE_Fortran_FLAGS)
endif()
......@@ -182,6 +182,15 @@ configure_file(
#-----------------------------------------------------------------------------
set (CM_PROJECTS_ALL)
if (NOT WIN32)
# Check if there's a Fortran compiler. If there is, CMAKE_Fortran_COMPILER
# will be set. Note that as of CMake 2.8.11 that CMAKE_Fortran_COMPILER
# isn't passed to the external projects so setting it to something else
# will give unexpected results. This is CMake Mantis issue 14,231.
include(CheckFortran)
endif()
# Include all optional projects. These are the ones user can pick and choose.
# Some of these allow using system libraries too.
if (CROSS_BUILD_STAGE STREQUAL "CROSS")
......@@ -213,6 +222,12 @@ else()
include(szip)
include(visitbridge)
include(zlib)
if(CMAKE_Fortran_COMPILER)
# both of these packages require a Fortran compiler to build so we
# only present them to the user if we have one.
include(nektarreader)
include(lapack)
endif()
if (UNIX)
# Supported on Linux/Mac
......
if (APPLE)
set (SHARED_LIBRARY_PREFIX "lib")
set (SHARED_LIBRARY_SUFFIX ".dylib")
elseif (UNIX)
set (SHARED_LIBRARY_PREFIX "lib")
set (SHARED_LIBRARY_SUFFIX ".so")
elseif (WIN32)
set (SHARED_LIBRARY_PREFIX "")
set (SHARED_LIBRARY_SUFFIX ".dll")
endif()
# Remove any old directory
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${TMP_DIR}/NektarReaderPlugin-${bundle_suffix}
WORKING_DIRECTORY ${TMP_DIR}
)
# Create a directory to put the plugin under.
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TMP_DIR}/NektarReaderPlugin-${bundle_suffix}
WORKING_DIRECTORY ${TMP_DIR}
)
# Copy th plugin lib.
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${BINARY_DIR}/${SHARED_LIBRARY_PREFIX}pvNektarReader${SHARED_LIBRARY_SUFFIX} ${TMP_DIR}/NektarReaderPlugin-${bundle_suffix}
WORKING_DIRECTORY ${TMP_DIR}
)
if (APPLE)
execute_process(
COMMAND ${CMAKE_CURRENT_LIST_DIR}/apple/fixup_plugin.py
# The directory containing the plugin dylibs.
${TMP_DIR}/NektarReaderPlugin-${bundle_suffix}
# names to replace (in order)
"${PARAVIEW_BINARY_DIR}/lib/=@executable_path/../Libraries/"
"${INSTALL_DIR}/lib/Qt=@executable_path/../Frameworks/Qt"
"${INSTALL_DIR}/lib/=@executable_path/../Libraries/"
"libhdf5.7.3.0.dylib=@executable_path/../Libraries/libhdf5.1.8.9.dylib"
"libhdf5_hl.7.3.0.dylib=@executable_path/../Libraries/libhdf5.1.8.9.dylib"
"libcgns.3.1.dylib=@executable_path/../Libraries/libcgns.3.1.dylib"
)
endif()
# make tarball
execute_process(
COMMAND ${CMAKE_COMMAND}
-E tar cvfz ${bundle_name}-${bundle_suffix}.tgz NektarReaderPlugin-${bundle_suffix}
WORKING_DIRECTORY ${TMP_DIR})
add_external_project(lapack
BUILD_IN_SOURCE 0
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND
make
INSTALL_COMMAND
make install
)
add_external_project(nektar_plugin
DEPENDS paraview
CMAKE_ARGS
-DParaView_DIR:PATH=${SuperBuild_BINARY_DIR}/paraview/src/paraview-build
-DBLAS_atlas_LIBRARY:FILEPATH=/soft/apps/atlas-3.8.2-gcc-shared/lib/libatlas.a
-DBLAS_f77blas_LIBRARY:FILEPATH=/soft/apps/atlas-3.8.2-gcc-shared/lib/libf77blas.a
-DLAPACK_lapack_LIBRARY:FILEPATH=/soft/apps/atlas-3.8.2-gcc-shared/lib/liblapack.a
INSTALL_COMMAND
${CMAKE_COMMAND} -DBINARY_DIR:PATH=<BINARY_DIR>
-DINSTALL_DIR:PATH=<INSTALL_DIR>
-DPARAVIEW_BINARY_DIR:PATH=${ParaViewSuperBuild_BINARY_DIR}/paraview/src/paraview-build
-DTMP_DIR:PATH=<TMP_DIR>
-Dbundle_name:STRING=${CMAKE_CURRENT_BINARY_DIR}/NektarReaderPlugin
-Dbundle_suffix:STRING=${pv_version_long}-${package_suffix}
-P ${CMAKE_CURRENT_LIST_DIR}/install_nektar_plugin.cmake
)
#make a dummy nektar reader project so that the user can enable
#or disable building paraview with support for the reader
add_external_dummy_project(nektarreader
DEPENDS lapack mpi
)
......@@ -23,7 +23,7 @@ endif()
add_external_project(paraview
DEPENDS_OPTIONAL
boost ffmpeg hdf5 libxml3 manta matplotlib mpi numpy png python qt visitbridge zlib silo cgns
mesa osmesa
mesa osmesa nektarreader
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=ON
......@@ -40,6 +40,7 @@ add_external_project(paraview
-DVISIT_BUILD_READER_Silo:BOOL=${silo_ENABLED}
-DVTK_USE_SYSTEM_HDF5:BOOL=${hdf5_ENABLED}
-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=${PARAVIEW_INSTALL_DEVELOPMENT_FILES}
-DPARAVIEW_BUILD_PLUGIN_Nektar:BOOL=${nektarreader_ENABLED}
# since VTK mangles all the following, I wonder if there's any point in
# making it use system versions.
# -DVTK_USE_SYSTEM_FREETYPE:BOOL=${ENABLE_FREETYPE}
......
......@@ -169,10 +169,10 @@ add_revision(vistrails
#add_revision(mili_plugin
# URL ${CMAKE_CURRENT_SOURCE_DIR}/Externals/mili)
add_revision(nektar_plugin
GIT_REPOSITORY git://gitorious.org/nektarplugin/nektarplugin.git
GIT_TAG master)
add_revision(portfwd
URL "http://www.paraview.org/files/dependencies/portfwd-0.29.tar.gz"
URL_MD5 93161c91e12b0d67ca52dc13708a2f2f)
add_revision(lapack
URL "http://paraview.org/files/dependencies/lapack-3.4.2.tgz"
URL_MD5 61bf1a8a4469d4bdb7604f5897179478)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment