-
Notifications
You must be signed in to change notification settings - Fork 1
/
blade
executable file
·57 lines (52 loc) · 1.8 KB
/
blade
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
#!/usr/bin/env bash
# =========================================================================
# Copyright 2021 -- present Liam Huang (Yuuki) [[email protected]].
# Author: Liam Huang
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =========================================================================
set -e
LOCAL_CONF="build.conf"
if [ -f "${LOCAL_CONF}" ]; then
source ${LOCAL_CONF}
fi
COLOR_CYAN="\033[0;36m"
COLOR_YELLOW="\033[0;33m"
COLOR_NONE="\033[0m"
if [ "${1}x" = "testx" ]; then
shift
BUILD_DIR="blade-bin"
if [ ${#} -gt 0 ]; then
TESTS=${@}
else
TESTS="test benchmark"
fi
for TEST in ${TESTS}; do
FOCUS_DIR="./${BUILD_DIR}/${TEST}"
for exefile in $(find ${FOCUS_DIR} -maxdepth 1 -type f ! -name "*.ninja" 2>/dev/null); do
printf "RUNNING: ${COLOR_CYAN}${exefile}${COLOR_NONE}.\n"
${exefile}
done
done
else
BLADE="env BLADE_AUTO_UPGRADE=no ./thirdparty/blade-build/blade"
${BLADE} ${@}
if [ ${?} -ne 0 ]; then
printf "${COLOR_CYAN}You may need to modify ${COLOR_YELLOW}${LOCAL_CONF}${COLOR_CYAN} to use different compiler & linker${COLOR_NONE}.\n"
printf "For example: \n"
printf "${COLOR_YELLOW}export CPP=g++\n"
printf "${COLOR_YELLOW}export CXX=g++\n"
printf "${COLOR_YELLOW}export LD=g++\n"
printf "${COLOR_YELLOW}export CC=gcc\n"
fi
fi