I don’t think you can pass additional flags to the cloud compiler, but you can do it locally by setting the
EXTRA_CFLAGS environment variable.
If you’re looking for a premade solution you may be interested in neopo, an unofficial toolchain management utility compatible with Particle Workbench and Particle CLI projects that I maintain.
Neopo makes it incredibly simple to download and use the Particle toolchains to locally create, build, and flash Particle projects while providing many additional features. (It also facilitates the usage of Particle Workbench on unsupported Linux distributions.)
The following is an example of using neopo to create a project, set
EXTRA_CFLAGS, and then build the project, downloading toolchains on the fly if necessary:
$ neopo create myProject boron 2.0.1
$ cd myProject
$ neopo flags "-DSOME_VAR=7"
$ neopo compile
I keep the man page (available online) and the
neopo help text up to date. If you face any problems while using neopo, feel free to open an issue on the GitHub repo, or message me here on the Particle forums.
To get quick help for a neopo command you can use the
help command in a similar way to Particle CLI. For example, to get help on the
$ neopo help compile
Compile the current or specified project locally
Usage: neopo compile [project] [verbosity]
-v Verbose compiler output
-q Quiet compiler output