Difference between revisions of "Compiler options file"
m (Added category.) |
m (XML branch merged.) |
||
Line 1: | Line 1: | ||
[[Category:Code::Blocks Documentation]] | [[Category:Code::Blocks Documentation]] | ||
[[Category:Developer Documentation]] | [[Category:Developer Documentation]] | ||
− | + | Format for storing compiler options in editable XML. | |
− | |||
− | |||
− | |||
Line 208: | Line 205: | ||
The contents is the regex (use of a <tt>CDATA</tt> section is not required). | The contents is the regex (use of a <tt>CDATA</tt> section is not required). | ||
+ | |||
+ | ==See also== | ||
+ | * [[Compiler file]] | ||
+ | * [/index.php/topic,16463.0.html XML based compilers] |
Revision as of 15:47, 19 December 2012
Format for storing compiler options in editable XML.
<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>". <os> is one of:
- windows
- macosx
- linux
- freebsd
- netbsd
- openbsd
- darwin
- solaris
- unix
<if exec="bison -h">
[...]
</if>
True if the the command exec can be run.
<if exec="C -dumpversion"
regex="^4\.[3-9]|^[5-9]\.[0-9]"
default="true">
[...]
</if>
If the text before the first space in exec is one of:
- C
- CPP
- LD
- LIB
- WINDRES
- MAKE
it will be replaced with the name of the corresponding executable.
True if regex matches the command's output (in this case, version number >= 4.3.0).
default is used if the command fails to execute (optional).
<Program name="C" value="mingw32-gcc.exe"/>
Give the name of an executable
name="<prog>". <prog> is one of:
- C
- CPP
- LD
- 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
<Command name="CompileObject"
value="bison -v -d $file -o $file_dir/$file_name.parser.cc"
ext="y"
gen="$file_dir/$file_name.parser.cc;$file_dir/$file_name.parser.hh"/>
Additional commands can be added to each category with a file extension filter.
ext="<exts>". <exts> is a semicolon separated list of file extensions (without the leading "." period).
gen="<files>". <files> is a semicolon separated list of generated files to be further processed (optional).
<RegEx name="Info line"
type="info"
msg="1;2;4"
file="2"
line="3">
<![CDATA[(In file) ([][{}() \t#%$~[:alnum:]&_:+/\.-]+):([0-9]+)(\.[0-9]+.*:)*]]>
</RegEx>
Definitions for regular expressions to parse compiler output.
name="<label>". <label> is the name this regex will be listed as.
type="<tp>". <tp> is one of
- normal
- warning
- error
- info
msg="<nums>". <nums> is a semicolon separated list of indices (minimum one, maximum three) for the locations of messages within the regex.
file="<num>". <num> is the index of the regex which gives the relevant file (optional).
line="<num>". <num> is the index of the regex which gives the relevant line number (optional).
The contents is the regex (use of a CDATA section is not required).
See also
- Compiler file
- [/index.php/topic,16463.0.html XML based compilers]