Skip to content

Provide build flags options to libraries #2908

Open
@Levi--G

Description

@Levi--G

Describe the request

I suggest adding the ability to add/remove platform properties (AKA "build properties", "compiler flags") and gui options via the library.properties metadata file.

My case

I created a PlatformIO library: https://github.com/Levi--G/USBLibrarySTM32. I am regularly asked to add support for using my library with Arduino IDE, but the lack of this capability makes it impossible for me to do so.

The reason is that the library requires the USB peripheral clock of the STM32 microcontroller to be enabled. This is controlled in the STM32 boards platform source code by preprocessor conditionals. So the library requires the -D USBCON and -D HAL_PCD_MODULE_ENABLED flags to be injected into the compilation commands.

Describe the current behavior

It is not possible for libraries to configure platform properties.

Arduino CLI version

63c44a4

Operating system

N/A

Operating system version

n/a

Additional context

Allowing the end user to set platform properties on a sketch level would be another solution.

Related

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions