2025-08-24 13:09:55 +02:00
|
|
|
from os.path import realpath
|
2025-08-24 13:06:19 +02:00
|
|
|
|
2025-08-24 13:09:55 +02:00
|
|
|
Import("env") # type: ignore
|
|
|
|
|
menv=env # type: ignore
|
2025-08-24 13:06:19 +02:00
|
|
|
|
2025-08-24 13:09:55 +02:00
|
|
|
src_filter = [
|
|
|
|
|
'+<*.cpp>',
|
|
|
|
|
'+<helpers/*.cpp>',
|
|
|
|
|
'+<helpers/radiolib/*.cpp>',
|
|
|
|
|
'+<helpers/ui/MomentaryButton.cpp>',
|
|
|
|
|
]
|
2025-08-24 13:06:19 +02:00
|
|
|
|
2025-08-24 13:09:55 +02:00
|
|
|
for item in menv.get("CPPDEFINES", []):
|
2025-08-24 13:06:19 +02:00
|
|
|
if isinstance(item, str) and item == "STM32_PLATFORM":
|
|
|
|
|
# add STM32 specific sources
|
2025-08-24 13:09:55 +02:00
|
|
|
menv.Append(CPPPATH=[realpath("src/helpers/stm32")])
|
|
|
|
|
menv.Append(BUILD_FLAGS=["-I src/helpers/stm32"])
|
|
|
|
|
src_filter.append("+<helpers/stm32/*>")
|
2025-08-24 13:06:19 +02:00
|
|
|
elif isinstance(item, str) and item == "ESP32":
|
2025-08-24 13:09:55 +02:00
|
|
|
menv.Append(CPPPATH=[realpath("src/helpers/esp32")])
|
|
|
|
|
menv.Append(BUILD_FLAGS=["-I src/helpers/esp32"])
|
|
|
|
|
src_filter.append("+<helpers/esp32/*>")
|
|
|
|
|
elif isinstance(item, tuple) and item[0] == "MC_VARIANT":
|
|
|
|
|
variant_name = item[1]
|
|
|
|
|
menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"])
|
|
|
|
|
src_filter.append(f"+<../variants/{variant_name}>")
|
2025-08-24 13:06:19 +02:00
|
|
|
|
2025-08-24 13:09:55 +02:00
|
|
|
menv.Replace(SRC_FILTER=src_filter)
|
2025-08-24 13:06:19 +02:00
|
|
|
|
2025-08-24 13:09:55 +02:00
|
|
|
#print (menv.Dump())
|