-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
platformio init: change source directory #83
Comments
I want to break main concept of PlatformIO - "to build the single source code with the multiple development platforms". See example how to build single "blink" code for the multiple Arduino boards. P.S: You should estimate all benefits of platformio.ini and start use it per project. |
Thanks for the heads-up, i think i already understood the main concept. What i am looking for is a way to provide a source-folder other than Regards |
The Could I ask you: "Why do you need As I understand, you just need to initialize project in the another folder and use it. For example, > cd /my/project/dir
> platformio run
# or
> cd /my/project/dir && platformio run
|
The reason is likely that the Arduino IDE forces certain naming and structural constraints, namely that a project named 'TestProject' must be within a folder named 'TestProject' and include a main file named 'TestProject/TestProject.ino'. While I do think full compatibility is a good idea, I've been working around this by using directory links. ie: |
I came here to open an issue with exactly the same feature request. Now I see, someone else has already done that ;). I will try to clarify the problem a little bit: I'm using platformio to build my Arduino projects while at the same time maintaining compatibility with the Arduino IDE. As makefu and aphelps already described, one really annoying limitation of the Arduino IDE is the fact, that the ino-source file has to have the exact same name as the parent directory, the source file resides in. Don't ask me, why they did that… One way to solve this, is by using links like aphelp proposed, which probably will not be suitable if you want to work on different operating systems in the same project. Also, this solution will likely cause trouble when using a version control system. My current solution is to name my ino-file "src.ino". This way, the Arduino IDE is happy, because it can open a file with the name "src", which is located in a folder named "src" and platformio is happy, because the source file resides in a directory with the name "src". Working on several source files from different Arduino projects in the same IDE (which I'm doing a lot, lately) gets pretty confusing with this hack, though, as a lot of source files are named "src.ino". The problem could be solved, if the name of the src-folder was configurable, as makefu proposed. |
Hey @makefu, @aphelps, @franciscoruiz, @valeros You convinced me 👍 😊 . See |
Works like a charm, thank you! |
that is great to hear, thanks for the improvement! |
Thanks for the change, I'll try that out as an alternative to my linking. As a note on a comment above regarding links and version control, at least with git and Unix based platforms you can commit a symbolic link and it behaves properly when cloned. I haven't tried this with Windows, but MacOS and Ubuntu are fine. |
Does |
Sure, please read detailed information in documentation: http://docs.platformio.org/en/latest/projectconf.html#src-dir P.S: But... I'm not sure that I've got you. The main idea of PlatformIO and |
Actually, I've already checked the docs, but I understand that only one path is possible :) |
Dear @gsavin,
You've just answered on this question 😄 Just move "common code for library" to folder, which will be located in "Project #1", then use the Project #1 [platformio]
lib_dir = /path/to/own/libdir
[env:my_project_1]
# some data Project #2 [platformio]
lib_dir = /path/to/own/libdir
[env:my_project_2]
# some data Then, create new folder (use any names, like P.S: You can keep common code in Project 1 or 2, and then use |
Thanks :) Sounds good. |
Thanks! 👍 Let's wait for the new release... 😊 + 3 new development platforms (NXP, Freescale & Nordic), +30 boards, + full support for mbed platforms and mbed framework http://developer.mbed.org/platforms/ Please follow us on Twitter @PlatformIO_Org |
I do something like this: //
// Created by thomas on 25/11/17.
//
//#define sensor_log
#define sensor_bmp
// sensor_log example
#ifdef sensor_log
#include "../../examples/sensor_log/sensor_log.ino"
#endif
// sensor_bmp example
#ifdef sensor_bmp
#include "../../examples/sensor_bmp/BMPholder.h"
#include "../../examples/sensor_bmp/BMPholder.cpp"
#include "../../examples/sensor_bmp/sensor_bmp.ino"
#endif Just include the .ino files of the custom location in your main.ino in src |
Maybe i missed something but is it correct that there is currently no way to change the source directory path?
I am currently trying to migrate my arduino projects to platformio and for me the best case would be to simply throw a platformio.ini file in the base directory of my projects and compile my projects with different source directories.
i also hate the arduino ide requirement that every source file of a project must be named like the project, what a buill ...
Being able to choose my folder and file naming means a lot to me :)
The text was updated successfully, but these errors were encountered: