Skip to content

Builder

Delegates compilation to Platform.build() and returns structured build results.

builder

Build orchestration for gen_dsp projects.

Uses the platform registry to dynamically select the appropriate build system for each platform.

BuildResult dataclass

BuildResult(
    success: bool,
    platform: str,
    output_file: Optional[Path],
    stdout: str,
    stderr: str,
    return_code: int,
)

Result of a build operation.

Builder

Builder(project_dir: Path | str)

Build gen_dsp projects.

Initialize builder with project directory.

Parameters:

Name Type Description Default
project_dir Path | str

Path to the gen_dsp project directory.

required

build

build(
    target_platform: str = "pd",
    clean: bool = False,
    verbose: bool = False,
) -> BuildResult

Build the project for the specified platform.

Parameters:

Name Type Description Default
target_platform str

Platform name (e.g., 'pd', 'max').

'pd'
clean bool

If True, clean before building.

False
verbose bool

If True, print build output in real-time.

False

Returns:

Type Description
BuildResult

BuildResult with build status and output file path.

Raises:

Type Description
BuildError

If build fails and cannot be recovered.

ValueError

If platform is not recognized.

clean

clean(target_platform: str = 'pd') -> None

Clean build artifacts.

Parameters:

Name Type Description Default
target_platform str

Platform name (e.g., 'pd', 'max').

'pd'

get_lib_name

get_lib_name() -> Optional[str]

Get the lib.name from the project Makefile.

Returns:

Type Description
Optional[str]

The lib.name value or None if not found.