[QBS] run script after building products

Tim Hutt tdhutt at gmail.com
Tue Mar 3 17:20:47 CET 2015


Here's my solution, for converting elf to bin. NOTE THAT YOU MUST LEAVE
"application" IN THE TYPE LIST. Otherwise the run configuration of the Bare
Metal projects won't work.

CppApplication {

	type: ["application", "bin"]


// ...

	property string objCopyPath:
cpp.compilerPath.replace("arm-none-eabi-g++", "arm-none-eabi-objcopy")
	Rule {		id: bin		inputs: ["application"]
		Artifact {			fileTags: ["bin"]			fileName: "firmware.bin"		}
		prepare: {			var args = ["-O", "binary", input.filePath,
output.filePath];			var cmd = new Command(product.objCopyPath,
args);			cmd.description = "converting to bin: " +
FileInfo.fileName(output.filePath);			cmd.highlight =
"linker";			return cmd;		}	}



On 2 March 2015 at 19:16, Stephan Gatzka <stephan.gatzka at gmail.com> wrote:

> Hello all!
>
> Please forgive me my probably basic questions, but I'm a newbie to qbs.
>
> I've to build a bare metal project, consisting of two elf binaries and
> an FPGA image.
>
> Building both elf binaries worked like charm. But after building both
> elf binaries I have to combine both elf files and the pre-built FPGA
> image into a single image. This involves some fancy calls to objcopy
> and dd.
>
> Now I'm struggling with the task how to implement that in a qbs product.
>
> This is my current structure:
> Project {
>   name: "productName"
>
>   Application {
>     name: "app1"
>     ...
>   }
>
>   Application {
>     name: "app2"
>     ...
>   }
>
>   Product {
>     name: "image"
>
>     Depends {
>       name:"app1"
>       required:true
>     }
>     Depends {
>       name:"app2"
>       required:true
>     }
>
>   }
> }
>
> Inside the image product I tried to make the calls to objcopy and dd
> in the prepare script of a Rule or a Transformer. I think I haven't
> totally understood the behavior or intention of the usings and input
> directives.
>
> Can somebody please give me a hint how to solve this task best?
>
> Kind regards,
>
> Stephan
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150303/bc924274/attachment.html>


More information about the Qbs mailing list