Update README.md
This commit is contained in:
parent
8587d62583
commit
1f571549e7
16
README.md
16
README.md
|
@ -110,6 +110,19 @@ 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:
|
||||
```
|
||||
|
@ -140,6 +153,9 @@ will always have the extension "`.h`", independently of the extension of the inp
|
|||
The full paths of the generated files are also appended to the variable `LIST_OF_GENERATED_HEADERS` which then can be added
|
||||
to the sources of your target. Of course this can be skipped if not required/wanted.
|
||||
|
||||
The macro will also automatically pass Clang's resource directory which is detected by invoking `clang -print-resource-dir`.
|
||||
To adjust that, just set the cache variable `REFLECTION_GENERATOR_CLANG_RESOURCE_DIR` before including the module.
|
||||
|
||||
For an explanation of the `CLANG_OPTIONS_FROM_TARGETS` argument, read the next section.
|
||||
|
||||
#### Passing Clang options
|
||||
|
|
Loading…
Reference in New Issue