Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile-sketches uses gnu++11... #85

Closed
3 tasks done
FredM67 opened this issue Nov 21, 2022 · 3 comments
Closed
3 tasks done

compile-sketches uses gnu++11... #85

FredM67 opened this issue Nov 21, 2022 · 3 comments
Assignees
Labels
type: support OT: Request for help using the project

Comments

@FredM67
Copy link

FredM67 commented Nov 21, 2022

Describe the problem

My sketches need to set gnu++17 instead of gnu++11 in the platform.txt file.

How to do the same when compiling on GitHub?

To reproduce

Compile some sketches with a c++17 feature, not available in c++11.

Expected behavior

It should be possible to overwrite the c++ version used to compile.

'arduino/compile-sketches' version

latest

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details
@FredM67 FredM67 added the type: imperfection Perceived defect in any part of project label Nov 21, 2022
@per1234
Copy link
Collaborator

per1234 commented Nov 21, 2022

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.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2022
@per1234 per1234 self-assigned this Nov 21, 2022
@per1234 per1234 added type: support OT: Request for help using the project and removed type: imperfection Perceived defect in any part of project labels Nov 21, 2022
@FredM67
Copy link
Author

FredM67 commented Nov 21, 2022

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 !

@per1234
Copy link
Collaborator

per1234 commented Nov 21, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: support OT: Request for help using the project
Projects
None yet
Development

No branches or pull requests

2 participants