diff --git a/src/lib/meson.build b/src/lib/meson.build index 90a1c8ad..b0abdaa2 100644 --- a/src/lib/meson.build +++ b/src/lib/meson.build @@ -191,7 +191,17 @@ libxce = static_library('xce', # for consumers OUTSIDE the libxce target itself. link_with alone does not # propagate this: it only orders the LINK step after libxce is built, not # a consumer's own COMPILE steps against a header libxce never installs. -libxce_dep = declare_dependency(link_with: libxce, sources: [gen_srcs], +# +# build-time dedup: this used to pass the WHOLE custom_target, which made +# every consumer target compile controller.capnp.c itself -- 143 separate +# compiles of a 9.5s/293MB-RSS/3.3MB-object TU (asan profile), ~35% of a +# full clean build's serial work and ~470MB of duplicate .o files on disk. +# Indexing to gen_srcs[1] (the .h output only) keeps everything bug-1798 +# needed: a custom_target output still carries the dependency edge on the +# whole codegen step (custom_target always builds ALL of its outputs +# atomically), and a .h source is never compiled. The .c output is compiled +# exactly once, inside libxce above, and every consumer links the archive. +libxce_dep = declare_dependency(link_with: libxce, sources: [gen_srcs[1]], dependencies: libxce_deps) # libxce_shared_dep = declare_dependency(link_with: libxce_shared)