]> git.tdb.fi Git - builder.git/commitdiff
Add the corresponding generated source directory to local include path
authorMikko Rasa <tdb@tdb.fi>
Sat, 17 Dec 2022 00:16:54 +0000 (02:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 17 Dec 2022 00:23:44 +0000 (02:23 +0200)
This allows generated headers to be used as normal.

source/component.cpp

index 46e9294d039abb2a4cc9ee33c0180acd595239c1..2d09f8a0cd007ed12f9e7c09d2a1c78cc4670b47 100644 (file)
@@ -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);