-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·103 lines (83 loc) · 2.67 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
function usage
{
echo "usage: ./configure [options]"
echo "options:"
echo "-DLEMONADE_DIR=/path/of/install/"
echo "-DBUILDDIR=/path/to/build/LeMonADE/"
echo "-DLEMONADE_TESTS=ON/OFF"
echo "-DCMAKE_BUILD_TYPE=Release/Debug/Profil"
echo "default build directory is ./build"
echo "default install directory is /usr/local"
echo "default option for tests is OFF"
echo "default option for build type is Release"
}
#default values for build directory and install prefix
PWD_PATH=$(pwd)
BUILDDIR="build"
#INSTALLDIR_OPTION="-DINSTALLDIR_LEMONADE=/usr/local"
#TEST_ARGUMENT="-DLEMONADE_TESTS=OFF"
CMAKE_ARGUMENTS=""
#parse command line arguments
for arg in "$@"; do
case $arg in
-h | --help)
usage
exit
;;
-DLEMONADE_DIR=*)
CMAKE_ARGUMENTS+=${arg}" "
TESTOPTION=${arg#*=}
echo "LeMonADE is installed in "$TESTOPTION
;;
-DBUILDDIR=*)
BUILDDIR=${arg#*=}
echo "Build directory set to "$BUILDDIR
;;
-DLEMONADE_TESTS=*)
CMAKE_ARGUMENTS+=${arg}" "
TESTOPTION=${arg#*=}
echo "Compiling tests set to "$TESTOPTION
;;
-DCMAKE_BUILD_TYPE=*)
CMAKE_ARGUMENTS+=${arg}" "
BUILDOPTION=${arg#*=}
echo "Build type set to "$BUILDOPTION
;;
-DGSL_DIR=*)
CMAKE_ARGUMENTS+=${arg}" "
TESTOPTION=${arg#*=}
echo "GLS-lib is installed in "$TESTOPTION
;;
* )
echo "unknown parameter"
usage
exit
esac
shift # shift the found arg away.
done
#create build directory if it does not exist
if [ ! -d $BUILDDIR ]; then
mkdir -p $BUILDDIR
fi
echo "Arguments passed to cmake are "${CMAKE_ARGUMENTS}
(cd $BUILDDIR >/dev/null 2>&1 && cmake $CMAKE_ARGUMENTS $PWD_PATH)
########### set up the wrapper makefile ##################
cat > ./Makefile <<EOF
##############################################################
# CMake Project Wrapper Makefile #
##############################################################
SHELL := /bin/bash
RM := rm -r
all: ./${BUILDDIR}/Makefile
@ \$(MAKE) -C ${BUILDDIR}
.PHONY: all
./${BUILDDIR}/Makefile:
@ (cd ${BUILDDIR} >/dev/null 2>&1 && cmake ${CMAKE_ARGUMENTS} ${PWD_PATH})
clean:
@- \$(MAKE) --silent -C ${BUILDDIR} clean || true
.PHONY: clean
docs:
@ \$(MAKE) -C ${BUILDDIR} docs
.PHONY : docs
EOF