blob: 2bfdadaeaf11b9da3ca70cabc0ccc5f48f59f3a4 (
plain) (
blame)
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
|
#!/bin/bash
##########################################################################
# File Name : compile-tiny.sh
# Encoding : utf-8
# Author : We-unite
# Email : weunite1848@gmail.com
# Created Time : 2024-04-16 13:06:58
##########################################################################
set -e
# 如果是root,报错
if [ $(id -u) -eq 0 ]; then
echo "Do not run as root"
exit 1
fi
if [ $# -ne 2 ]; then
echo "Usage: $0 <src file> [armv8-a|armv7-a]"
exit 1
fi
native=~/app/native
file=$1
targetFile=${file%.*}
arch=$2
case $arch in
armv8-a)
compiler=$native/llvm/bin/aarch64-unknown-linux-ohos
targetPlatform=aarch64-linux-ohos
;;
armv7-a)
compiler=$native/llvm/bin/armv7-unknown-linux-ohos
targetPlatform=arm-linux-ohos
;;
*)
echo "Unsupported arch"
exit 1
;;
esac
case ${file##*.} in
c)
compiler=$compiler-clang
;;
cpp)
compiler=$compiler-clang++
;;
*)
echo "Unsupported file type"
exit 1
;;
esac
export CPATH=
$compiler -o $targetFile $file -Wall \
--target=$targetPlatform \
--sysroot=$native/sysroot \
-march=$arch -mfloat-abi=softfp
|