Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 711632a

Browse files
bernhardmgruberhageboeck
andcommitted
Add a script to check your setup for the exercises
Fixes: #455 Co-authored-by: Stephan Hageboeck <stephan.hageboeck@cern.ch>
1 parent d83ac0b commit 711632a

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

‎code/check_setup.sh‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
RED='033円[0;31m'
4+
YEL='033円[0;33m'
5+
NORMAL='033円[0m'
6+
COL=12
7+
8+
exit_status=0
9+
10+
# from: https://stackoverflow.com/a/4024263
11+
function version_less() {
12+
[ "1ドル" = "`echo -e "1ドル\n2ドル" | sort -V | head -n1`" ]
13+
}
14+
15+
function check_tool() {
16+
min_version=2ドル || "0"
17+
required=3ドル || true
18+
if [ -x "$(command -v 1ドル)" ]
19+
then
20+
version=$(1ドル --version | grep -o -E "[0-9]+.[0-9]+(.[0-9]+)?" | head -1)
21+
if version_less $version $min_version
22+
then
23+
printf "%-${COL}s found, ${RED}version: ${version}, need at least: ${min_version}${NORMAL}\n" 1ドル
24+
else
25+
printf "%-${COL}s found, version: ${version}\n" 1ドル
26+
return 0
27+
fi
28+
elif $required
29+
then
30+
printf "${RED}%-${COL}s not found, but required${NORMAL}\n" 1ドル
31+
exit_status=1
32+
else
33+
printf "${YEL}%-${COL}s not found, but optional${NORMAL}\n" 1ドル
34+
fi
35+
return 1
36+
}
37+
38+
# compiler
39+
check_tool g++ 10.0.0 false || check_tool clang++ 11.0.0 false || { echo -e "${RED}No supported compiler found${NORMAL}"; exit_status=1; } # clang does not work for header_units exercise
40+
41+
# build tools
42+
check_tool make
43+
check_tool cmake 3.12.0
44+
check_tool ccmake 3.12.0 false
45+
46+
# debugger
47+
check_tool gdb 10.0.0 false || check_tool lldb 11.0.0 false || { echo -e "${RED}No supported debugger found${NORMAL}"; exit_status=1; }
48+
49+
# utils
50+
check_tool nm
51+
check_tool ldd 0.0 false || check_tool otool 0.0 false || { echo -e "${RED}Missing ldd or otool${NORMAL}"; exit_status=1; }
52+
53+
# tools
54+
check_tool valgrind
55+
check_tool kcachegrind
56+
check_tool cppcheck
57+
check_tool clang-format
58+
check_tool clang-tidy
59+
check_tool python3
60+
61+
exit $exit_status

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /