Skip to content

Commit 11a2fb3

Browse files
authored
Dynamically configure exceptions support (#7834)
1 parent 2402958 commit 11a2fb3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tools/platformio-build.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def scons_patched_match_splitext(path, suffixes=None):
7575
"-U__STRICT_ANSI__",
7676
"-ffunction-sections",
7777
"-fdata-sections",
78-
"-fno-exceptions",
7978
"-Wall"
8079
],
8180

@@ -130,7 +129,7 @@ def scons_patched_match_splitext(path, suffixes=None):
130129
LIBS=[
131130
"hal", "phy", "pp", "net80211", "wpa", "crypto", "main",
132131
"wps", "bearssl", "espnow", "smartconfig", "airkiss", "wpa2",
133-
"stdc++", "m", "c", "gcc"
132+
"m", "c", "gcc"
134133
],
135134

136135
LIBSOURCE_DIRS=[
@@ -250,6 +249,20 @@ def scons_patched_match_splitext(path, suffixes=None):
250249
env.Append(CPPDEFINES=[("WAVEFORM_LOCKED_PHASE", 1)])
251250
# PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PWM will be used by default
252251

252+
#
253+
# Exceptions
254+
#
255+
if "PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS" in flatten_cppdefines:
256+
env.Append(
257+
CXXFLAGS=["-fexceptions"],
258+
LIBS=["stdc++-exc"]
259+
)
260+
else:
261+
env.Append(
262+
CXXFLAGS=["-fno-exceptions"],
263+
LIBS=["stdc++"]
264+
)
265+
253266
#
254267
# VTables
255268
#

0 commit comments

Comments
 (0)