paraview build - reworking build/install directories

This commit is contained in:
Mark Olesen
2008-12-16 13:20:53 +01:00
parent 7072a998e8
commit 6151df3ef1
3 changed files with 116 additions and 73 deletions

View File

@ -65,8 +65,7 @@ usage() {
usage: ${0##*/} [OPTION] usage: ${0##*/} [OPTION]
options: options:
-fast for repeated builds (-make -abspath -install) *use with caution* -fast for repeated builds (-make -install) *use with caution*
-abspath suppress the '-envpath' stage of changing the cmake files
-mpi with mpi (if not already enabled) -mpi with mpi (if not already enabled)
-python with python (if not already enabled) -python with python (if not already enabled)
-mesa with mesa (if not already enabled) -mesa with mesa (if not already enabled)
@ -77,8 +76,9 @@ For finer control, the build stages can be also selected individually
(mutually exclusive) (mutually exclusive)
-config -config
-make -make
-envpath -makedoc
-install -install
[-envpath] alter absolute paths in CMake files to use env variables
Build and install $PARAVIEW_SRC Build and install $PARAVIEW_SRC
- run from folder above the ParaView source folder or place the - run from folder above the ParaView source folder or place the
@ -88,16 +88,16 @@ USAGE
exit 1 exit 1
} }
# options based on the script name: # add options based on script name:
case "$Script" in *-fast*) CMAKE_SKIP=ON;; esac
case "$Script" in *-mpi*) WITH_MPI=ON;; esac case "$Script" in *-mpi*) WITH_MPI=ON;; esac
case "$Script" in *-python*) WITH_PYTHON=ON;; esac case "$Script" in *-python*) WITH_PYTHON=ON;; esac
case "$Script" in *-mesa*) WITH_MESA=ON;; esac case "$Script" in *-mesa*) WITH_MESA=ON;; esac
runCONFIG=true runCONFIG=true
runMAKE=true runMAKE=true
runENVPATH=true runMAKEDOC=true
runINSTALL=true runINSTALL=true
runENVPATH=false
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -109,42 +109,46 @@ do
-config) # stage 1: config only -config) # stage 1: config only
runCONFIG=true runCONFIG=true
runMAKE=false runMAKE=false
runENVPATH=false runMAKEDOC=false
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-make) # stage 2: make only -make) # stage 2: make only
runCONFIG=false runCONFIG=false
runMAKE=true runMAKE=true
runENVPATH=false runMAKEDOC=false
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-envpath) # stage 3: alter paths to use env variables -makedoc) # stage 3: generate html documentation
runCONFIG=false runCONFIG=false
runMAKE=false runMAKE=false
runENVPATH=true runMAKEDOC=true
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-install) # stage 4: install only -install) # stage 4: install only
runCONFIG=false runCONFIG=false
runMAKE=false runMAKE=false
runENVPATH=false runMAKEDOC=false
runINSTALL=true runINSTALL=true
shift shift
;; ;;
-envpath) # optional: change cmake files to use env variables
runCONFIG=false
runMAKE=false
runMAKEDOC=false
runINSTALL=false
runENVPATH=true
shift
;;
-fast) # shortcut for rebuild -fast) # shortcut for rebuild
runCONFIG=false runCONFIG=false
runMAKE=true runMAKE=true
runENVPATH=false runMAKEDOC=false
runINSTALL=true runINSTALL=true
shift shift
;; ;;
-abspath) # suppress changing the cmake files
runENVPATH=false
shift
;;
-mpi) -mpi)
WITH_MPI=ON WITH_MPI=ON
shift shift
@ -180,9 +184,9 @@ getPaths # discover where things are or should be put
# ~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~
[ $runCONFIG = true ] && configParaView [ $runCONFIG = true ] && configParaView
[ $runMAKE = true ] && makeParaView [ $runMAKE = true ] && makeParaView
[ $runENVPATH = true ] && fixCMakeFiles [ $runMAKEDOC = true ] && makeDocs
[ $runINSTALL = true ] && installParaView [ $runINSTALL = true ] && installParaView
[ $runENVPATH = true ] && fixCMakeFiles
echo "done" echo "done"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -34,8 +34,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions . $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
PARAVIEW_SRC=ParaView3.3-cvs PARAVIEW_SRC=paraview-3.4
PARAVIEW_MAJOR_VERSION=3.3 PARAVIEW_MAJOR_VERSION=3.4
# User options: # User options:
# ~~~~~~~~~~~~~ # ~~~~~~~~~~~~~
@ -65,8 +65,7 @@ usage() {
usage: ${0##*/} [OPTION] usage: ${0##*/} [OPTION]
options: options:
-fast for repeated builds (-make -abspath -install) *use with caution* -fast for repeated builds (-make -install) *use with caution*
-abspath suppress the '-envpath' stage of changing the cmake files
-mpi with mpi (if not already enabled) -mpi with mpi (if not already enabled)
-python with python (if not already enabled) -python with python (if not already enabled)
-mesa with mesa (if not already enabled) -mesa with mesa (if not already enabled)
@ -77,8 +76,9 @@ For finer control, the build stages can be also selected individually
(mutually exclusive) (mutually exclusive)
-config -config
-make -make
-envpath -makedoc
-install -install
[-envpath] alter absolute paths in CMake files to use env variables
Build and install $PARAVIEW_SRC Build and install $PARAVIEW_SRC
- run from folder above the ParaView source folder or place the - run from folder above the ParaView source folder or place the
@ -88,16 +88,16 @@ USAGE
exit 1 exit 1
} }
# options based on the script name: # add options based on script name:
case "$Script" in *-fast*) CMAKE_SKIP=ON;; esac
case "$Script" in *-mpi*) WITH_MPI=ON;; esac case "$Script" in *-mpi*) WITH_MPI=ON;; esac
case "$Script" in *-python*) WITH_PYTHON=ON;; esac case "$Script" in *-python*) WITH_PYTHON=ON;; esac
case "$Script" in *-mesa*) WITH_MESA=ON;; esac case "$Script" in *-mesa*) WITH_MESA=ON;; esac
runCONFIG=true runCONFIG=true
runMAKE=true runMAKE=true
runENVPATH=true runMAKEDOC=true
runINSTALL=true runINSTALL=true
runENVPATH=false
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -109,42 +109,46 @@ do
-config) # stage 1: config only -config) # stage 1: config only
runCONFIG=true runCONFIG=true
runMAKE=false runMAKE=false
runENVPATH=false runMAKEDOC=false
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-make) # stage 2: make only -make) # stage 2: make only
runCONFIG=false runCONFIG=false
runMAKE=true runMAKE=true
runENVPATH=false runMAKEDOC=false
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-envpath) # stage 3: alter paths to use env variables -makedoc) # stage 3: generate html documentation
runCONFIG=false runCONFIG=false
runMAKE=false runMAKE=false
runENVPATH=true runMAKEDOC=true
runINSTALL=false runINSTALL=false
shift shift
;; ;;
-install) # stage 4: install only -install) # stage 4: install only
runCONFIG=false runCONFIG=false
runMAKE=false runMAKE=false
runENVPATH=false runMAKEDOC=false
runINSTALL=true runINSTALL=true
shift shift
;; ;;
-envpath) # optional: change cmake files to use env variables
runCONFIG=false
runMAKE=false
runMAKEDOC=false
runINSTALL=false
runENVPATH=true
shift
;;
-fast) # shortcut for rebuild -fast) # shortcut for rebuild
runCONFIG=false runCONFIG=false
runMAKE=true runMAKE=true
runENVPATH=false runMAKEDOC=false
runINSTALL=true runINSTALL=true
shift shift
;; ;;
-abspath) # suppress changing the cmake files
runENVPATH=false
shift
;;
-mpi) -mpi)
WITH_MPI=ON WITH_MPI=ON
shift shift
@ -181,8 +185,8 @@ getPaths # discover where things are or should be put
[ $runCONFIG = true ] && configParaView [ $runCONFIG = true ] && configParaView
[ $runMAKE = true ] && makeParaView [ $runMAKE = true ] && makeParaView
[ $runENVPATH = true ] && fixCMakeFiles [ $runENVPATH = true ] && fixCMakeFiles
[ $runMAKEDOC = true ] && makeDocs
[ $runINSTALL = true ] && installParaView [ $runINSTALL = true ] && installParaView
echo "done" echo "done"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -31,8 +31,13 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ParaView_INST_DIR : location of the original sources # ParaView_INST_DIR : location of the original sources
# ParaView_DIR : location of the compiled output # ParaView_DIR : location of the build (for the ParaViewConfig.cmake)
# and the installed program
#
# set CMake cache variables
#
addCMakeVariable() addCMakeVariable()
{ {
while [ -n "$1" ] while [ -n "$1" ]
@ -43,12 +48,18 @@ addCMakeVariable()
} }
#
# verbose makefiles
#
addVerbosity() addVerbosity()
{ {
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE [ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
} }
#
# define options for mpi support
#
addMpiSupport() addMpiSupport()
{ {
[ "$WITH_MPI" = ON ] || return [ "$WITH_MPI" = ON ] || return
@ -62,6 +73,9 @@ addMpiSupport()
} }
#
# define options for python support
#
addPythonSupport() addPythonSupport()
{ {
[ "$WITH_PYTHON" = ON ] || return [ "$WITH_PYTHON" = ON ] || return
@ -133,6 +147,9 @@ addPythonSupport()
} }
#
# define options for mesa support
#
addMesaSupport() addMesaSupport()
{ {
[ "$WITH_MESA" = ON ] || return [ "$WITH_MESA" = ON ] || return
@ -183,17 +200,23 @@ getPaths()
# ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
echo "ParaView_DIR=$ParaView_DIR" echo "ParaView_DIR=$ParaView_DIR"
} }
#
# configure via cmake, but don't actually build anything # configure via cmake, but don't actually build anything
#
configParaView() configParaView()
{ {
# remove any existing build folder and recreate # remove any existing build folder and recreate
rm -rf $ParaView_DIR if [ -d $ParaView_DIR ]
then
echo "removing old build/install directory"
rm -rf $ParaView_DIR
fi
mkdir -p $ParaView_DIR mkdir -p $ParaView_DIR
cd $ParaView_DIR cd $ParaView_DIR
echo "----" echo "----"
@ -221,10 +244,14 @@ configParaView()
} }
#
# invoke make
# also link bin/ to lib/paraview-* for development without installation
#
makeParaView() makeParaView()
{ {
# change to build/install folder cd $ParaView_DIR || exit 1 # change to build folder
cd $ParaView_DIR || exit 1
echo " Starting make" echo " Starting make"
if [ -r /proc/cpuinfo ] if [ -r /proc/cpuinfo ]
@ -237,11 +264,18 @@ makeParaView()
time make time make
fi fi
echo " Done make" echo " Done make"
echo " For quicker development, linking lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/"
rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
mkdir lib 2>/dev/null
( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
} }
# adjust hard-links #
# adjust hard-links (internal function)
# Note: use loop with grep to avoid touching too many files # Note: use loop with grep to avoid touching too many files
#
fixHardLinks() fixHardLinks()
{ {
envName=$1 envName=$1
@ -266,16 +300,14 @@ fixHardLinks()
} }
# This triggers a partial rebuild, but might let us find our files #
# replace absolute paths with environment variables
# This triggers a partial (or even a full) rebuild, but might let us
# find our files later if we relocate the build
#
fixCMakeFiles() fixCMakeFiles()
{ {
# change to build/install folder cd $ParaView_DIR || exit 1 # change to build folder
cd $ParaView_DIR || exit 1
# change to build/install folder
cd $ParaView_DIR || exit 1
echo " Installing ParaView"
# Replace path with env variable: ParaView_DIR # Replace path with env variable: ParaView_DIR
fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake' fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake'
@ -303,28 +335,36 @@ fixCMakeFiles()
} }
#
# make html documentation (mostly just for the readers/writers)
#
makeDocs()
{
cd $ParaView_DIR || exit 1 # change to build folder
echo " Creating html documentation"
make HTMLDocumentation
}
#
# actually install the program
#
installParaView() installParaView()
{ {
[ -e "$ParaView_DIR/bin/paraview" ] || { cd $ParaView_DIR || exit 1 # change to build folder
echo " Cannot install - no paraview binary found" echo " Installing ParaView to $ParaView_DIR"
return
}
# change to build/install folder echo "disabled 'make install' for now, just use links"
cd $ParaView_DIR || exit 1
echo " Installing ParaView" # about.txt may be missing
paraviewLibDir="$ParaView_DIR/lib/paraview-$PARAVIEW_MAJOR_VERSION"
if [ -d "$paraviewLibDir" -a ! -e "$paraviewLibDir/about.txt" ]
then
echo "paraview-$PARAVIEW_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt
fi
# skip the normal 'make install' in favour of simply creating cat<< INFO
# a softlink to the $ParaView_DIR/bin folder
# - this seems to keep things portable (except documentation)
echo " Creating link lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/ "
rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
mkdir lib 2>/dev/null
( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
# info on symlinks to screen
cat << INFO
--- ---
Installation complete Installation complete
Set environment variables: Set environment variables:
@ -333,17 +373,12 @@ cat << INFO
export ParaView_DIR=$ParaView_DIR export ParaView_DIR=$ParaView_DIR
export PV_PLUGIN_PATH=$FOAM_LIBBIN export PV_PLUGIN_PATH=$FOAM_LIBBIN
export PATH=\$ParaView_DIR/bin:\$PATH export PATH=\$ParaView_DIR/bin:\$PATH
---
NB: if you move the paraview installation, you will need to change this file
\$ParaView_DIR/bin/pqClientDocFinder.txt
--- ---
INFO INFO
} }
# clear all the variables used before using any of the functions # clear all the variables used before using any of the functions
unset VERBOSE unset VERBOSE
unset WITH_MPI WITH_MESA unset WITH_MPI WITH_MESA
unset WITH_PYTHON PYTHON_LIBRARY unset WITH_PYTHON PYTHON_LIBRARY