Allwmake 1.78 KB
Newer Older
1
2
3
4
5
6
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions

7
8
9
# Ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ]  && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
10

11
12
13
14
15
echo
echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
    local sourceDir="$1"

    findObjectDir $sourceDir # Where are generated files stored?
    test -f "$objectsDir/CMakeCache.txt"
    retry=$? # CMakeCache.txt exists, but sources may have moved

    mkdir -p $objectsDir && \
    (
        cd $objectsDir || exit 1

        cmake $sourceDir || {
            if [ $retry -eq 0 ]
            then
                echo "Removing CMakeCache.txt and attempt again"
                rm -f CMakeCache.txt
                cmake $sourceDir
            else
                exit 1
            fi
        } && make
    )
}


45
if [ -d "$VTK_DIR" -o -d "$ParaView_DIR" ]
46
then
47
    if [ "$targetType" != objects ]
48
    then
49
50
51
52
53
54
55
56
57
58
        if type cmake > /dev/null 2>&1
        then
            doCmake $PWD || {
                echo
                echo "    WARNING: incomplete build of VTK-based post-processing"
                echo
            }
        else
            echo "WARNING: skipped - needs cmake"
        fi
59
    fi
60
else
61
62
63
    echo "WARNING: skipped - needs a VTK or a ParaView installation"
    echo "    - For ParaView  : export the 'ParaView_DIR' variable"
    echo "    - For VTK       : export the 'VTK_DIR'      variable"
64
65
fi

66
67
68
echo "======================================================================"
echo

69
# -----------------------------------------------------------------------------