Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

Build modes, macros and conditionals

31 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi all,

There are some new options to create
* sets of compiler options - called "Build modes",
* project and package macros - called "Build macros"
* and rules to set macros, paths and options automatically depending on target platform - called "Conditionals".

See here for details and examples:

http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes http://wiki.lazarus.freepascal.org/Macros_and_Conditionals

Please test.

Important compatibility note:
When opening a new project with an old IDE, you will only see the default mode. If you save the project with the old IDE you will loose all other modes, all macros and conditionals.

Mattias

Reply by email

Marco van de Voort
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
There are some new options to create * sets of compiler options - called "Build modes", * project and package macros - called "Build macros" * and rules to set macros, paths and options automatically depending on target platform - called "Conditionals". See here for details and examples: http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes http://wiki.lazarus.freepascal.org/Macros_and_Conditionals Please test. Important compatibility note: When opening a new project with an old IDE, you will only see the default mode. If you save the project with the old IDE you will loose all other modes, all macros and conditionals.

Looks nice. One small interesting aspect: it might be worthwhile to set environment variables from the scripts.

These values can then be included into the source (e.g. for an about box) using {$I %envvar%} syntax.

See also the "Getting a program's "true name" thread.

Reply by email

Mattias Gaertner
to Marco van de Voort
Show quoted text 21 lines
On Sun, Oct 24, 2010 at 10:49:11PM +0200, Mattias Gaertner wrote: > There are some new options to create > * sets of compiler options - called "Build modes", > * project and package macros - called "Build macros" > * and rules to set macros, paths and options automatically depending on > target platform - called "Conditionals". > > See here for details and examples: > > http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes > http://wiki.lazarus.freepascal.org/Macros_and_Conditionals > > Please test. > > Important compatibility note: > When opening a new project with an old IDE, you will only see the > default mode. If you save the project with the old IDE you will loose > all other modes, all macros and conditionals. Looks nice. One small interesting aspect: it might be worthwhile to set environment variables from the scripts.

The environment variables are in the run parameters and are independent of the compiler options. At the moment you can not use macros in the environment options.
If someone needs that please create a feature report and/or a patch.

These values can then be included into the source (e.g. for an about box) using {$I %envvar%} syntax. See also the "Getting a program's "true name" thread.

Mattias

Reply by email

Mattias Gaertner
to Bernd
Show quoted text 5 lines
2010/10/24 Mattias Gaertner : > * sets of compiler options - called "Build modes", Can these also be selected with lazbuild from the command line?

Now it can.

--build-mode=name

Mattias

Reply by email

Bernd
to Mattias Gaertner

2010/10/26 Mattias Gaertner :

Show quoted text 8 lines
On Mon, 25 Oct 2010 23:51:28 +0200 Bernd wrote: > Can these also be selected with lazbuild from the command line? Now it can. --build-mode=name

Great! Such a feature (or something comparable) was missing all the time.

Reply by email

Felipe Monteiro de Carvalho
to Bernd

I haven't had yet an opportunity to test the build modes, but congratulations and thank you very much =)

Now I can say that Lazarus is trully the best IDE =)

Felipe Monteiro de Carvalho

Reply by email

patspiper
to Graeme Geldenhuys
Graeme Geldenhuys wrote 11 lines
Op 2010-10-26 12:55, Felipe Monteiro de Carvalho het geskryf: > Now I can say that Lazarus is trully the best IDE =) > ..as long as you don't try and debug your source code with it. ;-) Regards, - Graeme -

Even though debugging is weak and flawed to say the least, and even though there are other bugs, it is a fantastic and very powerful IDE which launches in a couple of seconds.

Can a part of the build modes be outside the project options, or have a default starting set? (Such as having a build mode for each required target without adding these to each and every project)

Reply by email

Bernd
to Mattias Gaertner: There are some new options to create * sets of compiler options - called "Build modes", *…

2010/10/24 Mattias Gaertner :

* sets of compiler options - called "Build modes",

Feature suggestion:

from the menu some clever way to quickly select the curently active build mode without opening the options dialog. Or maybe even something with sub menus like

run -> build as -> [x] Default
run -> build as -> [_] Debug
run -> build as -> [_] ...

run -> run as -> [x] Default
run -> run as -> [_] Debug
run -> run as -> [_] ...

and/or the toolbar button with a dropdown (I think there is something similar in eclipse, not sure, I haven't used it for a while).

Reply by email

Mattias Gaertner
to patspiper: Even though debugging is weak and flawed to say the least, and even though there are…
[...] Can a part of the build modes be outside the project options, or have a default starting set? (Such as having a build mode for each required target without adding these to each and every project)

I have not tried, but I guess the project templates should support this.

About global build modes:
A build mode contains all compiler options, including the search paths and target file. So this won't work in general.

If all your projects share a package you can add an option to the package.

Mattias

Reply by email

patspiper
to Mattias Gaertner: On Tue, 26 Oct 2010 16:05:22 +0300 I have not tried, but I guess the project templates…
Mattias Gaertner wrote 16 lines
On Tue, 26 Oct 2010 16:05:22 +0300 patspiper wrote: > [...] > Can a part of the build modes be outside the project options, or have a > default starting set? (Such as having a build mode for each required > target without adding these to each and every project) > I have not tried, but I guess the project templates should support this. About global build modes: A build mode contains all compiler options, including the search paths and target file. So this won't work in general.

Normally, to recompile a project under win32 or linux, all I have to do is change in the project options the LCL widget type (in the paths page) and the target OS (in the code generation page). Paths are taken care of by using IFDEF linux and IFDEF win32 in fpc.cfg.

I am sure build modes can be defined for the above, but since the build modes have to be defined over and over for each new project, I was wondering if there was a way to have them as standard, perhaps for new projects (the same way as a user can set default compiler options for all new projects)?

Reply by email

Felipe Monteiro de Carvalho
to patspiper
patspiper wrote
I am sure build modes can be defined for the above, but since the build modes have to be defined over and over for each new project, I was wondering if there was a way to have them as standard, perhaps for new projects (the same way as a user can set default compiler options for all new projects)?

Just copy the build modes in the LPI file. It should be trivial and take maybe 10 seconds to open both LPI files in a text editor and copy the build modes.

Felipe Monteiro de Carvalho

Reply by email

patspiper
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 15 lines
On Tue, Oct 26, 2010 at 6:27 PM, patspiper wrote: > I am sure build modes can be defined for the above, but since the build > modes have to be defined over and over for each new project, I was wondering > if there was a way to have them as standard, perhaps for new projects (the > same way as a user can set default compiler options for all new projects)? > Just copy the build modes in the LPI file. It should be trivial and take maybe 10 seconds to open both LPI files in a text editor and copy the build modes. On 10/26/2010 01:55 PM, Felipe Monteiro de Carvalho wrote: > Now I can say that Lazarus is trully the best IDE =) > >

It can be done manually, but for example, IIRC and as per Graeme, MSEide has build modes for different platforms.
I thought we agreed that Lazarus IDE rocks ;)

Reply by email

Graeme Geldenhuys
to patspiper: Even though debugging is weak and flawed to say the least, and even though there are…

Op 2010-10-26 15:05, patspiper het geskryf:

Can a part of the build modes be outside the project options, or have a default starting set? (Such as having a build mode for each required target without adding these to each and every project)

I think this will only be possible with new default project templates. I don't know how customizable they are, I just know that the "project templates" add-on really doesn't work for me. I found more problems than solutions, so ended up creating new design time packages which install new project templates for me. A lot more work, but at least this works.

As for the 'Project Options > Use as new project default' checkbox, it has never worked for me. I have no idea what that setting saves, but it was never the stuff I wanted.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net:8080/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
[...] As for the 'Project Options > Use as new project default' checkbox, it has never worked for me. I have no idea what that setting saves, but it was never the stuff I wanted.

It saves the compiler options:
search paths, target, verbosity, code generation, ... in other words: every page under projects compiler options except for the build modes page.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 16 lines
On Wed, 27 Oct 2010 12:35:43 +0200 Graeme Geldenhuys wrote: > [...] > As for the 'Project Options> Use as new project default' checkbox, it has > never worked for me. I have no idea what that setting saves, but it was > never the stuff I wanted. > It saves the compiler options: search paths, target, verbosity, code generation, ... in other words: every page under projects compiler options except for the build modes page. Mattias

Is it possible to include the build modes as well in the compiler defaults setting mechanism?

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 19 lines
On 10/27/2010 08:00 PM, Mattias Gaertner wrote: > On Wed, 27 Oct 2010 12:35:43 +0200 > Graeme Geldenhuys wrote: > > >> [...] >> As for the 'Project Options> Use as new project default' checkbox, it has >> never worked for me. I have no idea what that setting saves, but it was >> never the stuff I wanted. >> > It saves the compiler options: > search paths, target, verbosity, code generation, ... in other > words: every page under projects compiler options except for the build > modes page. > > Mattias > Is it possible to include the build modes as well in the compiler defaults setting mechanism?

Not yet. Same for the export/import load function.

I'm not sure what is the best solution:
- change the option to save all build modes
- add another check box
- move the option to the existing import/export dialog
- your idea

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Wed, 27 Oct 2010 12:35:43 +0200 It saves the compiler options: search paths, target,…
Mattias Gaertner wrote 5 lines
It saves the compiler options: search paths, target, verbosity, code generation, ... in other words: every page under projects compiler options except for the build modes page.

Even for "Free Pascal Applications"? The non-LCL ones in "File > New

Project"?
Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Even for "Free Pascal Applications"? ?The non-LCL ones in "File > New > Project"?

A quick example, just tested with the latest lazarus from trunk a few minutes ago.

"File > New > Program (a free pascal application)" Then Project Options dialog. The icon, Mac Application bundle checkbox, the manifest checkbox. No matter what I do, I always get those two checkboxes checked, and I always get a 150KB icon. :-(

My mouse already goes into auto-pilot whenever I start a new Free Pascal Program project (the only applications I use with Lazarus IDE), but still damn frustrating. Even creating a new project type package did not help in this regard.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

patspiper
to Mattias Gaertner: On Wed, 27 Oct 2010 20:15:09 +0300 Not yet. Same for the export/import load function. I'm…
Mattias Gaertner wrote 10 lines
Not yet. Same for the export/import load function. I'm not sure what is the best solution: - change the option to save all build modes - add another check box - move the option to the existing import/export dialog - your idea

Why not implement a project options profile, exactly like the IDE build mode profiles that were implemented today? Each profile could store compiler options including conditionals, and a default profile replaces the project default options.

Reply by email

patspiper
to Graeme Geldenhuys: A quick example, just tested with the latest lazarus from trunk a few minutes ago. "File…
Graeme Geldenhuys wrote 9 lines
A quick example, just tested with the latest lazarus from trunk a few minutes ago. "File> New> Program (a free pascal application)" Then Project Options dialog. The icon, Mac Application bundle checkbox, the manifest checkbox. No matter what I do, I always get those two checkboxes checked, and I always get a 150KB icon. :-(

It saves defaults for the compiler options portion only.

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: Even for "Free Pascal Applications"? The non-LCL ones in "File > New ? - Graeme -…
Show quoted text 9 lines
On 27 October 2010 19:00, Mattias Gaertner wrote: > > It saves the compiler options: > search paths, target, verbosity, code generation, ... in other > words: every page under projects compiler options except for the build > modes page. Even for "Free Pascal Applications"? The non-LCL ones in "File > New > Project"?

Yes.

Mattias

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: A quick example, just tested with the latest lazarus from trunk a few minutes ago. "File…
Show quoted text 12 lines
On 27 October 2010 23:10, Graeme Geldenhuys wrote: > > Even for "Free Pascal Applications"? ?The non-LCL ones in "File > New >> Project"? A quick example, just tested with the latest lazarus from trunk a few minutes ago. "File > New > Program (a free pascal application)" Then Project Options dialog. The icon, Mac Application bundle checkbox, the manifest checkbox. No matter what I do, I always get those two checkboxes checked, and I always get a 150KB icon. :-(

These are not compiler options.

My mouse already goes into auto-pilot whenever I start a new Free Pascal Program project (the only applications I use with Lazarus IDE), but still damn frustrating. Even creating a new project type package did not help in this regard.

What is the problem with the project templates?

Mattias

Reply by email

Mattias Gaertner
to patspiper: Why not implement a project options profile, exactly like the IDE build mode profiles…
Show quoted text 15 lines
On 10/27/2010 08:32 PM, Mattias Gaertner wrote: > > Not yet. Same for the export/import load function. > > I'm not sure what is the best solution: > - change the option to save all build modes > - add another check box > - move the option to the existing import/export dialog > - your idea > > Why not implement a project options profile, exactly like the IDE build mode profiles that were implemented today? Each profile could store compiler options including conditionals, and a default profile replaces the project default options.

There is only one IDE with only a few options, but there are four standard project default options plus a dozen others with lots of options and files. There are myriad ideas what options should be in the template, which ones should be set depending on some environment options and which ones should be asked interactively. I think the idea of Michael's package 'projecttemplates' is right: cloning a directory. Maybe it needs some nicer dialogs/menu items to fit the various tastes.
For example for me it would be sufficient to select an existing project and a dialog showing a few options what to clone. My set of 'few options' will probably be insufficient for others.

In short:
Whatever someone will implement as 'default project options' will be insufficient for others. So IMO it is best to put such a feature into a package, like Michael did.

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Wed, 27 Oct 2010 23:16:04 +0200 These are not compiler options. What is the problem…
Mattias Gaertner wrote 6 lines
> "File > New > Program (a free pascal application)" > Then Project Options dialog. The icon, Mac Application bundle > checkbox, the manifest checkbox. No matter what I do, I always get > those two checkboxes checked, and I always get a 150KB icon. :-( These are not compiler options.

I guess then we can contribute it to yet another UI layout/design issue. It's just confusing now. I much preferred when Project Options and Compiler Options were two separate dialogs. Because now that checkbox is visible no matter which part of the information you viewing, yet it old applied to half the available/shown data.

What is the problem with the project templates?

They don't work, or are simply too limited for my needs. I'll have to try them again before I can list the issues - I can't remember them off the top of my head, but there was many issues.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

Zaher Dirkey
to Mattias Gaertner: There are some new options to create * sets of compiler options - called "Build modes", *…

On Sun, Oct 24, 2010 at 10:49 PM, Mattias Gaertner <

Show quoted text 24 lines
wrote: Hi all, There are some new options to create * sets of compiler options - called "Build modes", * project and package macros - called "Build macros" * and rules to set macros, paths and options automatically depending on target platform - called "Conditionals". See here for details and examples: http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes http://wiki.lazarus.freepascal.org/Macros_and_Conditionals Please test. Important compatibility note: When opening a new project with an old IDE, you will only see the default mode. If you save the project with the old IDE you will loose all other modes, all macros and conditionals.

I prefer to be a Combobox in the top of the options form, to easy swtich between profiles.
And the compiler options must include debugger to override the IDE options debugger, for WINCE debug we choose another gdb.exe.

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101029/f060f091/attachment-0001.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 29 lines
On Sun, Oct 24, 2010 at 10:49 PM, Mattias Gaertner < > wrote: > Hi all, > > There are some new options to create > * sets of compiler options - called "Build modes", > * project and package macros - called "Build macros" > * and rules to set macros, paths and options automatically depending on > target platform - called "Conditionals". > > See here for details and examples: > > http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes > http://wiki.lazarus.freepascal.org/Macros_and_Conditionals > > Please test. > > Important compatibility note: > When opening a new project with an old IDE, you will only see the > default mode. If you save the project with the old IDE you will loose > all other modes, all macros and conditionals. > > > I prefer to be a Combobox in the top of the options form, to easy swtich between profiles. And the compiler options must include debugger to override the IDE options debugger, for WINCE debug we choose another gdb.exe.

Note: At the moment the debugger exe is part of the global options - not part of the project.

Mattias

Reply by email

Zaher Dirkey
to Mattias Gaertner

On Fri, Oct 29, 2010 at 10:06 AM, Mattias Gaertner <

Show quoted text 5 lines
wrote: Note: At the moment the debugger exe is part of the global options - not part of the project.

Yes I know, but when i want to debug my project (WinCE) in my Device i need special build of gdb.exe.
Switching between profiles Win32 or WinCE must change that gdb, i know it is need more work but is its make the profiles more useful for us.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101029/8f5edc3f/attachment.html>

Reply by email

Sven Barth
to Mattias Gaertner: On Fri, 29 Oct 2010 09:48:39 +0200 Note: At the moment the debugger exe is part of the…
Mattias Gaertner wrote 35 lines
On Fri, 29 Oct 2010 09:48:39 +0200 Zaher Dirkey wrote: > On Sun, Oct 24, 2010 at 10:49 PM, Mattias Gaertner< > > wrote: > >> Hi all, >> >> There are some new options to create >> * sets of compiler options - called "Build modes", >> * project and package macros - called "Build macros" >> * and rules to set macros, paths and options automatically depending on >> target platform - called "Conditionals". >> >> See here for details and examples: >> >> http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes >> http://wiki.lazarus.freepascal.org/Macros_and_Conditionals >> >> Please test. >> >> Important compatibility note: >> When opening a new project with an old IDE, you will only see the >> default mode. If you save the project with the old IDE you will loose >> all other modes, all macros and conditionals. >> >> >> > I prefer to be a Combobox in the top of the options form, to easy swtich > between profiles. > And the compiler options must include debugger to override the IDE options > debugger, for WINCE debug we choose another gdb.exe. Note: At the moment the debugger exe is part of the global options - not part of the project.

The ability to override selected global options per project/per build mode might be a nice feature. :)

Regards,
Sven

Reply by email