forked from eXistence/fhDOOM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmake_linux.sh
60 lines (47 loc) · 1.18 KB
/
cmake_linux.sh
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
#!/bin/sh
BUILD_DIR=build/gcc/debug
DIRECTORY="gcc"
BUILDTYPE="debug"
CMAKE_BUILD_TYPE="Debug"
CMAKE_GENERATOR="Sublime Text 2 - Unix Makefiles"
if [ "$#" -ne "2" ]; then
echo "Usage cmake_linux.sh <gcc|clang|clang-libc++> <debug|release|reldeb>"
exit 1
fi
if [ "$#" -ge "1" ]; then
if [ "$1" = "gcc" ]; then
export CXX="g++"
export CC="gcc"
DIRECTORY="gcc"
fi
if [ "$1" = "clang" ]; then
export CXX="clang++"
export CC="clang"
DIRECTORY="clang"
CMAKE_CXX_FLAGS="-stdlib=libstdc++"
fi
if [ "$1" = "clang-libc++" ]; then
export CXX="clang++"
export CC="clang"
DIRECTORY="clang-libc++"
CMAKE_CXX_FLAGS="-stdlib=libc++"
fi
fi
if [ "$#" -ge "2" ]; then
if [ "$2" = "debug" ]; then
BUILDTYPE="debug"
CMAKE_BUILD_TYPE="Debug"
fi
if [ "$2" = "release" ]; then
BUILDTYPE="release"
CMAKE_BUILD_TYPE="Release"
fi
if [ "$2" = "reldeb" ]; then
BUILDTYPE="relwithdebinfo"
CMAKE_BUILD_TYPE="relwithdebinfo"
fi
fi
BUILDDIR=build/$DIRECTORY/$BUILDTYPE
mkdir -p $BUILDDIR
cd $BUILDDIR
cmake -G"$CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" ../../..