<div dir="ltr"><div>Hello,</div><div><br></div><div>did you try to append "hpp" to the static libraries type property?<br></div><div>Maybe this would force Qbs to generate the headers before consuming the library.</div><div><br></div><div>Regards, Kai<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mi., 13. Juli 2022 um 22:50 Uhr schrieb Jochen Becher <<a href="mailto:jochen_becher@gmx.de">jochen_becher@gmx.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Another observation:<br>
<br>
After I built the project once with one job at a time and it succeeded,<br>
it also succeeds after "Clean" and building with 12 parallel jobs. So,<br>
once the dependency between the source file and the header file is<br>
established, it gets not lost until you delete the .bg file.<br>
<br>
As it works within the static library but just not when an external<br>
source file depends on that generated header file, I assume it is an<br>
issue in qbs.<br>
<br>
Any comments?<br>
<br>
<br>
Am Dienstag, dem 12.07.2022 um 22:08 +0200 schrieb Jochen Becher:<br>
> One more information:<br>
><br>
> If I set the number of parallel jobs to 1 then it works fine. The<br>
> order<br>
> of the build tasks seems to be correct. Just the compilation of<br>
> source<br>
> files outside of the library but depending on a header file created<br>
> from the library seems not to wait until the header files are done.<br>
> Of<br>
> course, this obviously works with linking of object files and static<br>
> libraries. It looks like an issue in qbs to me.<br>
><br>
> Can someone please comment on this before I create a minimal example<br>
> and issue?<br>
><br>
> Regards, Jochen<br>
><br>
><br>
> Am Samstag, dem 09.07.2022 um 22:56 +0200 schrieb Jochen Becher:<br>
> > Hi,<br>
> ><br>
> > I have the following problem where I could not find a solution<br>
> > myself:<br>
> ><br>
> > I created a new module which uses a code generator "compiler-<br>
> > generator"<br>
> > that I wrote to create header and source files from input files. I<br>
> > used<br>
> > the lexyacc module as a template. (see end of mail for module<br>
> > source)<br>
> ><br>
> > I use that module in a product that creates a static library, like<br>
> > that:<br>
> ><br>
> >     StaticLibrary {<br>
> >         name: "corelib"<br>
> ><br>
> >         Export {<br>
> >             Depends { name: "cpp" }<br>
> >             cpp.includePaths: ["src",<br>
> > exportingProduct.buildDirectory]<br>
> >         }<br>
> ><br>
> >         Depends { name: "compgen" }<br>
> >         Depends { name: "compiler-generator" }<br>
> ><br>
> >         cpp.includePaths: [ "src", product.buildDirectory ]<br>
> ><br>
> >         Group {<br>
> >             name: "frontend-header-generator"<br>
> >             fileTags: "compgen.input"<br>
> >             compgen.outputTag: "hpp"<br>
> >             files: [<br>
> >                 "src/frontend/<a href="http://tokens.h.in" rel="noreferrer" target="_blank">tokens.h.in</a>",<br>
> >             ]<br>
> >         }<br>
> ><br>
> >         Group {<br>
> >             name: "frontend-source-generator"<br>
> >             fileTags: "compgen.input"<br>
> >             compgen.outputTag: "c"<br>
> >             files: [<br>
> >                 "src/frontend/<a href="http://lexer.c.in" rel="noreferrer" target="_blank">lexer.c.in</a>",<br>
> >             ]<br>
> >         }<br>
> ><br>
> >         Group {<br>
> >             name: "frontend"<br>
> >             files: [<br>
> >                 "src/frontend/lexer.h",<br>
> >                 "src/frontend/parser.c",<br>
> >                 "src/frontend/parser.h",<br>
> >             ]<br>
> >         }<br>
> ><br>
> > Building that library works fine.<br>
> ><br>
> > But some other tools also want to use the created header file<br>
> > "tokens.h". These applications (e.g., "compiler") depends on<br>
> > "corelib".<br>
> ><br>
> > But the application source is compiled before the header file<br>
> > "tokens.h" is generated from "<a href="http://tokens.h.in" rel="noreferrer" target="_blank">tokens.h.in</a>" and so it is missing.<br>
> ><br>
> > What is the best way to enforce that the dependency on corelib from<br>
> > an<br>
> > application first builds the library corelib with the generated<br>
> > header<br>
> > and source files and THEN builds the dependend source files?<br>
> ><br>
> > Regards, Jochen<br>
> ><br>
> ><br>
> > --- the generator module "compgen.qbs" ---<br>
> ><br>
> > import qbs<br>
> > import qbs.FileInfo<br>
> ><br>
> > Module {<br>
> ><br>
> >     Depends { name: "cpp" }<br>
> ><br>
> >     property string outputTag: "c"<br>
> >     readonly property string outputDir: product.buildDirectory<br>
> ><br>
> >     Rule {<br>
> >         inputs: [ "compgen.input" ]<br>
> >         outputFileTags: [ product.compgen.outputTag ]<br>
> >         explicitlyDependsOnFromDependencies: [ "compiler-generator"<br>
> > ]<br>
> ><br>
> >         Artifact {<br>
> >             filePath: input.completeBaseName<br>
> >             fileTags: [ product.compgen.outputTag ]<br>
> >             cpp.includePaths: [].concat(input.cpp.includePaths,<br>
> > FileInfo.path(input.filePath), input.compgen.outputDir)<br>
> >         }<br>
> ><br>
> >         prepare: {<br>
> >             var command = explicitlyDependsOn["compiler-<br>
> > generator"][0].filePath<br>
> >             var arguments = [<br>
> >                         "-o", output.filePath,<br>
> >                         input.filePath<br>
> >                     ]<br>
> >             var cmd = new Command(command, arguments)<br>
> >             cmd.description = "generating " + output.filePath + "<br>
> > from<br>
> > " + input.filePath<br>
> >             cmd.highlight = "codegen"<br>
> >             return [ cmd ]<br>
> >         }<br>
> >     }<br>
> > }<br>
> ><br>
> > _______________________________________________<br>
> > Qbs mailing list<br>
> > <a href="mailto:Qbs@qt-project.org" target="_blank">Qbs@qt-project.org</a><br>
> > <a href="https://lists.qt-project.org/listinfo/qbs" rel="noreferrer" target="_blank">https://lists.qt-project.org/listinfo/qbs</a><br>
><br>
> _______________________________________________<br>
> Qbs mailing list<br>
> <a href="mailto:Qbs@qt-project.org" target="_blank">Qbs@qt-project.org</a><br>
> <a href="https://lists.qt-project.org/listinfo/qbs" rel="noreferrer" target="_blank">https://lists.qt-project.org/listinfo/qbs</a><br>
<br>
_______________________________________________<br>
Qbs mailing list<br>
<a href="mailto:Qbs@qt-project.org" target="_blank">Qbs@qt-project.org</a><br>
<a href="https://lists.qt-project.org/listinfo/qbs" rel="noreferrer" target="_blank">https://lists.qt-project.org/listinfo/qbs</a><br>
</blockquote></div>