Allwmake 2.07 KB
Newer Older
1 2 3 4 5
#!/bin/sh
cd ${0%/*} || exit 1                            # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions  # The cmake functions

# CMake into objectsDir with external dependency
6 7 8 9 10 11 12 13
#
# 1 - depend
# 2 - sourceDir
# 3... optional cmake defines
#
# Available directly in OpenFOAM-1812 but left here for a while
# to ensure we can build with slightly older versions too (2018-11-29)
#
14 15
unset -f cmakeVersionedInstall 2>/dev/null
cmakeVersionedInstall()
16 17 18
{
    local depend="$1"
    local sourceDir="$2"
19
    shift 2
20
    local objectsDir sentinel
21 22 23 24 25 26 27 28

    # Where generated files are stored
    objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal

    # Version changed
    sentinel=$(sameDependency "$depend" "$sourceDir") || \
        rm -rf "$objectsDir" > /dev/null 2>&1

29 30
    mkdir -p "$objectsDir" \
    && (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
31 32 33 34 35 36 37 38 39
    && echo "$depend" >| "${sentinel:-/dev/null}"
}

# -----------------------------------------------------------------------------

echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo

40 41 42 43 44 45 46 47 48 49
# For FOAM_LIBBIN
cmakeOpts="-DCMAKE_INSTALL_PREFIX=$WM_PROJECT_DIR/platforms/$WM_OPTIONS"

# or
# cmakeOpts="-DCMAKE_INSTALL_PREFIX=${FOAM_LIBBIN%/*}"

# For FOAM_USER_LIBBIN
# cmakeOpts="-DCMAKE_INSTALL_PREFIX=${FOAM_USER_LIBBIN%/*}"


50 51 52 53 54 55 56 57 58 59 60 61
unset depend
if [ -d "$ParaView_DIR" ]
then
    depend="ParaView_DIR=$ParaView_DIR"
fi

if [ -n "$depend" ]
then
    if [ "$targetType" != objects ]
    then
        if command -v cmake > /dev/null 2>&1
        then
62
            cmakeVersionedInstall "$depend" "$PWD" "$cmakeOpts" || {
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
                echo
                echo "    WARNING: incomplete build of ParaView Catalyst"
                echo
            }
        else
            echo "WARNING: skipped - needs cmake"
        fi
    fi
else
    echo "WARNING: skip ParaView Catalyst (missing or incorrrect ParaView)"
fi

echo "======================================================================"

# -----------------------------------------------------------------------------