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
#------------------------------------------------------------------------------
# CMake into objectsDir with external dependency
# - This function override can be removed with OpenFOAM-1806
cmakeVersioned()
# - Can this function can be removed with OpenFOAM-1812 ?
unset -f cmakeVersionedInstall 2>/dev/null
cmakeVersionedInstall()
{
local depend="$1"
local sourceDir="$2"
local objectsDir
shift 2
# Where generated files are stored
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
......@@ -19,12 +21,27 @@ cmakeVersioned()
rm -rf "$objectsDir" > /dev/null 2>&1
mkdir -p $objectsDir \
&& (cd $objectsDir && _cmake $sourceDir && make) \
&& (cd $objectsDir && _cmake "$@" $sourceDir && make install) \
&& 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 "${PWD##*/} : $PWD"
echo
......@@ -43,7 +60,8 @@ elif [ -n "$depend" ]
then
if command -v cmake >/dev/null
then
cmakeVersioned "$depend" "$PWD" || {
echo "catalyst prefix : $prefix"
cmakeVersionedInstall "$depend" "$PWD" "$cmakeOpts" || {
echo
echo " WARNING: incomplete build of ParaView Catalyst"
echo
......
......@@ -28,16 +28,6 @@ else()
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
......@@ -47,8 +37,7 @@ message("Using ParaView = $ENV{ParaView_DIR}")
if (NOT PARAVIEW_USE_MPI)
message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====")
endif()
message("install libdir = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("install installdir = ${CMAKE_INSTALL_PREFIX}")
message("install prefix = ${CMAKE_INSTALL_PREFIX}")
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