From cbd5c6544c595646f24333db31fd1e6a8843869a Mon Sep 17 00:00:00 2001 From: Mark Juggurnauth-Thomas Date: Thu, 22 Feb 2024 11:46:24 -0800 Subject: [PATCH] getdeps: add thrift built-in includes to THRIFT_INCLUDE_PATH Summary: X-link: https://github.com/facebookincubator/zstrong/pull/709 The thrift compiler includes some additional thrift files for built-in features, e.g. annotations. Unlike other thrift libraries, these thrift files are installed directly to `include` instead of `include/thrift-files`. If we detect `include/thrift`, then consider that to be an indication that we should add `include` to the `THRIFT_INCLUDE_PATH`, so that these can be picked up by things that depend on the built-in thrift files. Reviewed By: mitrandir77 Differential Revision: D53943880 Privacy Context Container: L1122763 fbshipit-source-id: d30c3e2598ca8904c1b054965aca2057733ecd20 --- build/fbcode_builder/getdeps/buildopts.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/fbcode_builder/getdeps/buildopts.py b/build/fbcode_builder/getdeps/buildopts.py index 63bf7c696e1a..dcf551cb8c33 100644 --- a/build/fbcode_builder/getdeps/buildopts.py +++ b/build/fbcode_builder/getdeps/buildopts.py @@ -368,6 +368,11 @@ def add_prefix_to_env( elif "/bz2-" in d: add_flag(env, "CPPFLAGS", f"-I{includedir}", append=append) + # The thrift compiler's built-in includes are installed directly to the include dir + includethriftdir = os.path.join(d, "include", "thrift") + if os.path.exists(includethriftdir): + add_path_entry(env, "THRIFT_INCLUDE_PATH", includedir, append=append) + # Map from FB python manifests to PYTHONPATH pydir = os.path.join(d, "lib", "fb-py-libs") if os.path.exists(pydir):