[QBS] Just a few questions

Christian Kandeler christian.kandeler at digia.com
Tue May 27 18:05:10 CEST 2014


On 05/27/2014 05:36 PM, Kevin Chaves wrote:
>  > Possibly. I guess it depends on what exactly you want to do.
>
> One example is to build qwt and export the paths to the headers and
> .lib. After this initial build we shouldn't have to worry about building
> it again in the project tree. The applications that use it need to be
> configured to link to the static libraries. Now apply that example to a
> bunch of third party libraries that aren't going to be touched on a
> regular basis.

So I suppose something like this could work:

StaticLibrary {
     // name etc.
     Depends { name: "Qt.core" }
     Transformer {
         Artifact {
             fileName: "xyz" // Can be hardcoded. Does not determine 
anything in the case, but needs to match whatever make produces.
             fileTags: "staticlibrary"
         }
         prepare: {
	    var qmakeCmd = new Command(Qt.core.binPath + "/qmake", "["-r", 
<path to foreign project>]);
	    qmakeCmd.description = "qmake"
             qmakeCmd.workingDirectory = product.buildDirectory + 
product.name;
	    var makeCmd = new Command("make", ["-s"]);
	    makeCmd.workingDirectory = qmakeCmd.workingDirectory;
	    return [qmakeCmd, makeCmd];
	}
     }

     Export {
         Depends { name: "cpp" }
         cpp.includes: [<path to headers>]
     }
}


Completely untested, but something like this would be my first attempt. 
Of course, if you want to do this for more than one product, you'd put 
the transformer into a module and make the location of the top-level 
project file and the headers properties of that module. Then a simple
     Depends { name: "<product name>" }
in another qbs file should be enough, unless I'm overlooking some basic 
issue.


Christian



More information about the Qbs mailing list