feat: Integrate LVGL v8.3 desktop GUI, PS/2 mouse driver, live system monitor, and make gui target
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import subprocess
|
||||
import concurrent.futures
|
||||
|
||||
def main():
|
||||
cc = sys.argv[1] if len(sys.argv) > 1 else "gcc"
|
||||
cflags_str = sys.argv[2] if len(sys.argv) > 2 else ""
|
||||
build_dir = sys.argv[3] if len(sys.argv) > 3 else "build"
|
||||
|
||||
cflags = [f for f in cflags_str.split() if f]
|
||||
lvgl_obj_dir = os.path.join(build_dir, "lvgl")
|
||||
target_lib = os.path.join(build_dir, "liblvgl.a")
|
||||
|
||||
srcs = sorted(glob.glob("lib/lvgl/src/**/*.c", recursive=True))
|
||||
tasks = []
|
||||
|
||||
for src in srcs:
|
||||
rel = os.path.relpath(src, "lib/lvgl")
|
||||
obj = os.path.join(lvgl_obj_dir, os.path.splitext(rel)[0] + ".o")
|
||||
os.makedirs(os.path.dirname(obj), exist_ok=True)
|
||||
tasks.append((src, obj))
|
||||
|
||||
def compile_task(item):
|
||||
src, obj = item
|
||||
if not os.path.exists(obj) or os.path.getmtime(src) > os.path.getmtime(obj):
|
||||
cmd = [cc] + cflags + ["-Ilib/lvgl", "-O2", "-c", src, "-o", obj]
|
||||
res = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if res.returncode != 0:
|
||||
print(f"[ERR] Failed to compile {src}:\n{res.stderr}", file=sys.stderr)
|
||||
return False
|
||||
return True
|
||||
|
||||
cpu_count = min(os.cpu_count() or 4, 16)
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=cpu_count) as ex:
|
||||
results = list(ex.map(compile_task, tasks))
|
||||
|
||||
if not all(results):
|
||||
sys.exit(1)
|
||||
|
||||
all_objs = [obj for _, obj in tasks]
|
||||
subprocess.run(["ar", "rcs", target_lib] + all_objs, check=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user