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