Commit 39500de6 authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: improve consistency between cmake and wmake approaches (issue #5)

- the build is now much more strongly oriented on cmake.

  The wmake wrapper only adds some minor versioning on the build
  and uses a standard CMAKE_INSTALL_PREFIX to define its installation
  location.

  These changes can make it easier for some packagers (eg, spack)
  to manage.
parent 2e3967cc
...@@ -4,12 +4,14 @@ cd "${0%/*}" || exit # Run from this directory ...@@ -4,12 +4,14 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# CMake into objectsDir with external dependency # CMake into objectsDir with external dependency
# - This function override can be removed with OpenFOAM-1806 # - Can this function can be removed with OpenFOAM-1812 ?
cmakeVersioned() unset -f cmakeVersionedInstall 2>/dev/null
cmakeVersionedInstall()
{ {
local depend="$1" local depend="$1"
local sourceDir="$2" local sourceDir="$2"
local objectsDir local objectsDir
shift 2
# Where generated files are stored # Where generated files are stored
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
...@@ -19,12 +21,27 @@ cmakeVersioned() ...@@ -19,12 +21,27 @@ cmakeVersioned()
rm -rf "$objectsDir" > /dev/null 2>&1 rm -rf "$objectsDir" > /dev/null 2>&1
mkdir -p $objectsDir \ mkdir -p $objectsDir \
&& (cd $objectsDir && _cmake $sourceDir && make) \ && (cd $objectsDir && _cmake "$@" $sourceDir && make install) \
&& echo "$depend" >| "${sentinel:-/dev/null}" && echo "$depend" >| "${sentinel:-/dev/null}"
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Installation prefix: user/group/other or custom
case "$1" in
-prefix=u) prefix="${FOAM_USER_LIBBIN%/*}" ;; # user
-prefix=g) prefix="${FOAM_SITE_LIBBIN%/*}" ;; # group
-prefix=o) prefix="${FOAM_LIBBIN%/*}" ;; # other/openfoam
-prefix=*) prefix="${1#*=}" ;;
esac
# Default is openfoam (FOAM_LIBBIN)
: "${prefix:=$WM_PROJECT_DIR/platforms/$WM_OPTIONS}"
cmakeOpts="-DCMAKE_INSTALL_PREFIX=$prefix"
#------------------------------------------------------------------------------
echo "======================================================================" echo "======================================================================"
echo "${PWD##*/} : $PWD" echo "${PWD##*/} : $PWD"
echo echo
...@@ -43,7 +60,8 @@ elif [ -n "$depend" ] ...@@ -43,7 +60,8 @@ elif [ -n "$depend" ]
then then
if command -v cmake >/dev/null if command -v cmake >/dev/null
then then
cmakeVersioned "$depend" "$PWD" || { echo "catalyst prefix : $prefix"
cmakeVersionedInstall "$depend" "$PWD" "$cmakeOpts" || {
echo echo
echo " WARNING: incomplete build of ParaView Catalyst" echo " WARNING: incomplete build of ParaView Catalyst"
echo echo
......
...@@ -28,16 +28,6 @@ else() ...@@ -28,16 +28,6 @@ else()
endif() endif()
#------------------------------------------------------------------------------
# Installation locations (not much)
# - default install into FOAM_LIBBIN
if ((NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) OR
("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "default"))
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $ENV{FOAM_LIBBIN})
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# All messages # All messages
...@@ -47,8 +37,7 @@ message("Using ParaView = $ENV{ParaView_DIR}") ...@@ -47,8 +37,7 @@ message("Using ParaView = $ENV{ParaView_DIR}")
if (NOT PARAVIEW_USE_MPI) if (NOT PARAVIEW_USE_MPI)
message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====") message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====")
endif() endif()
message("install libdir = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") message("install prefix = ${CMAKE_INSTALL_PREFIX}")
message("install installdir = ${CMAKE_INSTALL_PREFIX}")
message("================") message("================")
......
Markdown is supported
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