mirror of https://github.com/meshcore-dev/MeshCore
1 changed files with 22 additions and 45 deletions
@ -1,53 +1,30 @@ |
|||||
from os.path import join, realpath, exists |
from os.path import realpath |
||||
import shutil, os |
|
||||
|
|
||||
Import("env") |
Import("env") # type: ignore |
||||
|
menv=env # type: ignore |
||||
|
|
||||
platform_stm32=False |
src_filter = [ |
||||
platform_esp32=False |
'+<*.cpp>', |
||||
platform_nrf52=False |
'+<helpers/*.cpp>', |
||||
platform_rp2040=False |
'+<helpers/radiolib/*.cpp>', |
||||
|
'+<helpers/ui/MomentaryButton.cpp>', |
||||
|
] |
||||
|
|
||||
src_filter = [] |
for item in menv.get("CPPDEFINES", []): |
||||
src_filter.append("+<*>") |
|
||||
src_filter.append("-<helpers/ui/*>") # don't build with ui for now ... |
|
||||
|
|
||||
for item in env.get("CPPDEFINES", []): |
|
||||
if isinstance(item, str) and item == "STM32_PLATFORM": |
if isinstance(item, str) and item == "STM32_PLATFORM": |
||||
# add STM32 specific sources |
# add STM32 specific sources |
||||
env.Append(CPPPATH=[realpath("src/helpers/stm32")]) |
menv.Append(CPPPATH=[realpath("src/helpers/stm32")]) |
||||
platform_stm32=True |
menv.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) |
||||
env.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) |
src_filter.append("+<helpers/stm32/*>") |
||||
elif isinstance(item, str) and item == "ESP32": |
elif isinstance(item, str) and item == "ESP32": |
||||
platform_esp32=True |
menv.Append(CPPPATH=[realpath("src/helpers/esp32")]) |
||||
env.Append(CPPPATH=[realpath("src/helpers/esp32")]) |
menv.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) |
||||
env.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) |
src_filter.append("+<helpers/esp32/*>") |
||||
elif isinstance(item, str) and item == "WIO_E5_DEV_VARIANT": |
elif isinstance(item, tuple) and item[0] == "MC_VARIANT": |
||||
env.Append(BUILD_FLAGS=["-I variants/wio-e5-dev"]) |
variant_name = item[1] |
||||
src_filter.append("+<../variants/wio-e5-dev>") |
menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) |
||||
elif isinstance(item, str) and item == "RAK_3X72_VARIANT": |
src_filter.append(f"+<../variants/{variant_name}>") |
||||
env.Append(BUILD_FLAGS=["-I variants/rak3x72"]) |
|
||||
src_filter.append("+<../variants/rak3x72>") |
|
||||
elif isinstance(item, str) and item == "XIAO_S3_WIO_VARIANT": |
|
||||
env.Append(BUILD_FLAGS=["-I variants/xiao_s3_wio"]) |
|
||||
src_filter.append("+<../variants/xiao_s3_wio>") |
|
||||
elif isinstance(item, str) and item == "XIAO_C6_VARIANT": |
|
||||
env.Append(BUILD_FLAGS=["-I variants/xiao_c6"]) |
|
||||
src_filter.append("+<../variants/xiao_c6>") |
|
||||
elif isinstance(item, str) and item == "GENERIC_ESPNOW_VARIANT": |
|
||||
env.Append(BUILD_FLAGS=["-I variants/generic_espnow"]) |
|
||||
src_filter.append("+<../variants/generic_espnow>") |
|
||||
src_filter.append("+<helpers/esp32/ESPNOWRadio.cpp>") |
|
||||
|
|
||||
if not platform_stm32: |
|
||||
src_filter.append("-<helpers/stm32/*>") |
|
||||
if not platform_esp32: |
|
||||
src_filter.append("-<helpers/esp32/*>") |
|
||||
if not platform_nrf52: |
|
||||
src_filter.append("-<helpers/nrf52/*>") |
|
||||
if not platform_rp2040: |
|
||||
src_filter.append("-<helpers/rp2040/*>") |
|
||||
|
|
||||
env.Replace(SRC_FILTER=src_filter) |
menv.Replace(SRC_FILTER=src_filter) |
||||
|
|
||||
print (env.Dump()) |
#print (menv.Dump()) |
||||
|
|||||
Loading…
Reference in new issue