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

View File

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

View File

@ -31,8 +31,13 @@
#------------------------------------------------------------------------------
# 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()
{
while [ -n "$1" ]
@ -43,12 +48,18 @@ addCMakeVariable()
}
#
# verbose makefiles
#
addVerbosity()
{
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
}
#
# define options for mpi support
#
addMpiSupport()
{
[ "$WITH_MPI" = ON ] || return
@ -62,6 +73,9 @@ addMpiSupport()
}
#
# define options for python support
#
addPythonSupport()
{
[ "$WITH_PYTHON" = ON ] || return
@ -133,6 +147,9 @@ addPythonSupport()
}
#
# define options for mesa support
#
addMesaSupport()
{
[ "$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
echo "ParaView_DIR=$ParaView_DIR"
}
#
# configure via cmake, but don't actually build anything
#
configParaView()
{
# remove any existing build folder and recreate
if [ -d $ParaView_DIR ]
then
echo "removing old build/install directory"
rm -rf $ParaView_DIR
fi
mkdir -p $ParaView_DIR
cd $ParaView_DIR
echo "----"
@ -221,10 +244,14 @@ configParaView()
}
#
# invoke make
# also link bin/ to lib/paraview-* for development without installation
#
makeParaView()
{
# change to build/install folder
cd $ParaView_DIR || exit 1
cd $ParaView_DIR || exit 1 # change to build folder
echo " Starting make"
if [ -r /proc/cpuinfo ]
@ -237,11 +264,18 @@ makeParaView()
time make
fi
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
#
fixHardLinks()
{
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()
{
# change to build/install folder
cd $ParaView_DIR || exit 1
# change to build/install folder
cd $ParaView_DIR || exit 1
echo " Installing ParaView"
cd $ParaView_DIR || exit 1 # change to build folder
# Replace path with env variable: ParaView_DIR
fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake'
@ -303,27 +335,35 @@ fixCMakeFiles()
}
installParaView()
#
# make html documentation (mostly just for the readers/writers)
#
makeDocs()
{
[ -e "$ParaView_DIR/bin/paraview" ] || {
echo " Cannot install - no paraview binary found"
return
cd $ParaView_DIR || exit 1 # change to build folder
echo " Creating html documentation"
make HTMLDocumentation
}
# change to build/install folder
cd $ParaView_DIR || exit 1
echo " Installing ParaView"
#
# actually install the program
#
installParaView()
{
cd $ParaView_DIR || exit 1 # change to build folder
echo " Installing ParaView to $ParaView_DIR"
# skip the normal 'make install' in favour of simply creating
# 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 )
echo "disabled 'make install' for now, just use links"
# 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
# info on symlinks to screen
cat<< INFO
---
Installation complete
@ -333,17 +373,12 @@ cat << INFO
export ParaView_DIR=$ParaView_DIR
export PV_PLUGIN_PATH=$FOAM_LIBBIN
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
}
# clear all the variables used before using any of the functions
unset VERBOSE
unset WITH_MPI WITH_MESA
unset WITH_PYTHON PYTHON_LIBRARY