Conditional Compiler Options: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Conditional Compiler Options
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Overview | |
| 2 | + | ||
| 3 | + | Since Lazarus 0.9.29 you can define build modes and conditional compiler options. These options depend on current target OS, CPU, widgetset and project's build mode. | |
| 4 | + | ||
| 5 | + | For conditionals see here [[Macros and Conditionals]]. | |
| 6 | + | ||
| 7 | + | You can set the build macros for a package via [[IDE Window: Compiler Options|package editor / Compiler Options / Build Macros]]. | |
| 8 | + | ||
| 9 | + | You can set the build macros for a project via [[IDE Window: Compiler Options|Project / Project Options / Compiler Options / Build Macros]]. | |
| 10 | + | ||
| 11 | + | ## Target specific units - Doable via FPC directives, no Lazarus extras needed | |
| 12 | + | ||
| 13 | + | Concrete situation: LCL extensions package has a unit (OleUtils) that implements TOLEStream. It only makes sense in Windows. Currently the unit is added in all widgetsets but all code is wrapped around a ifdef Windows define so is seen as a dummy unit in other widgetsets. | |
| 14 | + | ||
| 15 | + | Notes: | |
| 16 | + | ||
| 17 | + | - All units should be added to the package, independent if they are used. If a unit should not always be compiled (not added to the uses section of the package), just unset the 'uses unit' checkbox and add for example {\$IFDEF win32}uses oleutils{\$ENDIF} to a package unit. | |
| 18 | + | - You can put units and include files specific to targets into sub directories as demonstrated in the Lazarus and FPC sources (units/\$(TargetOS)). | |
| 19 | + | - Since 0.9.31 multiple files with the same name can be added to packages. | |
| 20 | + | ||
| 21 | + | +=What will not be implemented== | |
| 22 | + | ||
| 23 | + | - A global Debug/Verbose buildmode. Almost no one wants to increase verbosity of all packages, nor debug all packages. But you can define one for your own packages. | |
| 24 | + | - Conditional units. This is already flexible doable via FPC directives and IDE macros. | |
| 25 | + | ||
| 26 | + | ## Future development / Wishes | |
| 27 | + | ||
| 28 | + | - Use a package only under one target, e.g. only under Windows and OS X, but not under Linux or BSD. | |
| 29 | + | ||
| 30 | + | --- | |
| 31 | + | *From the Free Pascal wiki, page "Conditional Compiler Options", as it stood on 2017-03-25 after a change by Arent, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 32 | + | Category: Conditionals |
