macro that returns the lazarus/lcl version lazarus / 11-Options ---------------------------------------------------------------------- taazz · 2014-06-19 01:06 OK the problem is that you guys release faster than I test or install. Good for you but I end up with multiple installations until I get thinks going at this time I have two 1.0.14 and 1.2.0 the problem starts when I try to install the 3rd party component to one of my installations they overwrite the existing ppus making switching from one version to an other a bit slower to get up to speed. I was thinking to editing all the packages and adding something like $(FPCVer) in the output path bat since most of your releases use the same fpc this wouldn't help at all. So is there a way to retrieve the lazarus version similar to $(FPCVer) to be used in paths? ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 05:30 Brilliant idea, and will help me tidy my projects as well. I've had a look on the wiki, and briefly in the code.   I can't see anything. ---------------------------------------------------------------------- BigChimp · 2014-06-19 06:00 From my notes: it's at least available for the LCL version; can't seem to find a reference on the wiki   similr lcl_fullversion for lazarus (needs LCLVersion in uses clause) (better than lcl_major and lcl_minor)    {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)    {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0 ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 06:23 Quote   {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)    {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0That's in Code.   @Taazz is talking about IDE Macros.  Well, I assume that's what @Taazz is taking about.  We all know assumption makes an "ASS out of U and MPTION".  Wait, that doesn't sound right... Either way, this is what I think the topic is about http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames UPDATE: I particularly like the idea of using this for all those little bugtracker demo's.  Keep each build separate.... ---------------------------------------------------------------------- BrunoK · 2014-06-19 06:35 Would : procedure TfmAccelChar.FormShow(Sender: TObject); begin   Caption := Caption + ' [FPC ' + {$I %FPCVERSION%}     +'/Laz ' + {$I version.inc}     +']'; That gives : Caption='fmAccelChar [FPC 2.6.4/Laz 1.2.0]' Be useful ? ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 06:39 QuoteWould : procedure TfmAccelChar.FormShow(Sender: TObject); begin   Caption := Caption + ' [FPC ' + {$I %FPCVERSION%}     +'/Laz ' + {$I version.inc}     +']'; That gives : Caption='fmAccelChar [FPC 2.6.4/Laz 1.2.0]' Be useful ? I don't think so, I think we're talking about "Project" - "Options" - "Paths".   Have a look at the screenshot I've added here.  See I'm using $(TestDir), $(TargetCPU) etc.  Taazz is asking if there is a %(LAZVer) equivalent. ---------------------------------------------------------------------- BigChimp · 2014-06-19 07:08 Quote from: Mike.Cornflake on June 19, 2014, 08:23:39 amQuote   {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)    {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0That's in Code.   @Taazz is talking about IDE Macros. Sure, but LCL_FULLVERSION is a macro, conditional define or whatever it is (as you see I'm not clear on the distinctions). So perhaps it can be used as an IDE macro like its FPC equivalent. ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 07:22 I've had a look in the code (for 1.2.2, I don't have trunk with me).  buildmanager.pas has a series of functions, one for each of IDE Macros defined in that wiki page.  Nothing there for Lazarus version.  Doesn't look too hard to extend though, a string constant needs defining (elsewhere) and a matching function needs implementing and registering against the string.  Looks like a simple design - I like those...  I might have a play tonight and submit a patch.  Though there will be a new String that needs a translation creating for it.  That's the only bit I'm nervous about.  Don't want to a add a string that breaks other translations if there is no translation - really not sure how that side of life works...   I'll play though :-) Mind you, there still might be a way with the existing macros and functions.  Just because I can't see it, don't mean it aint there :-) QuoteLCL_FULLVERSION is a macro, conditional define or whatever it is (as you see I'm not clear on the distinctions)I suspect the correct term is "hack" :-) UPDATE: Forgot - dinner plans tonight :-(   I'll play with the code over the weekend... ---------------------------------------------------------------------- taazz · 2014-06-19 15:55 As mike already said I'm interesting exclusively on IDE Macros and since we or subject how about extending those to allow me to add my own static macros as well eg I could add a macro named projects or components or what ever I need for that matter this ofcourse will be static for now or have a pascal script attach to it? ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 19:29 Good golly.  I got $(LAZVer) working in 4 to 5 lines of code (depending on whether you count an if then else as three or four lines).  I had half an hour free before dinner and it was really was as easy as a first glance at the code suggested.  Mind you, I've got a lot of testing to do before I submit the patch, and I want to see if I can add a $(SVNRevision) as well. Quotesince we or subject how about extending those to allow me to add my own static macros as wellQuoteor have a pascal script attach to it? I'll leave that to my betters :-)   For now I'll see how I go with my first IDE patch. Mind you, after a quick think - if you want to go down the pascal script side of things wouldn't a makefile be a better solution for you?  I vaguely remember discussion of fpmake being either developed, or rewritten, or, you know, something.  Not my world I'm afraid... ---------------------------------------------------------------------- taazz · 2014-06-19 19:38 Quote from: Mike.Cornflake on June 19, 2014, 09:29:29 pmGood golly.  I got $(LAZVer) working in 4 to 5 lines of code (depending on whether you count an if then else as three or four lines).  I had half an hour free before dinner and it was really was as easy as a first glance at the code suggested.  Mind you, I've got a lot of testing to do before I submit the patch, and I want to see if I can add a $(SVNRevision) as well. Quotesince we or subject how about extending those to allow me to add my own static macros as wellQuoteor have a pascal script attach to it? I'll leave that to my betters :-)   For now I'll see how I go with my first IDE patch. Mind you, after a quick think - if you want to go down the pascal script side of things wouldn't a makefile be a better solution for you?  I vaguely remember discussion of fpmake being either developed, or rewritten, or, you know, something.  Not my world I'm afraid... I'm a borlander we borlanders never learned or needed the use of make make files and all that barbaric command line interfaces and options. Those are shameful memories of the past we are not going back to such a barbaric era ever again give me death or give me a smashing IDE and all that ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 19:54 QuoteThose are shameful memories of the past What?!  That's the bit you took from my glorious post about my first ever IDE mod going unexpectedly well?!?  Particularly with those mods being in the direction you personally were enquiring about?  For shame...  Seriously though, I personally agree - never liked Makefiles.  I'll need to mull it over but right now I just can't picture how Pascal Scripts embedded within a part of the UI only are going to be any less evil though. ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 20:15 Darned :-(   I've mulled it over.  There's already a PascalScript mechanism for build time.  Project Options - Other.  You want to be able to declare variables or functions here somehow and access them as $(XXX) elsewhere.... I'll play, but I'm not promising anything.  Let's see how I go with the easier stuff first...  This honestly might need to be handed over to the grownups.... ---------------------------------------------------------------------- taazz · 2014-06-19 20:21 Quote from: Mike.Cornflake on June 19, 2014, 09:54:07 pmQuoteThose are shameful memories of the past What?!  That's the bit you took from my glorious post about my first ever IDE mod going unexpectedly well?!?  Particularly with those mods being in the direction you personally were enquiring about?  For shame...  Seriously though, I personally agree - never liked Makefiles.  I'll need to mull it over but right now I just can't picture how Pascal Scripts embedded within a part of the UI only are going to be any less evil though. well it will enable me to add extra dynamic macros that will return the loged in user the users temp folder or any other special interest folder. this will enable me to have single installation for multiple users instead of one installation per user that is now. It doesn't have to be pascal script you know as long as I can register my own functions and names through a package I could do the same and for god sake I do not mean that you should implement it the only thing I said was that now that I'm thinking about macros it would be good to have all or part of the above just an idea nothing more. ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-19 20:37 Quoteit will enable me to add extra dynamic macros that will return the loged in user the users temp folder or any other special interest folder.Been too long since I played with Delphi - can't remember this being a feature, or how it would have been implemented...  Sounds useful though. QuoteDarned :-(   I've mulled it over.This bit wasn't serious.  One of those dry humour things that loses translation without the body language or tone to help convey it... Quote for god sake I do not mean that you should implement itAnd I never said I would, only that I would play.  I'll be honest, I'm intrigued by the whole concept (of expanding the IDE), and would genuinely love to play with this code... ---------------------------------------------------------------------- taazz · 2014-06-19 20:52 Quote from: Mike.Cornflake on June 19, 2014, 10:37:22 pm Been too long since I played with Delphi - can't remember this being a feature, or how it would have been implemented...  Sounds useful though. There you go the Delphi 2007 option for that specific ability (attached). ---------------------------------------------------------------------- Stephano · 2014-06-20 15:42 Quote from: taazz on June 19, 2014, 03:06:17 amOK the problem is that you guys release faster than I test or install. Good for you but I end up with multiple installations until I get thinks going at this time I have two 1.0.14 and 1.2.0 the problem starts when I try to install the 3rd party component to one of my installations they overwrite the existing ppus making switching from one version to an other a bit slower to get up to speed. I was thinking to editing all the packages and adding something like $(FPCVer) in the output path bat since most of your releases use the same fpc this wouldn't help at all. Instead of editing packages, just override the output directory in project options/additions and overrides (stored in the IDE) and use the FPCVER macro (or any other macro) there. You can then set these project options as default. ---------------------------------------------------------------------- taazz · 2014-06-20 15:50 Quote from: Stephano on June 20, 2014, 05:42:08 pmInstead of editing packages, just override the output directory in project options/additions and overrides (stored in the IDE) and use the FPCVER macro (or any other macro) there. You can then set these project options as default. Yeah seen that didn't even try to understand it. It looks like some ones nightmare puked on screen. No real value to me not unless I find some documentation explaining what I'm looking. ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-21 07:08 Quote from: Stephano on June 20, 2014, 05:42:08 pmInstead of editing packages, just override the output directory in project options/additions and overrides (stored in the IDE) and use the FPCVER macro (or any other macro) there. You can then set these project options as default. Nicely found.  I see you can add your own IDE Macros there as well, and change their values according to your different build modes.  I agree, that UI is pretty non-intuitive.  But now I've had a quick play, it certainly reproduces some of the functionality that I can deduce from the D2007 screenshot.  Only thing missing from there is environment variables... ---------------------------------------------------------------------- Stephano · 2014-06-21 08:56 Quote from: Mike.Cornflake on June 21, 2014, 09:08:12 amOnly thing missing from there is environment variables... You can use env variables too: $Env(env_var) http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames#E nvironment Edit: If you want to override env variables, use run/runparameters/Environment ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-21 09:32 Excellent :-) ---------------------------------------------------------------------- Mike.Cornflake · 2014-06-23 04:28 Patch for $(LAZVer) accepted in trunk... http://bugs.freepascal.org/view.php?id=26379 ---------------------------------------------------------------------- taazz · 2014-06-23 04:33 Quote from: Mike.Cornflake on June 23, 2014, 06:28:47 amPatch for $(LAZVer) accepted in trunk... http://bugs.freepascal.org/view.php?id=26379 Congratulations, very well done and thank you.