Initialize git
This commit is contained in:
30
support/hardware_build_extra.py
Normal file
30
support/hardware_build_extra.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import glob, os, shutil, fileinput
|
||||
import datetime
|
||||
|
||||
|
||||
sep = os.sep
|
||||
|
||||
Import("env", "projenv")
|
||||
print("Post build scripts > hardware_build_extra.py")
|
||||
|
||||
def after_upload(source, target, env):
|
||||
env_name = str(source[0]).split(sep)[-2]
|
||||
print(f"Copying files from action {target[0]} for {env_name}")
|
||||
|
||||
dest_dir = f"test{sep}hardware"
|
||||
os.makedirs(dest_dir, exist_ok=True)
|
||||
|
||||
extensions = ['elf', 'bin', 'uf2']
|
||||
for ext in extensions:
|
||||
src_file = f".pio{sep}build{sep}{env_name}{sep}firmware.{ext}"
|
||||
dest_file = f"{dest_dir}{sep}{env_name}.{ext}"
|
||||
if os.path.isfile(src_file):
|
||||
shutil.copyfile(src_file, dest_file)
|
||||
else:
|
||||
print(f"Source file {src_file} does not exist.")
|
||||
|
||||
e = datetime.datetime.now()
|
||||
print(e.strftime("%H:%M:%S %d-%m-%Y"))
|
||||
|
||||
env.AddPostAction("upload", after_upload)
|
||||
env.AddPostAction("buildprog", after_upload)
|
||||
25
support/header_gen.py
Normal file
25
support/header_gen.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
|
||||
# Folders to scan
|
||||
include_dirs = [
|
||||
"src/apps",
|
||||
"src/games",
|
||||
"src/faces"
|
||||
]
|
||||
|
||||
# Output header file
|
||||
output_file = "src/common/generated_features.h"
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write("// Auto-generated header includes\n// DO NOT EDIT this file\n// It will be overwritten\n")
|
||||
for directory in include_dirs:
|
||||
|
||||
tp = directory.replace("src/", "")
|
||||
f.write(f"\n// {tp}\n")
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith(".h"):
|
||||
rel_path = os.path.join(root, file).replace("\\", "/").replace("src/", "../")
|
||||
f.write(f'#include "{rel_path}"\n')
|
||||
|
||||
print(f"🔄 Generated: {output_file}")
|
||||
48
support/sdl2_build_extra.py
Normal file
48
support/sdl2_build_extra.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import glob, os, shutil, fileinput
|
||||
import datetime
|
||||
|
||||
|
||||
sep = os.sep
|
||||
|
||||
Import("env", "projenv")
|
||||
|
||||
for e in [ env, projenv ]:
|
||||
# If compiler uses `-m32`, propagate it to linker.
|
||||
# Add via script, because `-Wl,-m32` does not work.
|
||||
if "-m32" in e['CCFLAGS']:
|
||||
e.Append(LINKFLAGS = ["-m32"])
|
||||
# e.Append(LINKFLAGS = ["-mwindows"])
|
||||
|
||||
exec_name = "${BUILD_DIR}/${PROGNAME}${PROGSUFFIX}"
|
||||
|
||||
# Override unused "upload" to execute compiled binary
|
||||
from SCons.Script import AlwaysBuild
|
||||
AlwaysBuild(env.Alias("upload", exec_name, exec_name))
|
||||
|
||||
# Add custom target to explorer
|
||||
env.AddTarget(
|
||||
name = "execute",
|
||||
dependencies = exec_name,
|
||||
actions = exec_name,
|
||||
title = "Execute",
|
||||
description = "Build and execute",
|
||||
group="General"
|
||||
)
|
||||
|
||||
def after_upload(source, target, env):
|
||||
|
||||
env_prog = str(source[0]).split(sep)[-1]
|
||||
env_name = str(source[0]).split(sep)[-2]
|
||||
print(f"Copying file from action {target[0]} for {env_name}")
|
||||
|
||||
dest_dir = f"test{sep}{env_name}"
|
||||
os.makedirs(dest_dir, exist_ok=True)
|
||||
|
||||
shutil.copyfile(f".pio{sep}build{sep}{env_name}{sep}{env_prog}", f"test{sep}{env_name}{sep}{env_prog}")
|
||||
e = datetime.datetime.now()
|
||||
print (e.strftime("%H:%M:%S %d-%m-%Y"))
|
||||
|
||||
|
||||
|
||||
env.AddPostAction("upload", after_upload)
|
||||
env.AddPostAction("buildprog", after_upload)
|
||||
Reference in New Issue
Block a user