From dc0893c6f6d89fee489a620e0814b4e8a8af9e91 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 17 Dec 2022 02:16:54 +0200 Subject: [PATCH] Add the corresponding generated source directory to local include path This allows generated headers to be used as normal. --- source/component.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/component.cpp b/source/component.cpp index 46e9294..2d09f8a 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -59,6 +59,19 @@ BuildInfo Component::get_build_info_for_path(const FS::Path &path) const { // XXX Cache these and check that the directories actually exist before adding them BuildInfo binfo = build_info; + + FS::Path gen_dir = package.get_temp_directory()/"generated"; + if(FS::descendant_depth(path, gen_dir)>=0) + { + FS::Path subdir = FS::dirname(FS::relative(path, gen_dir)); + binfo.local_incpath.push_back(package.get_source_directory()/subdir); + } + else + { + FS::Path subdir = FS::dirname(FS::relative(path, package.get_source_directory())); + binfo.local_incpath.push_back(gen_dir/subdir); + } + if(!overlays.empty()) { FS::Path dir = FS::dirname(path); -- 2.43.0