How do you set up the photon to use both the CLI and the web app at the same time?
Also how do I properly set up and compile using the CLI? Works fine for packages with no dependencies, but totally fails on finding sub projects.
It complains that it can’t find a related package.
so if I have this directory structure:
myProject------>firmware------->git_Submodule
… L------>git_submodule
… L------->firmware
however the compiler complains that it can’t find the includes. Everything works on the Particle Dev site.
I’ve manually added the files to the file “particle.include” and it works for .ino files, but fails for cpp files?
Is there a specific file structure I need? Where should includes for libraries go?
No need to do anything on the Photon. You can flash it either way by default.
But for the time being you need to adapt the include statements.
I usually do it like this
#define PARTICLE_BUILD
#ifdef PARTICLE_BUILD
# include "libname/libname.h"
#else
# include "libname.h"
#endif
This way you just need to #define/#undefine PARTICLE_BUILD.
The thing is that the directory structure will be flattened on upload (when properly set up in particle.include), and so you need to adjust your includes to the flattened structure, even if you got them stored hirarchically.
Thanks @ScruffR, I am assuming that I need that to have the “libname.h” form for local builds and the “libname/libname.h” for the Web IDE?
And libraries need to be flattened and placed in the same directory? Or is there a directory libraries are supposed to live in? particle compile doesn’t seem to let you pass in a lib folder on the command line.
The documentation on particle compile and particle.include is a bit light.
There is no need to manually flatten the file structure anymore. You can have your direcories however you like them, as long you tell the dev tool which files to gather and from where.
Then all the files listed in there will be pulled in and uploaded to the build farm into one flat temp directory from where your project will be built.
AFAIK you can even use wild cards in particle.include (which needs to live along side your project .ino) like this
Thanks, this helps a lot. I currently can’t get the photon seen by both Particle Dev and the Web IDE at the same time (Even though it’s the same account) so I want the CLI version to compile correctly.
How do you mean that?
How do you “compile locally”?
If you mean Dev or CLI it’s not compiling locally (unless you got the alpha stage build package installed).
CLI does use particle.include just fine for me
If you mean a local toolchain, the OP didn’t seem to ask in that direction and there you’d definetly have the full depth of the firmware repo.
This is a zipped project that shows that this works with Dev and CLI
Yes, when compiling in the cloud with CLI, particle.include is included. When I compile with the local toolchain or with po-util, particle.include never seems to be included. @mrmowgli and I have been working on po-util lately.
No. It’s a bit different. It installs the toolchain and dependencies for you, you don’t have to deal with docker, and it is meant to be run from a terminal window. It is for easily installing and using the Particle Toolchain on Ubuntu-based distros and OSX.