-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.sh
executable file
·66 lines (55 loc) · 1.28 KB
/
run.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
61
62
63
64
65
66
#!/bin/sh
# Environment and parameters
mode=${1:-build}
config=${2:-dev} # Configuration is development by default
(uname -s | grep -iqE "mingw|cygwin|msys|windows") && windows=true || windows=false
# Stats action
if [ $mode = "stats" ] ; then
printf "Core file count: "
find src/* -type f | grep -E "\.(h|hpp|cpp|inl|def)$" | wc -l
printf "Core line count: "
find src/* -type f | grep -E "\.(h|hpp|cpp|inl|def)$" | xargs cat | wc -l
printf "Module count: "
find mod/* -maxdepth 0 -type d | wc -l
printf "Module line count: "
find mod/* -type f | grep -E "\.(h|hpp|cpp|inl|def)$" | xargs cat | wc -l
exit 0
fi
# Configuration
case $config in
"dbg")
exe="sample_dbg"
config=Debug
;;
"dev")
exe="sample_dev"
config=RelWithDebInfo
;;
"rls")
exe="sample"
config=Release
;;
*)
echo "Unknown configuration: $config"
exit 1;
;;
esac
mkdir -p bld
if (cd bld && cmake -DCMAKE_BUILD_TYPE=$config ..) ; then # Run CMake
if [ $mode = "open" ] ; then
if $windows; then
start ./bld/L.sln
exit 0
fi
fi
cmake --build bld --config $config
success=$?
if [ $success = 0 ] && [ $mode = "run" ] ; then
shift 2
(cd smp && ./$exe $*) # Execute program
success=$?
fi
exit $success
else # CMake failure
exit 1
fi