Compiler options file

From Code::Blocks
Revision as of 05:33, 22 June 2012 by Alpha (talk | contribs) (Created page with "Proposed format for storing compiler options in editable XML. See: [/index.php/topic,16463.0.html XML based compilers]. <source lang="xml" enclose="...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Proposed format for storing compiler options in editable XML. See: [/index.php/topic,16463.0.html XML based compilers].


<CodeBlocks_compiler_options extends="gcc">
[...]
</CodeBlocks_compiler_options>

I am a Code::Blocks compiler options file.

extends="<id>" (optional)

  • Load the corresponding options_<id>.xml file first (use if this compiler is almost the same, with only a few altered programs or added switches, for example).


<if platform="windows">
[...]
</if>
<else>
[...]
</else>

Standard if statement; contents of if block is evaluated if the if statement is true, otherwise the else block is evaluated (the else block is optional). Nesting is allowed.

platform="<os>" (platform is the only condition currently defined). <os> is one of:

  • windows
  • macosx
  • linux
  • freebsd
  • netbsd
  • openbsd
  • darwin
  • solaris
  • unix


<Program name="C" value="mingw32-gcc.exe"/>

Give the name of an executable

name="<prog>". <prog> is one of:

  • C
  • CPP
  • LD
  • DBG
  • DBGconfig
  • LIB
  • WINDRES
  • MAKE

value="<exec>" (actual name of the executable).


<Switch name="includeDirs" value="-I"/>

Switches controlling compiler constants.

name="<opt>". <opt> is one of:

  • includeDirs
  • libDirs
  • linkLibs
  • defines
  • genericSwitch
  • objectExtension
  • forceFwdSlashes. value is one of true or false
  • forceLinkerUseQuotes. value is one of true or false
  • forceCompilerUseQuotes. value is one of true or false
  • needDependencies. value is one of true or false
  • logging. value is one of:
    • default (same as full)
    • full
    • simple
    • none
  • libPrefix
  • libExtension
  • linkerNeedsLibPrefix. value is one of true or false
  • linkerNeedsLibExtension. value is one of true or false
  • supportsPCH. value is one of true or false
  • PCHExtension
  • UseFlatObjects. value is one of true or false
  • UseFullSourcePaths. value is one of true or false
  • Use83Paths. value is one of true or false


<Option name="Profile code when executed"
        option="-pg"
        additionalLibs="-pg -lgmon"
        category="Profiling"
        checkAgainst="-O -O1 -O2 -O3 -Os"
        checkMessage="You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."
        supersedes="-s"
        exclusive="true"/>

Definition of a compiler flag.

  • name. Human readable description of the flag.
  • option. Flags to be sent to the compiler (optional).
  • additionalLibs. Flags to be sent to the linker (optional).
  • category. The category this flag is in (optional; defaults to "General").
  • checkAgainst. Show a warning message if any of these flags are enabled (optional).
  • checkMessage. Warning message to show upon conflict (optional).
  • superseds. Automatically disable the list of superseded flags if this flag is enabled (optional).
  • exclusive. Disable all other flags in this category if this flag is enabled. Is one of true or false (optional).


<Category name="CPU architecture tuning"
          exclusive="true">
[...]
</Category>

name="<cat>". Any flags (<Option [...] />) contained in here that lack the category attribute will be treated as category <cat>.

exclusive. Is one of true or false. Any flags (<Option [...] />) contained in here that lack the exclusive attribute will be treated as this. (Optional.)


<Common name="optimization"/>

Load options from a common file.

name="<file>"

  • Loads options_common_<file>.xml (file syntax is exactly the same as this file).


<Command name="CompileObject"
         value="$compiler $options $includes -c $file -o $object"/>

Definitions for forming compiler commands

name="<cmd>". <cmd> is one of:

  • CompileObject
  • GenDependencies
  • CompileResource
  • LinkExe
  • LinkConsoleExe
  • LinkDynamic
  • LinkStatic
  • LinkNative