[lazarus] Compiler Options

Michal Bukovjan m_bukovjan at advis.cz
Wed Mar 22 03:59:09 EST 2000


"Michael A. Hess" wrote:

> Curtis White wrote:
> >
> > > For the storage of Lazarus options, I would recommend using
> > > something like ~/lazarus/.compileroptions.xml instead.
>
> This should be the only place.
>
> > > In the above directory, these would be user-specific options. The
> > > global defaults should go to /etc/lazarus/.compileroptions.xml
>
> This would be bad. In a single user work station this would be OK but
> given Linux's multiuser organization and the fact that a business might
> want to use FPC with multiple developers I would not be happy if my
> defaults settings would change because somebody else set theirs in a
> different manor. All of the settings need to be placed in the users home
> ~/ directory tree.

I agree. This should not be the only place, though. For me it seems logical
to have some this structure :

Hardcoded defaults -> System-wide settings (/etc/lazarus) -> User specific
settings (~/lazarus)

The settings would then be looked up in this order. When user settings are
not found, a system wide fallback would be used. If not found, hardcoded
defaults would take place. This method is used in Afterstep, Gnome, and
bunch of other apps I looked so far. The problem you describe above can be
solved by copying system wide settings into your user directory the first
time Lazarus is launched.

>
> > I agree with this, but then how do we do it on Windows?  I'm not sure
> > exactly how to handle this without putting in $IFDEF's to determine if
> > we are in Linux or Windows.  And I don't think we are using IFDEFs
> > like that. So how do I handle this?
>
> The best way is to do what the FCL does. Create 2 seperate files. One
> for Linux in a Linux directory and one for Windows in a Win32 directory.
> When the program is linked the Makefile will use the correct directory
> in it's units setting. The LCL code will just call the same procedure
> and the Makefile makes sure the correct .ppu is linked for the correct
> platform. In fact we need to do more of this with other items.
>
> If I can ever get my butt in gear and finish it this is how the
> TRegistry will work. The Win32 files will use the REAL Windows Registry
> and the Linux files will use an XML look alike. The correct .ppu pointed
> to linked in by the Makefile.
>
> Some things just have to be coded twice in different files.

Agree. In the case of dirs, only IFDEFs with different consts would
suffice, in other cases (i.e. registry) different units as in FCL have to
be used.
Hmm, is it possible to pass some symbols from the Makefile into the Pascal
source code?

Michal Bukovjan






More information about the Lazarus mailing list