Travis-ci: Add private libraries from /root/libraries/[Folder]

I have just stumbled over the PlatformIO integration for travis-ci and was able to adapt my .travis.yml file to run with platformio.

I have to integrate my private libraries into the build.
My file structure is the following:

	root
		-- libraries
		-- EMTB_RX
			-- src
				-- EMTB_RX.cpp
			-- platformio.ini
		-- EMTB_TX
			-- src
				-- EMTB_TX.cpp
			-- platformio.ini

I have a general library folder for both programms, so if i make a change it effects both.

So far my .traviy.yml file is:

language: python
python:
		- "2.7"

# Cache PlatformIO packages using Travis CI container-based infrastructure
sudo: false
cache:
		directories:
				- "~/.platformio"

env:
		- PLATFORMIO_CI_SRC=EMTB_RX/src
		# Do i just add the folder here? But how?

install:
		- pip install -U platformio

script:
		- platformio ci --board=pro8MHzatmega328

notifications:
	email:
		on_success: never
		on_failure: never

How do i add my private libraries?

In my platformio.ini it was easy

[env:pro8MHzatmega328]
platform = atmelavr
board = pro8MHzatmega328
framework = arduino
build_flags = ${common.build_flags}

[platformio]
lib_dir = …\libraries

[common]
build_flags = -D VERSION=0.0.1

There are a few options:

  1. You can use pio run command instead of pio ci, which is a wrapper around pio run when there is no platfomrio.ini. See docs Redirecting...
  2. You can pass extra configuration options directly from a command. See Redirecting...

Also, you can call pio ci with custom configuration. pio ci --project-conf ..... In any case, please read docs for both command. If you have platformio.ini, please use pio run.

Thank you for helping.
I already figured this out reading the docs, but it still doesn’t work.

My .travis.yml is currently

language: python
python:
		- "2.7"

# Cache PlatformIO packages using Travis CI container-based infrastructure
sudo: true
cache:
		directories:
				- "~/.platformio"

install:
		- pip install -U platformio
		
script:
		- platformio lib install
		# just for understanding
		- cd /home/travis/build/DiegoTheWolf/EMTB
		- ls 
		# ----
		- platformio run -d /home/travis/build/DiegoTheWolf/EMTB/EMTB_RX

notifications:
	email:
		on_success: never
		on_failure: never

My job still not finds the libraries!

src/EMTB_RX.cpp:2:37: fatal error: RF24.h: No such file or directory

BUT in the directory im running in there is a platformio.ini file with the content:

[env:pro8MHzatmega328]
platform = atmelavr
board = pro8MHzatmega328
framework = arduino
build_flags = ${common.build_flags}


[platformio]
lib_dir = ..\libraries

[common]
build_flags = -D VERSION=0.0.1

This is what i run at home without any problems.
I sync the complete repository on my PC.

Feel free to give it a look at “GitHub - DiegoTheWolf/EMTB: My try on developing a remote controll for the VESC”(DevOnline Branch)

Please be careful with PIO docs. If something is bad explained, please note here and I’ll improve. Your config should like as:

[platformio]
lib_extra_dirs = ../libraries

for adding the library, what if I had a bunch of files in a local library like this:
they are individual files, and not in separate folders for each different file name.
Now, I am having to go into every file in this library and add cpp_utils to each include statement that references any headers/files in this library folder.
Am I missing something?

[platformio]
lib_extra_dirs = ~/projectName/lib/cpp_utils

Folder Layout

lib/cpp_utils/
-file1.h
-file.cpp
-file1.h

Sorry, I don’t understand your question. cpp_utils is a library in this context. You can include it to build process via lib_deps = cpp_utils or just include any *.h file of this library in any files in your project.

Do I need to do the lib_deps and lib_extra_dirs?

Also,. I am not seeing the includes show up in the cpp_properties.json.
It took some time, but the library locations were put into cpp_properties.json file - which is cool, but only the projects that are in folders:

No, because this library is a part of project. PlatformIO looks in project/lib folder automatically.