<div dir="ltr">Hi Marcel,<div><br></div><div>I could be wrong but isn't it what you are looking for?<br>Define custom toolchain specific Product and reuse it in all your Products:</div><div>--------------------------------------------------------</div><div>MarcelToolchaine.qbs</div><div>import qbs</div><div>Product {</div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">        </span><span style="font-family:arial,sans-serif">Depends</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">{</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">name</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">"cpp"</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">}</span></pre></div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">        cpp.defines</span>:<span style="color:rgb(192,192,192)"> </span>[<font color="#008000">“</font><span style="color:rgb(0,128,0)">THUMB" </span>]</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.warningLevel</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"all"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.treatWarningsAsErrors</span>:<span style="color:rgb(192,192,192)"> </span>true</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.positionIndependentCode</span>:<span style="color:rgb(192,192,192)"> </span>false</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.commonCompilerFlags</span>:<span style="color:rgb(192,192,192)"> </span>[</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-mcpu=cortex-m4"</span>,<span style="color:rgb(0,128,0)">"-mthumb"</span>,<span style="color:rgb(0,128,0)">"-mabi=aapcs"</span>,<span style="color:rgb(0,128,0)">"-mfloat-abi=hard"</span>,<span style="color:rgb(0,128,0)">"-mfpu=fpv4-sp-d16"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-std=gnu99"</span>,<span style="color:rgb(0,128,0)">"-flto"</span>,<span style="color:rgb(0,128,0)">"-fno-builtin"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-fdata-sections"</span>,<span style="color:rgb(0,128,0)">"-ffunction-sections"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>]</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.includePaths</span>:<span style="color:rgb(192,192,192)"> </span>[<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"."</span><span style="color:rgb(192,192,192)"> </span>]</pre></div><div>}</div><div><div>--------------------------------------------------------</div></div><div><br></div><div>--------------------------------------------------------</div><div>Kernel,qbs:</div><div>import qbs</div><div><br></div><div>MarcelToolchain {</div><div>  files: [ "*.cpp", "*.h"]</div><div>}</div><div><div>--------------------------------------------------------</div></div><div><br></div><div>--------------------------------------------------------</div><div>YourEmbeddedProject:</div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">Project<span style="color:rgb(192,192,192)"> </span>{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,0)">references</span>:<span style="color:rgb(192,192,192)"> </span>[</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">"kernel/kernel.qbs"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>]</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>MarcelToolchaine{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">type</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"application"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">name</span>:<span style="color:rgb(192,192,192)"> </span><font color="#008000">“</font><span style="color:rgb(0,128,0)">example"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">        </span><span style="font-family:arial,sans-serif">Depends</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">{</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">name</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">"kernel"</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">}</span><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">                </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">files</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">[ </span><font color="#008000" style="font-family:arial,sans-serif">“</font><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">main.c" </span><span style="font-family:arial,sans-serif">]</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">    }</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">}</pre><pre style="margin-top:0px;margin-bottom:0px"><div style="white-space:normal;font-family:arial,sans-serif">--------------------------------------------------------</div><div style="white-space:pre-wrap"><br></div><div style="white-space:pre-wrap"><br></div><div style="white-space:pre-wrap">You also can defile your custom Module:</div><div style><span style="white-space:pre-wrap">import qbs 1.0
<br></span></div><div style><span style="white-space:pre-wrap">qbs_search_path/modules/</span><span style="white-space:pre-wrap">MarcelToolchain/</span><span style="white-space:pre-wrap;font-family:arial,sans-serif">MarcelToolchain</span><span style="white-space:pre-wrap;font-family:arial,sans-serif">.qbs:</span></div><div style><span style="white-space:pre-wrap">Module {
        Depends { name: "cpp" }
</span><div style="font-family:arial,sans-serif;white-space:normal"><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">        cpp.defines</span>:<span style="color:rgb(192,192,192)"> </span>[<font color="#008000">“</font><span style="color:rgb(0,128,0)">THUMB" </span>]</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.warningLevel</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"all"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.treatWarningsAsErrors</span>:<span style="color:rgb(192,192,192)"> </span>true</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.positionIndependentCode</span>:<span style="color:rgb(192,192,192)"> </span>false</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">cpp.commonCompilerFlags</span>:<span style="color:rgb(192,192,192)"> </span>[</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-mcpu=cortex-m4"</span>,<span style="color:rgb(0,128,0)">"-mthumb"</span>,<span style="color:rgb(0,128,0)">"-mabi=aapcs"</span>,<span style="color:rgb(0,128,0)">"-mfloat-abi=hard"</span>,<span style="color:rgb(0,128,0)">"-mfpu=fpv4-sp-d16"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-std=gnu99"</span>,<span style="color:rgb(0,128,0)">"-flto"</span>,<span style="color:rgb(0,128,0)">"-fno-builtin"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">"-fdata-sections"</span>,<span style="color:rgb(0,128,0)">"-ffunction-sections"</span>,</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>]</pre></div><span style="white-space:pre-wrap">
}
</span></div><div style="white-space:pre-wrap"><br></div><div style="white-space:pre-wrap">Then kernel.qbs and <span style="font-family:arial,sans-serif">YourEmbeddedProject.qbs will look like this:</span></div><div style="white-space:pre-wrap"><div>--------------------------------------------------------</div><div>Kernel,qbs:</div><div>import qbs</div><div><br></div><div>Product {</div><div>  Depends { name: "<span style="font-family:arial,sans-serif">MarcelToolchain</span><span style="font-family:arial,sans-serif">" }</span></div><div>  files: [ "*.cpp", "*.h"]</div><div>}</div><div>--------------------------------------------------------</div><div><br></div><div>--------------------------------------------------------</div><div>YourEmbeddedProject.qbs:</div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">Project<span style="color:rgb(192,192,192)"> </span>{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,0)">references</span>:<span style="color:rgb(192,192,192)"> </span>[</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">"kernel/kernel.qbs"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>]</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>Product{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">type</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"application"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,0)">name</span>:<span style="color:rgb(192,192,192)"> </span><font color="#008000">“</font><span style="color:rgb(0,128,0)">example"</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><div><br></div></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">        </span><span style="font-family:arial,sans-serif">Depends</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">{</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">name</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">"kernel"</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">}</span><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">        </span><span style="font-family:arial,sans-serif">Depends</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">{</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">name</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">"MarcelToolchain"</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">}</span><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(192,192,192)">                </span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">files</span><span style="font-family:arial,sans-serif">:</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif">[ </span><font color="#008000" style="font-family:arial,sans-serif">“</font><span style="font-family:arial,sans-serif;color:rgb(0,128,0)">main.c" </span><span style="font-family:arial,sans-serif">]</span><br></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">    }</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">}</pre><pre style="margin-top:0px;margin-bottom:0px"><div style="white-space:normal;font-family:arial,sans-serif">--------------------------------------------------------</div><div><br></div></pre></div></div></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-14 2:46 GMT+08:00 Marcel Mulder <span dir="ltr"><<a href="mailto:marcel.mulder@xs4all.nl" target="_blank">marcel.mulder@xs4all.nl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">><br>
> Am I getting You right, that You want to set some toolchain options in a<br>
> product and all parent products should be build with the same options? Even<br>
> though that makes sense in Your case, think about the following example<br>
> which is not uncommon:<br>
><br>
> Product A depends on product C<br>
> Product B depends also on product C.<br>
><br>
> Let's assume product C defines some default toolchain options. When product<br>
> A defines its own toolchain flags and product B does that as well, what<br>
> would happen with the options in product C? You can not simply override them<br>
> with the options of a dependent product A/B. Product C would have to be<br>
> build twice - with different options for A and B. But QBS builds every<br>
> product exactly once during a build procedure.<br>
><br>
> A straight forward solution for the above scenario would be, to define all<br>
> common toolchain options in the toolchain profile.<br>
><br>
<br>
</span>No, you don’t get it right. I want to propagate down, not up. So the parent product determines the compile options of the siblings.<br>
In your case Product A defines the compile options for Product C when building A and Product B defines the compile option for Product C when building B.<br>
Do you know how I can do that? Because when a build for example product A than product C is build with the cpp module defaults and not with the compile options of product A.<br>
Product C should however be able to override or add compile options.<br>
<span class=""><br>
><br>
>> It is actually strange that something simple like<br>
>> compile options can’t be propagated or that files can be simply added to<br>
>> the files: [] list. For example like:<br>
>><br>
>> Export { files: [ foo.c ] }<br>
>><br>
>> I tried to look into the code and add it myself, but I have to take more<br>
>> time to understand the structure of the abs sources.<br>
><br>
> What exactly are You going to achieve with that?<br>
><br>
<br>
</span>What I want to achieve is what I described above. When it can’t be done with the current implementation of qbs it should be added because I think that this is core functionality.<br>
With qmake I use .pri file to achieve the same and with make files people do it all the time. At least in my world, the embedded one.<br>
<br>
Regards, Marcel<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
QBS mailing list<br>
<a href="mailto:QBS@qt-project.org">QBS@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/qbs" target="_blank">http://lists.qt-project.org/mailman/listinfo/qbs</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">-- <br>WBR,<br>  Andrii Anpilogov<br>  Phone: +86 186-1660-3720<br>  Skype: anpilogov.andrey<br>  mailto:<a href="mailto:anpilog@gmail.com" target="_blank">anpilog@gmail.com</a>, <a href="mailto:andrii.anpilogov@mesheven.com" target="_blank">andrii.anpilogov@mesheven.com</a><br><div><img src="http://qrcoder.ru/code/?BEGIN%3AVCARD%0AN%3AAnpilogov%3BAndrey%0AORG%3ACraneMS%0ATITLE%3Asenior+software+developer%2Fteam+Leader%0ATEL%3A%2B380675455666%0AEMAIL%3Aanpilog%40gmail.com%0ANOTE%3AEmbedded+Software+Development%2C+C%2FC%2B%2B%2C+team+leadership%0AEND%3AVCARD&3&0"><br></div></div></div>
</div>