[fpc-devel] RTTI unit

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Aug 30 10:15:15 CEST 2010


Op 2010-08-30 09:45, Sven Barth het geskryf:
> LPI files are already included with FPC. E.g. for the compiler itself 
> (so you don't need to add all search paths manually...) and for the 
> Win32 RTL (excluding the system unit).

FPC has support for external config files which could handle this for you.
In the fpGUI project I have many such config files called "extrafpc.cfg".
Each line of that config file is a compiler parameter, you can use IFDEF
functionality and even FPC's macros. See the example below.

This is a more advanced example than usual, but it shows IFDEF usage and
FPC macros like $fpctarget.

To use this from the command line:
   fpc -dX11 @extrafpc.cfg <program_unit.pas>

-----------------------------
#    * * *       I M P O R T A N T       * * *
# You need to specify which backend you are compiling for. This
# will be the only extra compiler parameter you use.
#
# Your options are:
#  -dX11             for X11 support (eg: Linux or FreeBSD)
#  -dGDI             for Windows GDI support
#  -dCarbon          for Mac OS X Carbon support.

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


# searchpath for units and other system dependent things
-Fu.
-Fucorelib/
#IFDEF X11
  #WRITE Compiling X11 CoreLib
  -Fucorelib/x11/
#ENDIF
#IFDEF GDI
  #WRITE Compiling GDI CoreLib
  -Fucorelib/gdi/
#ENDIF
#IFDEF Carbon
  #WRITE Compiling Carbon CoreLib
  -Fucorelib/carbon/
#ENDIF
-Fugui/
-Fugui/db/


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


So again, no need to include some IDE specific files, not related to the
FPC project or sources. Otherwise we can start adding FP (text) IDE,
MSEide, fpGUI IDE, Syn Editor project files etc.... Where does it end?

In addition to such external config files, FPC also includes the
fpcmake.pas functionality. This again allows it to setup search paths etc.
for a project, even the compiler itself.


BTW:
Lazarus IDE can read such external config files too, so again it is very
easy to setup a Lazarus project using a program unit, and simply telling it
to read the extrafpc.cfg file for search path information. With MSEide you
can do the same.



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