refactoring

This commit is contained in:
Sergey Dudanov 2023-08-20 16:48:59 +04:00
parent 59b943aad0
commit e163b9659a
3 changed files with 5 additions and 5 deletions

View file

@ -36,7 +36,7 @@ from esphome.cpp_generator import ( # noqa
get_variable,
get_variable_with_full_id,
process_lambda,
set_cpp_version,
set_cpp_standard,
is_template,
templatable,
MockObj,

View file

@ -362,7 +362,7 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
cg.add_platformio_option("board", config[CONF_BOARD])
cg.set_cpp_version("gnu++17")
cg.set_cpp_standard("gnu++17")
cg.add_build_flag("-DUSE_ESP32")
cg.add_define("ESPHOME_BOARD", config[CONF_BOARD])
cg.add_build_flag(f"-DUSE_ESP32_VARIANT_{config[CONF_VARIANT]}")

View file

@ -610,10 +610,10 @@ def add_build_unflag(build_unflag: str):
CORE.add_build_unflag(build_unflag)
def set_cpp_version(version: str):
"""Set C++ version via compiler flag `-std={version}`."""
def set_cpp_standard(standard: str):
"""Set C++ standard with compiler flag `-std={standard}`."""
CORE.add_build_unflag("-std=gnu++11")
CORE.add_build_flag(f"-std={version}")
CORE.add_build_flag(f"-std={standard}")
def add_define(name: str, value: SafeExpType = None):