alternative aliases [Re: [fpc-devel] Re: [fpc-pascal] Re: Ideas for namespace implementation]

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Jul 27 14:49:33 CEST 2010


Op 2010-07-27 13:27, Martin het geskryf:
> 
> I added several point to 
> http://wiki.lazarus.freepascal.org/Namespaces#Mapping_Namespace_to_each_search_path

[... maybe this is stretching your idea of "packages" a bit, but I thought
I would ask either way...]

I like your "packages" idea, it sounds similar to Lazarus Packages (*.lpk),
but without the Lazarus IDE requirement. I currently use Lazarus Packages
support for managing fpGUI based applications, and would like to see if
your idea could fit in with fpGUI too (without needing Lazarus IDE
support). The problem I see, is that your "alias/package" only seems to
take one directory location for source code (*.pas). For fpGUI, I have a
directory hierarchy for the fpGUI sources.

Below is the actual fpGUI directory hierarchy. 'lib' contains the compiled
units (*.ppu) for each target platform. Inside 'src' is the various units
split between two main directories: 'corelib' for the backend API code, and
'gui' for the higher level visual UI components. 'gui' and 'corelib'
contain common code. 'gdi' and 'x11' contain backend specific code.

With Lazarus I had to create two fpgui_toolkit.lpk packages, but in
different directories - depending on which platform you are working on.
Good news is that your application simply requires 'fpgui_toolkit.lpk',
irrespective of it's location, so switching between platforms doesn't break
the application compilation.

~/programming/fpgui/

   |-lib
   |---i386-linux
   |---i386-win32
   |---x86_64-linux
   |---arm-linux
   |-src
   |---corelib
   |-----gdi                  *--> fpgui_toolkit.lpk
   |-----x11                  *--> fpgui_toolkit.lpk
   |---gui
   |-----db


Here follows the extrafpc.cfg file content I pass to fpc when I compile
fpGUI from the command line (eg: fpc -dX11 @extrafpc.cfg). You will note
that there are multiple -Fu paths and multiple -Fi paths.

-------------------[ src/extrafpc.cfg ]-------------------------
#    * * *       I M P O R T A N T       * * *
# You need to specify which backend you are compiling for
#
# Your options are:
#  -dX11          for X11 support (eg: Linux, FreeBSD, Arm, MacOSX)
#  -dGDI          for Windows GDI support (including WinCE)
#

# Slashes are also allowed under Windows
# search path for include files
-Fi.
-Ficorelib
#IFDEF X11
  -Ficorelib/x11/
#ENDIF
#IFDEF GDI
  -Ficorelib/gdi/
#ENDIF


# search path for units and other system dependent things
-Fu.
-Fucorelib/
#IFDEF X11
  -Fucorelib/x11/
#ENDIF
#IFDEF GDI
  -Fucorelib/gdi/
#ENDIF
-Fugui/
-Fugui/db/


# Unit output path
-FU../lib/$fpctarget/
---------------------------------------------


I can't see your idea working for compiling a fpGUI based application
directly from source. But I can see your idea work for projects using the
pre-compiled fpGUI units ('lib' directory with *.ppu files), because the
latter is only one path. Whereas the sources are multiple source paths and
multiple include paths. Am I correct?

I can only use:  -Fl=FPGUI:~/programming/fpgui/lib/i386-linux

but can't use -Fu or -Fi:  -Fu=FPGUI:~/programming/fpgui/src
because the latter doesn't include all the unit and include paths required
for fpGUI.


The above is obviously possible with Lazarus Packages, because I can
specify multiple search paths in the *.lpk compiler configuration dialog.


Regards,
  - Graeme -

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




More information about the fpc-devel mailing list