[QBS] flex

Christian Kandeler christian.kandeler at digia.com
Tue May 27 09:26:21 CEST 2014


On 05/27/2014 12:40 AM, olivier musse wrote:
> I have implemented Rules for qlalr and flex in qbs but i'm facing an issue.
> My qlarl rule is well working since the generated cpp file is a file
> that is compiled.
> But my flex rule is not working because the generated file is included
> from another cpp file so is excluded from the files list.
> When the rules.lex file is modified, ruleslexer.cpp is well generated
> but the file which includes it (rulesparser.cpp) is not re compiled.
> How can I do that?

1) Do not write the generated file into the source directory, that's 
asking for problems, as indicated by the fact that you needed to add the 
"excludeFiles" property.
2) If you want your generated file to be considered a C++ source file, 
you need to tell qbs that by giving it the "cpp" file tag:
     Artifact {
         fileName:"ruleslexer.cpp"
	fileTags: "cpp"
     }


Christian


>
> BR
>
> Olivier
>
>
>
>
> ----------------- rulesparser.cpp--------------------------
> ......
> #include "ruleslexer.cpp"
> ......
>
> Group{
>
>              name:"Source"
>
>              files:["*.cpp"]
>
>              excludeFiles:['ruleslexer.cpp']
>
>          }
>
>
> Transformer{
>
>              inputs:"rules.lex"
>
>              Artifact{
>
>                  fileName:path+"/ruleslexer.cpp"
>
>              }
>
>              prepare:{
>
>                  var  cmd  =  new  JavaScriptCommand()
>
>                  cmd.description  =  "Processing  grammar  lex  and  generate  "+output.filePath
>
>                  cmd.highlight  =  "codegen"
>
>                  cmd.sourceCode  =  function()  {
>
>                      var  lexing  =  new  Process();
>
>                      lexing.setWorkingDirectory(FileInfo.path(output.filePath));
>
>                      lexing.exec("C:/cygwin/bin/flex.exe",["-v","--noline",input.filePath]);
>
>                  }
>
>                  return  cmd
>
>              }
>
>          }
>
>
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>




More information about the Qbs mailing list