mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
Precompile a curated core-header prefix on host
This commit is contained in:
@@ -206,7 +206,7 @@ jobs:
|
||||
# platforms where it must work. Excluded: bk72xx/rtl87xx/ln882x
|
||||
# (libretiny GCC rejects its own pch until a toolchain bump),
|
||||
# esp32-*-platformio (no pch; the toolchain is being dropped),
|
||||
# nrf52 and host (no pch)
|
||||
# nrf52 (no pch)
|
||||
include:
|
||||
- id: esp8266-arduino
|
||||
pch_strict: "1"
|
||||
@@ -218,6 +218,8 @@ jobs:
|
||||
pch_strict: "1"
|
||||
- id: rp2040-arduino
|
||||
pch_strict: "1"
|
||||
- id: host
|
||||
pch_strict: "1"
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Download image artifact
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from esphome.build_helpers.pch import pch_extra_scripts
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
@@ -10,7 +11,7 @@ from esphome.const import (
|
||||
ThreadModel,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.platformio.toolchain import copy_ccache_script
|
||||
from esphome.platformio.toolchain import copy_ccache_script, copy_pch_script
|
||||
from esphome.types import ConfigType
|
||||
|
||||
from .const import KEY_HOST
|
||||
@@ -55,9 +56,18 @@ async def to_code(config: ConfigType) -> None:
|
||||
cg.add_platformio_option("platform", "platformio/native")
|
||||
cg.add_platformio_option("lib_ldf_mode", "off")
|
||||
cg.add_platformio_option("lib_compat_mode", "strict")
|
||||
cg.add_platformio_option("extra_scripts", ["pre:ccache.py"])
|
||||
cg.add_platformio_option("extra_scripts", ["pre:ccache.py", *pch_extra_scripts()])
|
||||
# Curated prefix for the pch (the script folds these plus defines.h):
|
||||
# host has no framework force-includes, and the per-TU cost is the STL
|
||||
# closure behind these core headers. Measured -43% compile CPU.
|
||||
# macOS system clang cannot load a GCC .gch; the load probe falls back.
|
||||
cg.add_platformio_option(
|
||||
"build_src_flags",
|
||||
"-include esphome/core/application.h -include esphome/core/automation.h",
|
||||
)
|
||||
|
||||
|
||||
# Called by writer.py
|
||||
def copy_files() -> None:
|
||||
copy_ccache_script()
|
||||
copy_pch_script()
|
||||
|
||||
Reference in New Issue
Block a user