From e02817b07798b92aa31091c78c16581f0c867923 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Sat, 25 Jul 2020 23:40:44 -0300 Subject: [PATCH] More folders only compiled when their feature is Enabled (#18780) Co-authored-by: Scott Lahteine --- Marlin/src/inc/Conditionals_LCD.h | 7 +++ ...s-dependencies.h => common-dependencies.h} | 2 +- ...dependencies.py => common-dependencies.py} | 4 +- platformio.ini | 62 ++++++++++++------- 4 files changed, 50 insertions(+), 25 deletions(-) rename buildroot/share/PlatformIO/scripts/{common-features-dependencies.h => common-dependencies.h} (97%) rename buildroot/share/PlatformIO/scripts/{common-features-dependencies.py => common-dependencies.py} (99%) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 3472cdc7b..66e83c529 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -748,3 +748,10 @@ #ifndef EXTRUDE_MINTEMP #define EXTRUDE_MINTEMP 170 #endif + +/** + * To check if we need the folder src/features/leds + */ +#if ANY(TEMP_STAT_LEDS, HAS_COLOR_LEDS, HAS_CASE_LIGHT, PRINTER_EVENT_LEDS, LED_BACKLIGHT_TIMEOUT, PCA9632_BUZZER, LED_CONTROL_MENU) + #define HAS_LED_FEATURE 1 +#endif diff --git a/buildroot/share/PlatformIO/scripts/common-features-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h similarity index 97% rename from buildroot/share/PlatformIO/scripts/common-features-dependencies.h rename to buildroot/share/PlatformIO/scripts/common-dependencies.h index f6abdbf36..a1f8b095a 100644 --- a/buildroot/share/PlatformIO/scripts/common-features-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -24,7 +24,7 @@ /** * The purpose of this file is just include Marlin Configuration files, * to discover which FEATURES are enabled, without any HAL include. - * Used by common-features-dependencies.py + * Used by common-dependencies.py */ #include diff --git a/buildroot/share/PlatformIO/scripts/common-features-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py similarity index 99% rename from buildroot/share/PlatformIO/scripts/common-features-dependencies.py rename to buildroot/share/PlatformIO/scripts/common-dependencies.py index c8b7ec9a9..8287c0b20 100644 --- a/buildroot/share/PlatformIO/scripts/common-features-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -1,5 +1,5 @@ # -# common-features-dependencies.py +# common-dependencies.py # Convenience script to check dependencies and add libs and sources for Marlin Enabled Features # import subprocess @@ -190,7 +190,7 @@ def load_marlin_features(): else: cmd += ['-D' + s] - cmd += ['-w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-features-dependencies.h'] + cmd += ['-w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h'] cmd = ' '.join(cmd) print(cmd) define_list = subprocess.check_output(cmd, shell=True).splitlines() diff --git a/platformio.ini b/platformio.ini index 743499e89..838ce1161 100644 --- a/platformio.ini +++ b/platformio.ini @@ -25,10 +25,18 @@ include_dir = Marlin # The 'common' values are used for most Marlin builds # [common] -default_src_filter = + - - + - - - - - - - +default_src_filter = + - - + + - - - - + - - - - + - + - + - - + - - + - - + - - + - extra_scripts = - pre:buildroot/share/PlatformIO/scripts/common-features-dependencies.py + pre:buildroot/share/PlatformIO/scripts/common-dependencies.py pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants lib_deps = @@ -37,24 +45,34 @@ lib_deps = # Feature Dependencies # [features] -HAS_TFT_LVGL_UI = lvgl=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip - src_filter=+ - extra_scripts=download_mks_assets.py -HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1 -SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip -DIGIPOT_MCP4... = SlowSoftI2CMaster -HAS_TMC26X = TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip -HAS_L64XX = Arduino-L6470@0.8.0 -NEOPIXEL_LED = Adafruit NeoPixel@1.5.0 -MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0 -HAS_GRAPHICAL_LCD = U8glib-HAL@0.4.1 - src_filter=+ -USES_LIQUIDCRYSTAL = LiquidCrystal@1.5.0 -USES_LIQUIDTWI2 = LiquidTWI2@1.2.7 -TOUCH_UI_FTDI_EVE = src_filter=+ -HAS_DGUS_LCD = src_filter=+ -DWIN_CREALITY_LCD = src_filter=+ -HAS_LCD_MENU = src_filter=+ +HAS_TFT_LVGL_UI = lvgl=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip + src_filter=+ + extra_scripts=download_mks_assets.py +HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1 + src_filter=+ +SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip +DIGIPOT_MCP4... = SlowSoftI2CMaster +HAS_TMC26X = TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip +HAS_L64XX = Arduino-L6470@0.8.0 +NEOPIXEL_LED = Adafruit NeoPixel@1.5.0 +MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0 +HAS_GRAPHICAL_LCD = U8glib-HAL@0.4.1 + src_filter=+ +USES_LIQUIDCRYSTAL = LiquidCrystal@1.5.0 +USES_LIQUIDTWI2 = LiquidTWI2@1.2.7 +DWIN_CREALITY_LCD = src_filter=+ +HAS_CHARACTER_LCD = src_filter=+ +HAS_LCD_MENU = src_filter=+ +HAS_DGUS_LCD = src_filter=+ +TOUCH_UI_FTDI_EVE = src_filter=+ +ANYCUBIC_TFT_MODEL = src_filter=+ +USB_FLASH_DRIVE_SUPPORT = src_filter=+ +AUTO_BED_LEVELING_(3POINT|(BI)?LINEAR) = src_filter=+ + +MESH_BED_LEVELING = src_filter=+ + +AUTO_BED_LEVELING_UBL = src_filter=+ + +DAC_STEPPER_CURRENT = src_filter=+ +HAS_I2C_DIGIPOT = src_filter=+ +HAS_LED_FEATURE = src_filter=+ (ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer ESP3DLib=https://github.com/luc-github/ESP3DLib.git arduinoWebSockets=https://github.com/Links2004/arduinoWebSockets.git @@ -699,7 +717,7 @@ src_filter = ${common.default_src_filter} + platform = ${common_stm32f1.platform} extends = common_stm32f1 board = CHITU_F103 -extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-features-dependencies.py +extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-dependencies.py pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py buildroot/share/PlatformIO/scripts/chitu_crypt.py build_flags = ${common_stm32f1.build_flags}