2018-03-29 13:26:47 +02:00
|
|
|
# Dictionary Example
|
|
|
|
|
2018-05-02 10:48:50 +02:00
|
|
|
This is an example of building a module that includes a dictionary in CMake. Instead of using the
|
|
|
|
ROOT suggested flags, we will manually add threading via `find_package`, which is the only
|
|
|
|
important flag in the list on most systems.
|
2018-03-29 13:26:47 +02:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
## examples/root-dict/CMakeLists.txt
|
2022-06-02 14:30:14 -04:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
```{literalinclude} CMakeLists.txt
|
|
|
|
:start-after: "[main]"
|
|
|
|
:end-before: "[main]"
|
|
|
|
:language: cmake
|
|
|
|
```
|
2018-03-29 13:26:47 +02:00
|
|
|
|
|
|
|
## Supporting files
|
|
|
|
|
|
|
|
This is just a simple-as-possible class definition, with one method:
|
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
### examples/root-dict/DictExample.cxx
|
2022-06-02 14:30:14 -04:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
```{literalinclude} DictExample.cxx
|
|
|
|
:language: cpp
|
|
|
|
```
|
2018-03-29 13:26:47 +02:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
### examples/root-dict/DictExample.h
|
2022-06-02 14:30:14 -04:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
```{literalinclude} DictExample.h
|
|
|
|
:language: cpp
|
|
|
|
```
|
2018-03-29 13:26:47 +02:00
|
|
|
|
|
|
|
We need a `LinkDef.h`, as well.
|
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
### examples/root-dict/DictLinkDef.h
|
2022-06-02 14:30:14 -04:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
```{literalinclude} DictLinkDef.h
|
|
|
|
:language: cpp
|
|
|
|
```
|
2018-03-29 13:26:47 +02:00
|
|
|
|
|
|
|
## Testing it
|
|
|
|
|
|
|
|
This is an example of a macro that tests the correct generation from the files listed above.
|
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
### examples/root-dict/CheckLoad.C
|
2022-06-02 14:30:14 -04:00
|
|
|
|
2024-08-15 07:04:35 +00:00
|
|
|
```{literalinclude} CheckLoad.C
|
|
|
|
:language: cpp
|
|
|
|
```
|