diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 679d021a7f..06858c446c 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -75,7 +75,6 @@ def scons_patched_match_splitext(path, suffixes=None): "-U__STRICT_ANSI__", "-ffunction-sections", "-fdata-sections", - "-fno-exceptions", "-Wall" ], @@ -130,7 +129,7 @@ def scons_patched_match_splitext(path, suffixes=None): LIBS=[ "hal", "phy", "pp", "net80211", "wpa", "crypto", "main", "wps", "bearssl", "espnow", "smartconfig", "airkiss", "wpa2", - "stdc++", "m", "c", "gcc" + "m", "c", "gcc" ], LIBSOURCE_DIRS=[ @@ -250,6 +249,20 @@ def scons_patched_match_splitext(path, suffixes=None): env.Append(CPPDEFINES=[("WAVEFORM_LOCKED_PHASE", 1)]) # PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PWM will be used by default +# +# Exceptions +# +if "PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS" in flatten_cppdefines: + env.Append( + CXXFLAGS=["-fexceptions"], + LIBS=["stdc++-exc"] + ) +else: + env.Append( + CXXFLAGS=["-fno-exceptions"], + LIBS=["stdc++"] + ) + # # VTables #