Skip to content

Setting IL2CPP Flags via Agent Config

When testing on a standalone IL2CPP-built project, it is sometimes necessary to set certain flags, such as compiler or linker flag values, at the time of build, such as when working with OVR or other tools and/or platforms. While build flags normally have to be injected via writing your own custom scripts, GameDriver provides a means of automatically injecting any flags that you include in the GameDriver agent configuration file.

To have a flag automatically injected by the GameDriver agent, it must first be included in the build flags section of the GameDriver agent configuration file.

<buildflags>
<flag name=""/>
</buildflags>

The section of the configuration file, and its contents, should by default look like the above example. The item is an empty flag tag and will therefore not add a flag to be injected, but it can be used as an example of the formatting that new flags should be added.

For example, if we wanted to add a flag for “—emit-source-mapping” we would add it as . If a flag has an associated value, this too can be set in the same section of the configuration file using a slightly different formatting. If, for instance, we wanted to add the compiler flag (i.e. “—compiler-flags”) value of “-DTEST”, we would format it as such “-DTEST” which would inject the flag —compiler-flags=“-DTEST”, with the value to be set listed between the flag headers (Note the usage of to insert quotation marks into the final injected flag).

Altogether, if we wanted to inject all of the above flag examples we would list them one after the other, and so the section of the configuration file might look like the following:

<buildflags>
<flag name=""/><flag name="--emit-source-mapping"/><flag name="--compiler-flags">&quot;-DTEST&quot;</flag>
</buildflags>