Project and files naming conventions across IDE versions?

Background:
I have been using Arduino IDE, Sloeber and VisualCode with PlatformIO sporadically over the years starting about 2015 or so. Now when I return to Arduino programming my old Sloeber won't work in my new laptop so I installed VisualCode with the PlatformIO plug-in to get a sensible IDE with the expected help to navigate the project files etc.

Now I am getting confused (again) about the naming conventions regarding projects and files...

So can someone clarify what is required?

  1. Is there a requirement that the directory the files reside in must have a project related name?

  2. Is there a requirement that the main project file is named with an ino extensions?

  3. Is there a special requirement that the main project file is named something related to the project name?

I have seen several variations like:
projectname.ino
projectname.cpp
main.cpp
projectname/projectname.cpp
projectname/projectname.ino
projectname.main.cpp
(In the last 3 cases there was a requirement (?) that the main directory was named as the project name)

What is the deal here?
It seems like if one used main.cpp it would be a lot more portable to copy into another dir and still work etc...

PS:
I imported an older Arduino project into PlatformIO and it created a project using projectname.cpp inside a directory named projectname..
DS

Note that PlatformIO and classical Arduino IDE uses completely different naming conventions.
Which one is your question about?

In the arduino IDE the main project file should has .ino extension and the same name as project directory

I will use PlatformIO going forward

I'm not sure how platformIO does it, but the Arduino core usually contains a main.cpp, so if it isn't careful you could have your main.o files overwriting each other.
I believe the Arduino IDE goes to some length to make sure that "sketch" files and core files with the same name end up putting their .o files in different places.

Also, if you keep your rules consistent with the Arduino IDE ("main project file should has .ino extension and the same name as project directory"), then your project will be "more portable" to people NOT using platformIO.

(The various "unique" project configuration info kept in obscure places by most "real" IDEs is a pet peeve of mine. I much prefer a nice flat-ish set of files and a makefile.)

In addition to the naming of files:
Which files in the project belong inside a version control system like Subversion?
Ideally one should be able to check out a project to a random location and open it in the selected IDE and then be able to build it.
But when necessary files are hidden away far outside the project dir that seems impossible.
For instance if you like me never use C:\ on Windows for any work files but put them on a separate data drive then still some files mysteriously wind up below C:\Users\Username....
How can one find out which these are and get them into the project tree?

REPLY TO MYSELF (and future readers):
When using PlatformIO the versioning is not so difficult even if one uses Subversion rather than the Git system integrated in PlatformIO!

It turns out that the libraries used in the project are copied into the directory tree
(projectname)/.pio/libdeps/*
So therein the complete code of the libraries including examples are stuffed ready to be included in the version control system.

If one wants to also store the firmware binary in version control it is saved to the subdir:
.pio/build/(profilename)/firmware.bin

So by including .pio/libdeps/* into the subversion control you get a complete project after all.
:grinning: :blush:

PS (just discovered):
It seems like the libraries used when specifying the framework one is working with are referenced from:
C:\Users\Username\.platformio\packages\framework-arduinoespressif8266\libraries\libraryname\src

So these are not included in the local cache of libraries and therefore not included in project versioning either...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.