-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConstruct
More file actions
76 lines (63 loc) · 2.48 KB
/
Copy pathSConstruct
File metadata and controls
76 lines (63 loc) · 2.48 KB
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
from pathlib import Path
import os, sys
import shutil
import socket
import platform
arch = platform.machine()
version = "v0.0.4"
static_lib = "static_lib"
update = False
if 'CardputerZero' in os.environ:
if not os.path.exists("build/config/config_tmp.mk"):
os.makedirs("build/config", exist_ok=True)
with open("build/config/config_tmp.mk", "w") as f:
f.write("CONFIG_V9_5_LV_USE_LINUX_FBDEV=y\n")
f.write("CONFIG_V9_5_LV_DRAW_SW_ASM_NEON=y\n")
f.write("CONFIG_V9_5_LV_USE_DRAW_SW_ASM=1\n")
f.write("CONFIG_V9_5_LV_USE_EVDEV=y\n")
# f.write('CONFIG_TOOLCHAIN_PATH="/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin"\n')
f.write('CONFIG_TOOLCHAIN_PREFIX="aarch64-linux-gnu-"\n')
f.write(f'''CONFIG_TOOLCHAIN_SYSROOT="{os.path.join(sys.path[0], "static_lib")}"\n''')
# x86_64 本地模拟器
elif arch != "aarch64":
if not os.path.exists("build/config/config_tmp.mk"):
os.makedirs("build/config", exist_ok=True)
with open("build/config/config_tmp.mk", "w") as f:
f.write("CONFIG_V9_5_LV_USE_SDL=y\n")
# CardputerZero 本机编译
else:
if not os.path.exists("build/config/config_tmp.mk"):
os.makedirs("build/config", exist_ok=True)
with open("build/config/config_tmp.mk", "w") as f:
f.write("CONFIG_V9_5_LV_USE_LINUX_FBDEV=y\n")
f.write("CONFIG_V9_5_LV_DRAW_SW_ASM_NEON=y\n")
f.write("CONFIG_V9_5_LV_USE_DRAW_SW_ASM=1\n")
f.write("CONFIG_V9_5_LV_USE_EVDEV=y\n")
local_path = Path(os.getcwd())
sdk_path = local_path.parent.parent / "SDK"
os.environ["SDK_PATH"] = str(sdk_path)
os.environ["EXT_COMPONENTS_PATH"] = str(sdk_path.parent / "ext_components")
env = SConscript(
str(sdk_path / "tools" / "scons" / "project.py"),
variant_dir=os.getcwd(),
duplicate=0,
)
if not os.path.exists(static_lib):
update = True
else:
try:
with open(str(Path(static_lib) / "version"), "r") as f:
if version != f.read().strip():
update = True
except:
update = True
if update:
with open(env["PROJECT_TOOL_S"]) as f:
exec(f.read())
down_url = "https://github.com/dianjixz/M5CardputerZero-UserDemo/releases/download/{}/sdk_bsp.tar.gz".format(
version
)
down_path = check_wget_down(down_url, "static_lib_{}.tar.gz".format(version))
if os.path.exists(static_lib):
shutil.rmtree(static_lib)
shutil.move(down_path, static_lib)