Merge sections for passing options to Clang
This commit is contained in:
parent
f0870d3a54
commit
ea924b7a3f
25
README.md
25
README.md
|
@ -110,19 +110,6 @@ Note that the header included at the bottom must be generated by invoking the co
|
|||
reflective_rapidjson_generator --input-file "$srcdir/code-defining-structs.cpp" --output-file "$builddir/reflection/code-defining-structs.h"
|
||||
```
|
||||
|
||||
#### Passing further options to Clang
|
||||
To pass further options to Clang, just add `--clang-opt` to the arguments, eg. `--clang-opt -DSOME_DEFINE -DANOTHER_DEFINE`.
|
||||
It is possible to pass anything from `clang --help`, including the `-X...` options.
|
||||
|
||||
---
|
||||
|
||||
In case you get a massive number of errors, ensure Clang's resource directory can be located.
|
||||
[Clang documentation](https://clang.llvm.org/docs/LibTooling.html#libtooling-builtin-includes):
|
||||
|
||||
> The default location to look for builtin headers is in a path `$(dirname /path/to/tool)/../lib/clang/3.3/include` relative to the tool binary.
|
||||
|
||||
To adjust the default location, just add eg. `--clang-opt -resource-dir /usr/lib/clang/5.0.1` to the arguments.
|
||||
|
||||
#### Invoking code generator with CMake macro
|
||||
It is possible to use the provided CMake macro to automate the code generator invocation:
|
||||
```
|
||||
|
@ -162,6 +149,18 @@ For an explanation of the `CLANG_OPTIONS_FROM_TARGETS` argument, read the next s
|
|||
It is possible to pass additional options to the Clang tool invocation used by the code generator.
|
||||
This can be done using the `--clang-opt` argument or the `CLANG_OPTIONS` argument when using the CMake macro.
|
||||
|
||||
For example, additional definitions could be added using `--clang-opt -DSOME_DEFINE -DANOTHER_DEFINE`.
|
||||
But it is actually possible to pass anything from `clang --help`, including the `-X...` options.
|
||||
|
||||
##### Specifying Clang's resource directory
|
||||
In case you get a massive number of errors, ensure Clang's resource directory can be located.
|
||||
[Clang documentation](https://clang.llvm.org/docs/LibTooling.html#libtooling-builtin-includes):
|
||||
|
||||
> The default location to look for builtin headers is in a path `$(dirname /path/to/tool)/../lib/clang/3.3/include` relative to the tool binary.
|
||||
|
||||
To adjust the default location, just add eg. `--clang-opt -resource-dir /usr/lib/clang/5.0.1` to the arguments.
|
||||
|
||||
##### Pass options from regular targets
|
||||
It makes most sense to specify the same options for the code generator as during the actual compilation. This way the code
|
||||
generator uses the same flags, defines and include directories as the compiler and hence behaves like the compiler.
|
||||
When using the CMake macro, it is possible to automatically pass all compile flags, compile definitions and include directories
|
||||
|
|
Loading…
Reference in New Issue