forked from syberos-team/syberh-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·95 lines (78 loc) · 1.81 KB
/
build.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
source ./build-env
current_dir=`pwd`
pro_path=${current_dir}/[[project]]/[[project]].pro
build_path=${current_dir}/build/[[project]]
cpu_num=4
pdk_path=''
if [ -d "$HOME/SyberOS-Pdk" ];then
pdk_path=$HOME/SyberOS-Pdk
elif [ -d "$HOME/Syberos-Pdk" ];then
pdk_path=$HOME/Syberos-Pdk
else
echo '未安装pdk'
exit 1;
fi
project_name=''
cmd_name=`basename $0`
usage(){
echo "Usage: $cmd_name [options]"
echo ''
echo ' -b 执行编译,参数为插件项目名'
echo ' -c 执行清理,参数为插件项目名'
echo ' -s 使用S1编译,无参'
}
get_sop_full_path(){
sop_path=$1
build_path=${build_path//'[[project]]'/$project_name}
if [ "" == "$sop_path" ];then
sop_path=`ls --file-type ${build_path}/*.sop |awk '{print i$0}'`
fi
echo $sop_path
}
exec_build(){
s1_arg=''
if [ "$1" == "y" ];then
s1_arg='--args DEFINES+=S1'
fi
pro_path=${pro_path//'[[project]]'/$project_name}
build_path=${build_path//'[[project]]'/$project_name}
python3 ./syberh-build.py build -b $build_path -p $pro_path -d $pdk_path -t $TARGET_NAME -n $cpu_num --args SYBERH_APP=$SYBERH_APP --args SOPID=$SOPID $s1_arg
}
exec_clear(){
python3 ./syberh-build.py clear -b ${build_path//'[[project]]'/$project_name}
}
ACTION=''
use_s1=''
while getopts 'b:c:s' arg;
do
case $arg in
b)
ACTION="build"
project_name="$OPTARG"
;;
c)
ACTION='clear'
project_name="$OPTARG"
;;
s)
use_s1='y'
;;
?)
usage
exit 0
;;
esac
done
if [ ! $ACTION ];then
usage
exit 0
fi
case $ACTION in
build)
exec_build $use_s1
;;
clear)
exec_clear $project_name
;;
esac