[Simplifier] using CastSimplifier
[ozulis.git] / configure
bloba9598fa6eb4b935b1f53cb16e64f691d5b633615
1 #! /bin/sh
3 ROOTDIR="$PWD"
4 BUILDDIR=build
5 VERBOSE=OFF
6 COLOR=ON
7 CCACHE=ON
8 DEBUG=1
9 MAKEOPT="--quiet -j$(($(grep processor /proc/cpuinfo | wc -l) + 1))"
10 CPPFLAGS=""
11 CFLAGS="-W -Wall -Wstrict-prototypes -pipe"
12 CFLAGS="$CFLAGS -Wfloat-equal -Wundef -Wshadow -Wpointer-arith"
13 CFLAGS="$CFLAGS -Wmissing-declarations -Wnested-externs"
14 CFLAGS="$CFLAGS -Wmissing-prototypes -fPIC"
15 CXXFLAGS="-W -Wall -pipe -Wundef -Wshadow -Wpointer-arith -Wabi -std=c++0x -fPIC"
16 LDFLAGS=""
17 PREFIX="/usr/local"
18 QTCREATOR=0
20 function usage()
22 echo -n "usage: $0
23 --verbose verbose Makefiles
24 --no-color no colors
25 --release disable debug
26 --debug enables debug
27 --qt-creator generate build dir for qt-creator
29 --builddir=<dir> the build directory
30 --prefix=<dir> the installation prefix path
31 --bindir=<dir> the installation binary path
32 --libdir=<dir> the installation library path
33 --plugindir=<dir> the installation plugin path
35 exit
38 function update_install_path()
40 eval 'if [[ -z "$'"$1"'" ]] ; then
41 '"$1"'="${PREFIX}/$2"
42 fi'
45 until [[ $# -eq 0 ]] ;
47 case "$1" in
48 --verbose)
49 VERBOSE=ON
50 MAKEOPT="$(echo $MAKEOPT | sed s,--quiet,,g)"
52 --no-color)
53 COLOR=OFF
55 --release)
56 DEBUG=0
58 --debug)
59 DEBUG=1
61 --ccache)
62 CCACHE=ON
64 --no-ccache)
65 CCACHE=OFF
67 --qt-creator)
68 QTCREATOR=1
70 --build-dir=*)
71 BUILDDIR="${1/--build-dir=/}"
73 --prefix=*)
74 PREFIX="${1/--prefix=/}"
76 --libdir=*)
77 LIBDIR="${1/--libdir=/}"
79 --plugindir=*)
80 PLUGINDIR="${1/--plugindir=/}"
82 --bindir=*)
83 BINDIR="${1/--bindir=/}"
85 -h|--help|help)
86 usage
89 echo wrong argument "$1"
90 usage
92 esac
93 shift
94 done
96 update_install_path LIBDIR lib
97 update_install_path PLUGINDIR lib/ozulis
98 update_install_path BINDIR bin
100 if ! which ccache 2>&1 >/dev/null; then
101 CCACHE=OFF
104 if [[ $DEBUG -eq 0 ]]; then
105 CFLAGS="$CFLAGS -DNDEBUG -O2 -fomit-frame-pointer -ftree-vectorize"
106 CXXFLAGS="$CXXFLAGS -DNDEBUG -O2 -fomit-frame-pointer -ftree-vectorize"
107 else
108 CFLAGS="$CFLAGS -ggdb3"
109 CXXFLAGS="$CXXFLAGS -ggdb3"
112 if [[ $CCACHE = "ON" ]] ; then
113 mkdir -p .ccache
114 ln -sf "$(which ccache)" .ccache/g++
115 ln -sf "$(which ccache)" .ccache/gcc
116 export CC="$PWD/.ccache/gcc"
117 export CXX="$PWD/.ccache/g++"
120 if [[ $QTCREATOR -eq 1 ]] ; then
121 CMAKE_GENERATOR="-GCodeBlocks - Unix Makefiles"
122 else
123 CMAKE_GENERATOR="-GUnix Makefiles"
126 CPPFLAGS="${CPPFLAGS} -DOZULIS_PREFIX=\\\"${PREFIX}\\\" -DOZULIS_LIBDIR=\\\"${LIBDIR}\\\" -DOZULIS_PLUGINDIR=\\\"${PLUGINDIR}\\\" -DOZULIS_BINDIR=\\\"${BINDIR}\\\""
127 CFLAGS="${CPPFLAGS} ${CFLAGS}"
128 CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}"
130 export CPPFLAGS
131 export CFLAGS
132 export CXXFLAGS
133 export LDFLAGS
134 rm -rf "$BUILDDIR"
135 mkdir "$BUILDDIR" &&
136 cd "$BUILDDIR" &&
137 cmake "$CMAKE_GENERATOR" "$ROOTDIR"
138 cmake \
139 -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE \
140 -DCMAKE_COLOR_MAKEFILE=$COLOR \
141 -DCMAKE_INSTALL_PREFIX="$PREFIX" \
144 cd "$ROOTDIR" &&
145 cat >config.mk <<EOF
146 BUILDDIR=$BUILDDIR
147 MAKEOPT=$MAKEOPT
149 rm -f ozulis
150 ln -sf "$BINDIR/ozulis"
151 ln -sf "$BUILDDIR/src/moulette/moulette" moulette