Build Configurations Overview
Go Up to Compiling, Building, and Running Applications Index
Build configurations consist of options that you can set on all the build-related pages of the Project > Options dialog box. Build configurations are saved in the project file (such as .dproj
or .cbproj
).
Contents
Each Project Contains Three Default Build Configurations
The Projects Window contains a Build Configurations node that lists the available build configurations:
Base, Debug, and Release are the three default build configurations. In the Project Manager, the Build Configurations node itself represents the Base configuration, but the Debug and Release configurations are listed in separate nodes.
You can change option values in any configuration, including Base. You can delete the Debug and Release configurations, but you cannot delete the Base configuration.
When you compile and save a project, the files are saved in a directory whose name matches the name of the current build configuration. Debug and Release directories exist by default, and a directory is created for any active custom build configuration when you save a project.
Base Configuration
The Base configuration acts as a default set of option values that is used in all the configurations you subsequently create. The option values mentioned, are the compiling and linking and other set of options you can alter for your project using the Project Options dialog (Project > Options).
You can change the option values in any configuration, including Base. You can delete the Debug and Release configurations, but you cannot delete the Base configuration.
Debug Configuration
The Debug configuration extends Base by disabling optimization and enabling debugging, as well as setting specific syntax options.
The default build configuration Debug, that is located in the Project Manager for your Delphi project, is created by Delphi after you created a new application/project.
- Note: It is advisable to use Debug configuration while you are developing, debugging and changing your application.
Release Configuration
The Release configuration extends Base to not produce symbolic debugging information, as well as the code is not generated for TRACE and ASSERT calls, meaning the size of your executable is reduced.
The default build configuration Release, that is located in the Project Manager for your Delphi project, is created by Delphi after you created a new application/project.
- Note: It is advisable to use the Release configuration when you are building your application for release. The produced executable file does not have debug information, and is smaller in size and faster than an application built with the Debug configuration.
Setting Specific Compiler Options
On the Project > Options > Delphi Compiler > Compiling page, you can set the following specific options that pertain to build configurations:
Specific Options |
Code generation |
Debugging | ||
Optimization |
Stack Frames |
Debug Information |
Local symbols | |
Debug configuration |
OFF The compiler does NOT perform a number of code optimizations. |
ON Stack frames are always generated for procedures and functions. |
ON When a program or unit is compiled with this option enabled, the integrated debugger lets you single-step and set breakpoints. |
ON When a program or unit is compiled with this option enabled, the integrated debugger lets you examine and modify the module local variables. |
Release configuration |
ON The compiler performs a number of code optimizations. |
OFF Stack frames are NOT generated for procedures and functions. |
OFF When a program or unit is compiled with this option enabled, the integrated debugger does NOT let you single-step and set breakpoints. |
OFF When a program or unit is compiled with this option enabled, the integrated debugger does NOT let you examine and modify the module local variables. |
You Specify the Active Configuration for Your Projects
Every project has an active build configuration associated with it, as well as any number of other inactive build configurations that you have created. The name of the active build configuration is displayed in parentheses at the top of the Build Configurations node in the Projects Window, and the active configuration is also displayed in boldface in the list of available configurations in that node. The Compile , Build, and Clean commands use the active build configuration for the project.
To activate a configuration, do either:
- Double-click the configuration in the Project Manager.
- Right-click the configuration and select Activate from the context menu.
For more information, see Activating a Build Configuration for a Project.
Build Configurations Inherit Values from Parent
Each configuration, except Base, is based on another configuration from which it inherits its values. The Debug and Release configurations inherit their values from Base.
Using the Configuration Manager, you can, in turn, create a new configuration based on any given configuration, and the new configuration inherits its option values from its parent. After creating a configuration, you can change its option values to whatever you want, and you can make it the active configuration for a project or projects. You can also delete any configuration except Base.
Unless their values are changed, options inherit the values of their parent configuration. This inheritance is not static: if the parent configuration changes, so do inherited values for all its children.
The default value of an option is its value in the parent configuration. You can revert an option to its default value by clearing the value in the Project Options dialog box.
Comparing Configurations and Option Sets
You can save the option values of a configuration to a file as a named option set (an.optset file). You can apply an option set to any configuration in any project. You also have the choice to apply an option set by value (applying the option set values at that one time only) or by reference (so that subsequent changes to the option set are reflected in the configuration) or by value.
Note that a build configuration is different from an option set, although they are related. Both consist of sets of option values. The main distinction is that configurations are associated with projects, whereas option sets are saved in files independent of projects. Build configuration values are stored in the project file, so saving a project saves changes to its build configurations, but option sets are unaffected. Changing a project's configurations and adding or deleting configurations does not affect option sets. Similarly, saving option sets does not change build configurations.
Each project has its own list of configurations, independent of other projects. However, you can apply any option set to any project. On the Project Options dialog box, the Build Configuration drop-down list includes all the build configurations for that project - but does not include option sets. The Project Manager, on the other hand, lists both configurations and referenced option sets under the Build configurations node.
Values in Configurations and Option Sets
Note that configurations and option sets might not contain values for all possible project options - they contain only the options that are different from the parent configuration. The Base configuration also does not contain values for all possible options.
If an option value is not in a configuration, the IDE looks in its parent configuration, then the parent's parent configuration, and so on. If not found in any of the configurations in the inheritance chain, the value comes from the appropriate tool that is being configured.
For instance, if a configuration inheritance chain does not include a value for a particular compiler option, the default value is specified by the compiler itself. When you save a configuration or option set, only its values are saved - not values for every option.