Difference between revisions of "IDE Window: Compiler Options"

From Free Pascal wiki
m (Ok)
m (Paths)
Line 10: Line 10:
 
* The FreePascal Compiler has a configuration file of its own (default /etc/fpc.cfg) which defines a set of search paths. For example to find the FPC units of the RTL or the FCL like 'classes', 'sysutils'.
 
* The FreePascal Compiler has a configuration file of its own (default /etc/fpc.cfg) which defines a set of search paths. For example to find the FPC units of the RTL or the FCL like 'classes', 'sysutils'.
 
* Search paths are separated by semicolon ';'.
 
* Search paths are separated by semicolon ';'.
* Heading and trailing spaces are ignored.
+
* Leading and trailing spaces are ignored.
 
* You can use macros. For example $(TargetCPU). See [[IDE Macros in paths and filenames]].
 
* You can use macros. For example $(TargetCPU). See [[IDE Macros in paths and filenames]].
  

Revision as of 21:49, 10 August 2008

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) русский (ru)

Paths

  • Relative paths are expanded with the project or package directory (where .lpi/.lpk file is).
  • These paths are added to the search paths.
  • There is no way to remove a path from the search paths
  • If a package or project uses a package, it will inherited the usage search paths. You can see the inherited search paths in the #Inherited page.
  • Using the Lazarus package system, you hardly need to set search paths manually.
  • The FreePascal Compiler has a configuration file of its own (default /etc/fpc.cfg) which defines a set of search paths. For example to find the FPC units of the RTL or the FCL like 'classes', 'sysutils'.
  • Search paths are separated by semicolon ';'.
  • Leading and trailing spaces are ignored.
  • You can use macros. For example $(TargetCPU). See IDE Macros in paths and filenames.

Other Unit Files

This is the search path for the pascal units (.ppu, .pp, .pas, .p) of the project or package. See the title of the window to know which. This path is given to the FreePascal Compiler, which adds it to its Unit Path.

  • Adding and removing units to the project/package will automatically adjust the unit path.
  • BEWARE: if a package uses a separate output directory for its .ppu files, do not add the source directories to this path. Otherwise FPC will rebuild the .ppu of the package and put them into your project directory. You will end up with multiple .ppu versions and you will get strange 'Can not find unit' errors.

For example: Do not add any FPC or Lazarus source (.pas or .pp) directory to this search path.

Include Files

This is the search path for the include files (e.g. .inc, .lrs files). This path is given to the FreePascal Compiler, which adds it to its Include Path, which is used by include directives like {$I filename.inc} or {$INCLUDE filename.inc}.

Other sources

This is the search path for pascal unit sources, that is only used by the IDE and not by the compiler.

Example: You have a directory with sources and a directory with the corresponding .ppu files. You add the .ppu directory to the 'Other Unit Files' path and the .pas directory to the 'Other sources' path. This way the compiler will use the .ppu files and not try to rebuild them everytime. And the IDE will find the sources and Find Declaration works.

Libraries

This is the search path for libraries (.dll or .so or .a files).

Unit output directory

This is directory, where the compiler will put all output, like .ppu, .o, .rst files.

Note: Packages normally inherited their output directory via the 'usage' options.

Debugger path addition

These directories are added to the search path of the IDE debugger, when it searches for sources (units and include files).

LCL widget type

This is the used LCL widget set. Normally the default widget set is used. If you want to try another or you are cross compiling, set here another widget set.

  • The default widget set of a package is the widget set of the current project.
  • The default widget set of the current project depends on the current operating system. For example: win32 for windows 2000.
  • You should not set the widget set for a package, because then the project can not override it. Only set it, if the package is part of a set of packages - one for each widget set.

Parsing

See Free Pascal - Online documentation

Style

  • -R<x> assembler reading style:
  • -Rdefault use default assembler
  • -Ratt read AT&T style assembler
  • -Rintel read Intel style assembler

Syntax Options

  • Delphi 2 Extensions
  • C Style Operators (*=, +=, /= and -=)
  • Include Assertion Code
  • Allow LABEL and GOTO
  • C++ Styled INLINE
  • C Style Macros (global)
  • TP/BP 7.0 Compatible
  • Constructor name must be init (destructor must be done)
  • Static Keyword in Objects
  • Delphi Compatible
  • Use Ansi Strings
  • GPC (GNU Pascal Compiler) Compatible

Code

See Free Pascal - Online documentation

Linking

See Free Pascal - Online documentation

Messages

See Free Pascal - Online documentation

Other

See Free Pascal - Online documentation

Inherited

This page shows all the compiler options inherited from packages. Packages inherit options via their 'usage' options.

The topmost node shows all inherited options, that is the sum of all used packages.

The nodes below show the inherited options of each use package.

Compilation

Create Makefile

Enable this, if the IDE should create a Makefile and a Makefile.fpc before each build. This is currently only supported for packages, not for projects.

Execute before

Setup here a command to execute before running the compiler.

Call on:

  • Compile - execute when normally compiling (F9).
  • Build - execute when rebuilding all. This could for example a script to clean up.
  • Run - execute when quick compiling. When running a project, the IDE checks if rebuild is needed. If no rebuild is needed the IDE skips the compile step. Set this option to always execute the command, even if the compile step is skipped.

The IDE can parse and filter the output of the command and stop on errors. Check the boxes for which messages the IDE should watch.

Compiler

This is compiler path used by the project or package. Default is the macro $(CompPath), which is replaced with the compiler filename in the environment options.

Execute after

Setup here a command to execute after running the compiler. See above 'Execute before' for details.

Buttons

Test

This will run various test and detects common configurations mistakes. For fpc 2.2.0 it will warn about some double units. The warnings are correct, but you can ignore them, if you don't use these units.

Show Options

Opens a dialog and presents the current command line parameters.

Load/Save

Opens a dialog to save and/or load the current compiler options from/to a xml file.

Ok

This will apply the changes and then exit the dialog.

Cancel

This will undo all changes and exits the dialog.