Skip to content

Support custom compiler arguments #145

@Pennycook

Description

@Pennycook

Feature/behavior summary

CBI currently has very limited support for emulating the behaviors of other compilers. There are some hard-coded configurations in config.py, and users can provide unconditional definitions via the .cbi/config file.

We should provide a mechanism that allows users to define compiler behavior more precisely (e.g., by defining the behavior of specific flags). For example, a user could define that -std={something} defines a specific set of macros that are important to their application.

Request attributes

  • Would this be a refactor of existing code?
  • Does this proposal require new package dependencies?
  • Would this change break backwards compatibility?

Related issues

Solution description

Extend the .cbi/config schema to support the definition of additional compiler arguments.

One possibility would be to draw inspiration from argparse, supporting syntax like:

[[compiler."c++".parser]]
flags = ["-isystem", "-I"]
dest = "include_paths"
action = "append"

[[compiler."c++".parser]]
flags = ["-include"]
dest = "includes"
action = "append"

[[compiler."c++".parser]]
flags = ["-D"]
dest = "defines"
action = "append"

...but with a limited set of supported destination and action strings.

Additional notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions