How to use different lib versions with same name in one project?


#1

Hi,

I want to use two different versions of one library in one project.
The libs are:
official FastLED: https://platformio.org/lib/show/126/FastLED
inofficial Fork for RGBW: https://github.com/coryking/FastLED

I defined different enviroments like this:


[env:d1_mini_rgb]
   [..]
lib_deps =
     FastLED

[env:d1_mini_rgbw]
   [..]
lib_deps =
     FastLED_RGBW=git@github.com:coryking/FastLED.git
  1. I hoped the alternative library would be installed to .piolibdeps\FastLED_RGBW\ instead of .piolibdeps\FastLED\
  2. But even if it did, I think #include <FastLED.h> would still call the official library, right?

I would like to use something like this:

[env:d1_mini_rgbw]
build_flags = -D RGBW
lib_deps =
     FastLED_RGBW=git@github.com:coryking/FastLED.git
#ifdef RGBW
   #include <FastLED_RGBW/FastLED.h>
#else
  #include <FastLED.h>
#endif

So, how do I do this the right way?
Or do I have to use different project folders where only one FastLED exists?


#2

lib_extra_dirs is the config option you want.

Don’t use the ‘lib’ dir. Make lib1, lib2, … in your project folder. Under your board settings use ‘lib_extra_dir = lib1’ and so on.


#3

This is a bug and has been just fixed