<br><br><div class="gmail_quote">On Thu, Nov 25, 2010 at 3:47 PM, Mattias Gaertner <span dir="ltr"><<a href="mailto:nc-gaertnma@netcologne.de">nc-gaertnma@netcologne.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Thu, 25 Nov 2010 12:43:09 +0300<br>
<div><div></div><div class="h5">Max Vlasov <<a href="mailto:max.vlasov@gmail.com">max.vlasov@gmail.com</a>> wrote:<br>
<br>
> On Thu, Nov 25, 2010 at 1:50 AM, Mattias Gaertner <<a href="mailto:nc-gaertnma@netcologne.de">nc-gaertnma@netcologne.de</a><br>
> > wrote:<br>
><br>
> > On Thu, 25 Nov 2010 00:44:52 +0300<br>
> > Max Vlasov <<a href="mailto:max.vlasov@gmail.com">max.vlasov@gmail.com</a>> wrote:<br>
> ><br>
> > > On Thu, Nov 25, 2010 at 12:36 AM, Mattias Gaertner <<br>
> > > <a href="mailto:nc-gaertnma@netcologne.de">nc-gaertnma@netcologne.de</a>> wrote:<br>
> > ><br>
> > > > On Thu, 25 Nov 2010 00:03:09 +0300<br>
> > > > Max Vlasov <<a href="mailto:max.vlasov@gmail.com">max.vlasov@gmail.com</a>> wrote:<br>
> > > ><br>
> > > > > Hi,<br>
> > > > > sometimes it takes time for a Delphi developer to understand the<br>
> > logic of<br>
> > > > > fpc/lazarus packages and it's indeed content and full. Recently tried<br>
> > to<br>
> > > > > measure different performance related numbers for a project and<br>
> > finally<br>
> > > > got<br>
> > > > > that I should change the level of optimization for packages, not for<br>
> > the<br>
> > > > > project if performance-related unit is in a package (CMIIW). But just<br>
> > > > > wondering,.. these options actually consumes time so more often<br>
> > > > developers<br>
> > > > > leave optimization to fastest and when the time comes, rebuilds the<br>
> > > > project<br>
> > > > > with full optimization on. It looks like there's no single option<br>
> > > > allowing<br>
> > > > > do this for a given project in Lazarus, right? But even if there's an<br>
> > > > option<br>
> > > > > to rebuild all related packages, I still can't with one click change<br>
> > this<br>
> > > > > radiobox for every related package. Probably this won't be a problem<br>
> > if I<br>
> > > > > finally understand the logic and get used to it, just trying to find<br>
> > > > whether<br>
> > > > > I miss something<br>
> > > ><br>
> > > > You can add a macro (e.g. $(MyOptions) ) to the custom options of<br>
> > > > a package and set the macro in the project build macros (e.g.<br>
> > > > MyOptions=-O4). You need 0.9.29 for this.<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > Mattias, it looks very promising, but will it affect the logic of "build<br>
> > > all" command, currently from what I see from output it doesn't care about<br>
> > > other packages units as long as their dates were not changed.<br>
> ><br>
> > If the build options changed the package is recompiled.<br>
> ><br>
> ><br>
> > > In other<br>
> > > words, what is the menu item I should use to "force" fpc compile not only<br>
> > > units with changed dates, but all units from all packages using and with<br>
> > my<br>
> > > new $(MyOptions)?<br>
> ><br>
> > No force needed.<br>
> ><br>
> ><br>
> Mattias, there's still something missing in my understanding. I looked also<br>
> at <a href="http://wiki.lazarus.freepascal.org/Macros_and_Conditionals" target="_blank">http://wiki.lazarus.freepascal.org/Macros_and_Conditionals</a> and tried to<br>
> do as suggested. My package now contains macro munilib_optimization with<br>
> values 'General' and 'Full'<br>
><br>
> if munilib_optimization = 'General' then<br>
> CustomOptions:='-O1'<br>
> else<br>
> CustomOptions:='-O3'<br>
><br>
> Then I try to change the value munilib_optimization in the main project<br>
> Build modes (the project uses this package) . Ctrl-F9 -> Nothing changes<br>
> (the corresponding .ppu and .o for the unit in question stays the same date<br>
> regardless of my change), Build All -> Also nothing changes.<br>
<br>
</div></div>This should work.<br>
Under what platform, fpc version?<br>
Can you send me an example?<br>
<div class="im"><br>
<br></div></blockquote><div><br>Mattias, it's great that it should work as I expected, let's see what I did wrong :) <br></div><div><br><br>Lazarus 0.9.29 r28448 FPC 2.4.2 i386-win32-win32/win64<br><br>The following actions to reproduce:<br>
<br><br>------------------------------------------ Create package conditionalpackage.lpk, <br><br><br>------------------------------------------- add this unit to the package <br><br>unit conditionalunit;<br><br>{$mode objfpc}{$H+}<br>
<br>interface uses Classes, SysUtils, Dialogs, MsgUnit;<br><br>procedure ShowProjDependentMessage;<br><br>implementation<br><br>procedure ShowProjDependentMessage;<br>begin<br> MessageDlg(UnitMessage, mtInformation, [mbOk], 0);<br>
end;<br><br>end.<br><br><br>------------
Place file MsgUnit in subfolder Ver1 <br><br>unit MsgUnit;<br><br>interface<br><br>const<br> UnitMessage = 'This is first version';<br><br>implementation<br><br>end.<br><br>------------ And this one in the subfolder Ver2 <br>
<br>unit MsgUnit;<br>
<br>
interface<br>
<br>
const<br>
UnitMessage = 'This is second version';<br>
<br>
implementation<br>
<br>
end.<br>
<br>----------------------------------------<br><br>Builds macro <br>ConditionalPackage_Version <br>with subvalues 1 and 2<br><br>Conditional text<br><br>if ConditionalPackage_Version = '1' then<br> UnitPath := 'Ver1\'<br>
else<br> UnitPath := 'Ver2\'<br><br>--------------------<br><br>Create a project that uses this package and conditionalunit, place a button, call ShowProjDependentMessage.<br><br>If we did nothing, the message will be This is second version'. If I go the the project Build macro and chose version 1 then ..<br>
- Ctrl-F9 the message is still the same (second version), <br>- Build all -> still the same, <br>- Compile in the package window, compile project - still the same. <br><br><br>Max Vlasov<br></div></div>