Giter Site home page Giter Site logo

Comments (3)

per1234 avatar per1234 commented on July 23, 2024 1

Hi @FredM67. You can add arbitrary flags to the arduino-cli compile command used to compile the sketch via the action's cli-compile-flags input:

https://github.com/arduino/compile-sketches#cli-compile-flags

You can learn the available flags from the Arduino CLI documentation:

https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/#options

In this case, the flag of interest is --build-property. Depending on which boards platform you are using, you may be able to use the compiler.cpp.extra_flags build property to add additional flags to the compilation command. So if you wanted to add the -std=gnu++17 flag to the compilation command, you would add this to your workflow under the with key of the step that runs the arduino/compile-sketches action:

cli-compile-flags: |
  - --build-property
  - compiler.cpp.extra_flags=-std=gnu++17

Please note that usability of build properties is dependent on how each boards platform author has configured their platform. Providing customization of the compilation command via compiler.cpp.extra_flags, etc. build properties is a common convention established by Arduino's official boards platforms, but there is no guarantee of that. Some platform authors have also unnecessarily used the properties for their own purposes (arduino/arduino-cli#846). So this is an advanced usage and you should make sure to study the boards platform to make sure it supports this.

from compile-sketches.

FredM67 avatar FredM67 commented on July 23, 2024
cli-compile-flags: |
  - --build-property
  - compiler.cpp.extra_flags=-std=gnu++17

Thx a LOT for the example.... I've tried every possible combinaison, but couldn't find the right way to add this flag.
I think, a sample should be added to the doc !

from compile-sketches.

per1234 avatar per1234 commented on July 23, 2024

You are welcome.

I completely agree that the general usage of this input is not adequately documented. A pull request adding an example. I would not use something so complex as --build-property, but I do think demonstrating the correct way to pass flag that have an argument is important. So I think the best candidate for the example would be --output-dir

from compile-sketches.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.