[QBS] 'Large' projects with hierarchy

Marcel Mulder marcel.mulder at xs4all.nl
Fri Jan 2 14:38:07 CET 2015


Sorry for all the abs in stead of qbs abbreviations. Nasty spelling correctors ;) 

> On 02 Jan 2015, at 14:32, Marcel Mulder <marcel.mulder at xs4all.nl> wrote:
> 
> Hi All,
> 
> Currently I am using QBS with and without QT Creator for some projects of my. All my project are bare metal ARM based projects. I really like using QT Creator en be able to code and debug my controllers boards.
> There is only one thing I bumped into and do not know how to deal with it. What I want is to have is one project/product qbs file were I define all de compile options. Like:     cpp.commonCompilerFlags,  cpp.linkerFlags. 
> Within the subdirectories (I use a RTOS) I want to define the files and include paths for all other stuff. My current setup is like
> 
> Project {
> 	referencens: [
> 		“hal/hal.qbs",
> 		“drivers/drivers.qbs",
> 		“kernel/kernel.qbs”
> 	]
> 	Product {
> 
> 		Depends { name: “cpp” }
> 		Depends { name: “hal” }
> 		Depends { name: “ drivers” }
> 		Depends { name: “ kernel” }
> 
> 		cpp.commonCompilerFlags….
> 		file: [ “main.c”, etc ]
> 	}
> }
> 
> This works fine for the include paths at compile time and to have a nice file structure in QT Creator. I does not however compile the c file within the other abs files. Such a sub abs file looks like:
> 
> Product {
> 	name: "kernel"
> 	files: [
>        	“src/a.c",
>        	“src/b.c",
>        	“src/c.c”,
> 		etc
> 	]
>    Export {
>        Depends { name: 'cpp' }
>        cpp.includePaths: [ "include" ]
>    }
> 
> I can also get this to compile by adding Depends { name: “cpp”} to the product but than it does not use my compiler setting which I need for my ARM cortex controller.
> I few question raises:
> 
> 1. Is there another way of dealing with defining the compile option in one qbs file and and define include paths and source files in another abs file? 
> 2. Is it an idea that if you depend on a product the files defined in the sub product are added the the files list of the product which depends on it? Just as the include path is added to the compile options.
> 
> Regards,
> Marcel
> 




More information about the Qbs mailing list