Skip to content

Commit 2ce4985

Browse files
committed
"Fix" local PIO build for all examples
What a pity PlatformIO doesn't seem to offer better support for Arduino libs.
1 parent 49713b5 commit 2ce4985

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

adjust_src_dir.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import os
2+
3+
Import("env")
4+
env['PROJECT_SRC_DIR'] = env['PROJECT_DIR'] + os.sep + "examples" + os.sep + env["PIOENV"]
5+
print("Setting the project directory to: {}".format(env['PROJECT_SRC_DIR']))

platformio.ini

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,41 @@
88
; Please visit documentation for the other options and examples
99
; http://docs.platformio.org/page/projectconf.html
1010

11-
[env:d1_mini]
11+
12+
; *********************************************************************************************************************
13+
; 2021-06-13
14+
;
15+
; It is a pity PlatformIO does not support building such Arduino libraries locally out of the box. The current solution
16+
; evolved out of a discussion at https://community.platformio.org/t/build-an-arduino-library-for-esp8266-locally/10656
17+
; Occasionally the build fails because PIO somehow gets the dependency tree completely wrong. Running the build again
18+
; usually fixes it.
19+
;
20+
; The default configuration will build *all* examples but you can easily uncomment the envs you do not need if you are
21+
; working on just a single example.
22+
; *********************************************************************************************************************
23+
24+
[platformio]
25+
lib_dir = $PROJECT_DIR
26+
27+
[env]
28+
extra_scripts = pre:adjust_src_dir.py
1229
platform = espressif8266
1330
board = d1_mini
1431
framework = arduino
1532
upload_speed = 921600
16-
board_f_cpu = 160000000L
17-
lib_deps = JsonStreamingParser,
18-
ESP8266_SSD1306
19-
simpleDSTadjust
20-
DHT sensor library
21-
Adafruit Unified Sensor
22-
WifiManager@>=0.15.0-beta
33+
board_build.f_cpu = 160000000L
34+
lib_deps = JsonStreamingParser
35+
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
36+
37+
; comment the ones you do not need
38+
[env:AerisForecastsDemo]
39+
[env:AerisObservationDemo]
40+
[env:AerisSunMoonDemo]
41+
[env:AstronomyDemo]
42+
[env:OpenWeatherMapCurrentDemo]
43+
[env:OpenWeatherMapForecastDemo]
44+
[env:OpenWeatherMapOneCallDemo]
45+
[env:PlaneSpotterDemo]
46+
[env:SunMoonCalcDemo]
47+
[env:WeatherStationDemo]
48+
[env:WorldClockDemo]

0 commit comments

Comments
 (0)