Skip to content

Compiler Options Mapping

tajmone edited this page Dec 25, 2017 · 6 revisions
PureBASIC v5.61

This reference page documents how each of the PureBASIC IDE compiler settings for a source file are stored in the file's configuration as preference keys (ie: <KEY> = <VALUE> pairs, or just simple <KEY> entries).


Table of Contents


Introduction

PureBASIC IDE saves the compiler settings for each source file as <KEY> = <VALUE> pairs, or simple <KEY> entries. Depending on the IDE preferences for "Editor » Save Settings to:", these options will be stored in either:

  • The end of the source file — as a comments block.
  • __The <filename>.pb.cfg file __ — each source file has its own preference file.
  • A common file project.cfg for every directory — a preference file divided into groups/sections, one for each source file in the folder

For more info, see the Wiki page dedicated to these IDE settings:

Regardless of where the settings are stored, the keys/values used for mapping the IDE source setttings to file are exactly the same.

IDE Compiler Options

The Compiler Options dialog can be accessed from PureBASIC IDE's menu "Compiler » Compiler Options...". The dialog has 5 tabs, and we'll examine how the options of each tab are mapped to file settings.

PureBASIC IDE Compiler Options

NOTE — The following screenshots and settings refer to non-project files. Project source files will show a slightly different Compiler Options dialog.

For example, the Compiler Options dialog for a project file will show some settings not available for non-project files:

PureBASIC IDE Compiler Options for project-file

... namely: "Input source file:" and "Output executable:" settings are only available for project files, whereas non-project files will display the "Main source file:" setting instead.

From PureBASIC Documentation:

The right side of the compiler options is almost the same as in the non-project mode and reflects the settings for the compile target that is currently selected on the left. The only difference are the "Input source file" and "Output executable" fields on the first tab. These fields have to be specified for all compile targets. Other than that, the compiler options are identical to the options described above.

In project mode, the information about the compile target is stored in the project file and not in the individual source files. Information that belongs to the file (such as the folding state) are still saved for the individual source files in the location specified by the Preferences.

For more details on the various compiler options, see:

1. Compiler Options

PureBASIC IDE Compiler Options

  • "Main source file :" » UseMainFile = <file.pb>
  • "Use Compiler:" » Compiler = PureBasic 5.61 (Windows - x86)
  • "Use Icon:" » UseIcon = <file.ico>
  • "Enable inline ASM support :" » EnableAsm (false if absent)
  • "Create thread-safe executable:" » EnableThread (false if absent)
  • "Enable modern theme support :" » EnableXP (false if absent)
  • "Request Administrator mode for Windows Vista and above:" » EnableAdmin (false if absent)
  • "Request User mode for Windows Vista and above :" » EnableUser (false if absent)
  • "Enable OnError lines support:" » EnableOnError (false if absent)
  • "Library Subsystem:" » SubSystem = SubSys1 SubSys2 (one or more subsystem, space separated)
  • "Executable format:" » ExecutableFormat = <format>; one of:
    • "Windows" » absent key (default) ExecutableFormat
    • "Console" » ExecutableFormat = Console
    • "Shared DLL" » ExecutableFormat = Shared dll
  • "Cpu Optimisation:" » CPU = <num>; one of:
    • "All CPU:" » absent key (default) CPU
    • "Dynamic CPU" » CPU = 1
    • "CPU with MMX" » CPU = 2
    • "CPU with 3DNOW" » CPU = 3
    • "CPU with SSE" » CPU = 4
    • "CPU with SSE2" » CPU = 5
  • "Linker options file:" » LinkerOptions = <file>

2. Compile/Run Options

PureBASIC IDE Compile/Run Options

  • "Enable Debugger:" » absent key (default) or DisableDebugger
  • "Enable Purifier:" » EnablePurifier (false if absent)
  • "Use selected Debugger:" » Debugger = <debugger>; one of:
    • "Integrated IDE Debugger" » Debugger = IDE
    • "Standalone GUI Debugger" » Debugger = Standalone
    • "Console only Debugger" » Debugger = Console
  • "Use Warning mode:" » Warnings = <mode>; one of:
    • "Ignore Warnings" » Warnings = Ignore
    • "Display Warnings" » Warnings = Display
    • "Treat Warnings as Errors" » Warnings = Error
  • "Executable command-line:" » CommandLine = <args string>
  • "Current directory:" » CurrentDirectory = ..\some\relative\path\
  • "Create temporary executable in the source directory:" » CompileSourceDirectory
  • "Execute tools:" » EnabledTools = <tools list> — where <tools list> is a comma-separated list of external IDE tools identifiers (Eg: EnabledTools = SOME_IDE_TOOL,ANOTHER_IDE_TOOL. Identifiers are generated by PB IDE transforming the tool's name to uppercase, replacing spaces with underscores, and using letters and numbers only (eg: "Some IDE Tool" becomes SOME_IDE_TOOL).

... to be continued ...

3. Compiler Constants Options

PureBASIC IDE Compiler Constants Options

  • "#PB_Editor_CompileCount:" » EnableCompileCount = <number>
  • "#PB_Editor_BuildCount:" » EnableBuildCount = <number>
  • "#PB_Editor_CreateExecutable" » EnableExeConstant
  • "Custom constants:" » multiple Constant = <definition> entries (one for each constant definition)

NOTE — Because "Custom constants:" supports environment variables through Bash-like syntax (eg: $ENV_VAR), the dollar syntax for string constants can't be used here (eg: #MyStr$ = "text" will not work).

CUSTOM CONSTANTS EXAMPLE

  Constant = #TEXT = "a text constant"
  Constant = #NUMERIC = 4
  Constant = #EnvVar_Constant="Username is $USERNAME"
  Constant = #TITLE="This Is A Title"
  Constant = #MoreText = "hello"

In the #EnvVar_Constant from the above example, $USERNAME in "Username is $USERNAME" will be expanded to a string with the actual value of USERNAME env var because of the Bash-like dollar syntax (eg: "Username is John Doe").

4. Version Information Options

For the sake of clarity, here is a vertically-stretched composite screenshot of the "Version Info" tab in order to show all it's fields at once (in the IDE you'll have to scroll down to see all fields):

PureBASIC IDE Version Information Options

For more information on using Version Information, see the dedicated Wiki page:

The settings of the above IDE screenshot translate to the following settings in the configuration file:

  IncludeVersionInfo
  VersionField0 = 1.2.3.4
  VersionField1 = 4.3.2.1
  VersionField2 = My Company
  VersionField3 = My Super Product
  VersionField4 = v1
  VersionField5 = v1.0.1
  VersionField6 = Super Product EXE
  VersionField7 = SuperProduct
  VersionField8 = SuperProduct.exe
  VersionField9 = (c) Tristano Ajmone
  VersionField10 = Trademark
  VersionField11 = Developers Test Pre-Release
  VersionField12 = Test all Bug Fixes before release
  VersionField13 = mymail@super.com
  VersionField14 = http://www.super-product.com
  VersionField15 = VOS_NT_WINDOWS32
  VersionField16 = VFT_APP
  VersionField17 = 0809 English (United Kingdom)
  VersionField18 = CustomField1
  VersionField19 = CustomField2
  VersionField20 = CustomField3
  VersionField21 = Custom field 1 value
  VersionField22 = Custom field 2 value
  VersionField23 = Custom field 3 value

As the above example shows, all fields are sequentially mapped to VersionField[n], where n is a number ranging from 0 to 23; the fields numbering doesn't always mirror their appearance order in the user interface (only the first 15 do). Unused/empty fields will be omitted from the configuration.

The following table show how the Version fields in the IDE are mapped to saved-settings keys:

VERSION FIELD SETTINGS KEY
File Version (ח,ח,ח,ח)*: VersionField0
Product Version (ח,ח,ח,ח)*: VersionField1
Company Name*: VersionField2
Product Name*: VersionField3
Product Version*: VersionField4
File Version*: VersionField5
File Description*: VersionField6
Internal Name*: VersionField7
Original File Name*: VersionField8
Legal Copyright: VersionField9
Legal Trademarks: VersionField10
Private Build: VersionField11
Special Build: VersionField12
Email: VersionField13
Website: VersionField14
Custom Field 1 (Key & Val) VersionField18 & VersionField21
Custom Field 2 (Key & Val) VersionField19 & VersionField22
Custom Field 3 (Key & Val) VersionField20 & VersionField23
File OS: VersionField15
File Type: VersionField16
Language: VersionField17

... to be continued ...

5. Compiler Resources Options

PureBASIC IDE Compiler Resources Options

... to be continued ...

Related Wiki Pages

External Links

PureBASIC Documentation: