Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions ner_environment/build_system/build_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,32 @@ def build(profile: str = typer.Option(None, "--profile", "-p", callback=unsuppor
if not clean and is_cmake:
fix_compile_commands()

# ==============================================================================
# CGEN command
# ==============================================================================

@app.command(help="Generate CGEN code for your project")
def cgen(path: Path = typer.Option(Path("./Core"), "--output-path","-o", help="Output path for generated files (must contain Inc and Src subdirectories"),
project: str | None = typer.Option(None, "--project", "-p", help="The project/node to generate for. This will autodetect project if unset.")):
def generate_project() -> str:
curr_project = os.path.basename(os.getcwd())
if curr_project == "TSECU-Shepherd":
return "BMS"
if curr_project == "Cerberus-2.0":
return "VCU"
if curr_project == "Lightning":
return "Lightning"
if curr_project == "MSB-FW-2":
return "MSB"
print("[bold red] Error: No valid project found")
sys.exit(1)

if project is None:
project = generate_project()

run_command(["python3", "./Drivers/Odyssey-Definitions/code-gen/codegen.py", project, path], stream_output=True)


# ==============================================================================
# Clang command
# ==============================================================================
Expand Down