From 6151df3ef1ce6b2facc36ef9b690505d8d1db783 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Tue, 16 Dec 2008 13:20:53 +0100 Subject: [PATCH] paraview build - reworking build/install directories --- bin/buildParaView3.5-cvs | 40 ++++--- ...{buildParaView3.3-cvs => buildParaView3.4} | 42 +++---- bin/tools/buildParaViewFunctions | 107 ++++++++++++------ 3 files changed, 116 insertions(+), 73 deletions(-) rename bin/tools/{buildParaView3.3-cvs => buildParaView3.4} (87%) diff --git a/bin/buildParaView3.5-cvs b/bin/buildParaView3.5-cvs index 5f953beaa19..707287a9818 100755 --- a/bin/buildParaView3.5-cvs +++ b/bin/buildParaView3.5-cvs @@ -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" - #------------------------------------------------------------------------------ diff --git a/bin/tools/buildParaView3.3-cvs b/bin/tools/buildParaView3.4 similarity index 87% rename from bin/tools/buildParaView3.3-cvs rename to bin/tools/buildParaView3.4 index cb28eb952f8..87b993d539c 100755 --- a/bin/tools/buildParaView3.3-cvs +++ b/bin/tools/buildParaView3.4 @@ -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" - #------------------------------------------------------------------------------ diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions index dbbd73c1f3e..ee4099691ae 100644 --- a/bin/tools/buildParaViewFunctions +++ b/bin/tools/buildParaViewFunctions @@ -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 - rm -rf $ParaView_DIR + 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,28 +335,36 @@ 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" - # change to build/install folder - cd $ParaView_DIR || exit 1 + make HTMLDocumentation +} - echo " Installing ParaView" - # 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 ) +# +# actually install the program +# +installParaView() +{ + cd $ParaView_DIR || exit 1 # change to build folder + echo " Installing ParaView to $ParaView_DIR" + + echo "disabled 'make install' for now, just use links" - # info on symlinks to screen -cat << INFO + # 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 + +cat<< INFO --- Installation complete Set environment variables: @@ -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 -- GitLab