-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more advanced cmake macro features to documentation #685
Add more advanced cmake macro features to documentation #685
Conversation
Add advance CMake usage for `PODIO_GENERATE_DATAMODEL`
doc/cmake.md
Outdated
|
||
```cmake | ||
# Generate the C++ code from the YAML definition with an upstream EDM, dependencies, version, output folder, and I/O handlers | ||
PODIO_GENERATE_DATAMODEL(newdm newdm.yaml headers sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit complains about the trailing whitespace here
PODIO_GENERATE_DATAMODEL(newdm newdm.yaml headers sources | |
PODIO_GENERATE_DATAMODEL(newdm newdm.yaml headers sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this. I have a few suggestions to further improve on this.
doc/cmake.md
Outdated
## More advanced data model generation | ||
PODIO provides additional options within the `PODIO_GENERATE_DATAMODEL` macro that allow developers to fine-tune how data models are generated and compiled: | ||
|
||
1. `UPSTREAM_EDM` - use an existing EDM an upstream dependency. This is useful when your data model extends or builds on top of another one, such as using EDM4hep in [EDM4eic](https://github.com/eic/EDM4eic/blob/7a627488cde0bc4e1863d3fd6bd3396fd30c7296/CMakeLists.txt#L44-L48). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. `UPSTREAM_EDM` - use an existing EDM an upstream dependency. This is useful when your data model extends or builds on top of another one, such as using EDM4hep in [EDM4eic](https://github.com/eic/EDM4eic/blob/7a627488cde0bc4e1863d3fd6bd3396fd30c7296/CMakeLists.txt#L44-L48). | |
1. `UPSTREAM_EDM` - use an existing EDM as an upstream dependency. This is useful when your data model extends or builds on top of another one, such as using EDM4hep in [EDM4eic](https://github.com/eic/EDM4eic/blob/7a627488cde0bc4e1863d3fd6bd3396fd30c7296/CMakeLists.txt#L44-L48). |
doc/cmake.md
Outdated
PODIO provides additional options within the `PODIO_GENERATE_DATAMODEL` macro that allow developers to fine-tune how data models are generated and compiled: | ||
|
||
1. `UPSTREAM_EDM` - use an existing EDM an upstream dependency. This is useful when your data model extends or builds on top of another one, such as using EDM4hep in [EDM4eic](https://github.com/eic/EDM4eic/blob/7a627488cde0bc4e1863d3fd6bd3396fd30c7296/CMakeLists.txt#L44-L48). | ||
2. `DEPENDS` - tells CMake that some files used to build the data model are not generated during the current build but are still required for compilation, like in [EDM4hep](https://github.com/key4hep/EDM4hep/blob/ac83112d66f7aa3b9d4eb5859c19b987feab3ce5/edm4hep/CMakeLists.txt#L6-L8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. `DEPENDS` - tells CMake that some files used to build the data model are not generated during the current build but are still required for compilation, like in [EDM4hep](https://github.com/key4hep/EDM4hep/blob/ac83112d66f7aa3b9d4eb5859c19b987feab3ce5/edm4hep/CMakeLists.txt#L6-L8) | |
2. `DEPENDS` - tells CMake that some files used to build the data model are not generated during the current build but are still required for compilation and should trigger a rebuild in case of changes, like in [EDM4hep](https://github.com/key4hep/EDM4hep/blob/ac83112d66f7aa3b9d4eb5859c19b987feab3ce5/edm4hep/CMakeLists.txt#L6-L8) |
doc/cmake.md
Outdated
|
||
1. `UPSTREAM_EDM` - use an existing EDM an upstream dependency. This is useful when your data model extends or builds on top of another one, such as using EDM4hep in [EDM4eic](https://github.com/eic/EDM4eic/blob/7a627488cde0bc4e1863d3fd6bd3396fd30c7296/CMakeLists.txt#L44-L48). | ||
2. `DEPENDS` - tells CMake that some files used to build the data model are not generated during the current build but are still required for compilation, like in [EDM4hep](https://github.com/key4hep/EDM4hep/blob/ac83112d66f7aa3b9d4eb5859c19b987feab3ce5/edm4hep/CMakeLists.txt#L6-L8) | ||
3. `VERSION` - specifies how to inject the version of the datamodel (it is separate from the schema version). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. `VERSION` - specifies how to inject the version of the datamodel (it is separate from the schema version). | |
3. `VERSION` - specifies the version of the datamodel (it is separate from the schema version). This will be injected into the metadata that is stored in files. |
doc/cmake.md
Outdated
# Generate the C++ code from the YAML definition with an upstream EDM, dependencies, version, output folder, and I/O handlers | ||
PODIO_GENERATE_DATAMODEL(newdm newdm.yaml headers sources | ||
UPSTREAM_EDM "EDM4hep:edm4hep" | ||
DEPENDS "external_file.yaml;another_dependency.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEPENDS "external_file.yaml;another_dependency.yaml" | |
DEPENDS "extra_header.h;more_extras.h" |
The main purpose here is to pass in additional c++ files which should become part of the compiled datamodel library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for clarifying!
doc/cmake.md
Outdated
|
||
# Compile the core data model shared library (no I/O) | ||
PODIO_ADD_DATAMODEL_CORE_LIB(newdm "${headers}" "${sources}") | ||
|
||
# Generate and compile the ROOT I/O dictionary for the default I/O system | ||
PODIO_ADD_ROOT_IO_DICT(newdmDict newdm "${headers}" src/selection.xml) | ||
|
||
# Compile the SIOBlocks shared library for the SIO backend | ||
PODIO_ADD_SIO_IO_BLOCKS(newdm "${headers}" "${sources}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Compile the core data model shared library (no I/O) | |
PODIO_ADD_DATAMODEL_CORE_LIB(newdm "${headers}" "${sources}") | |
# Generate and compile the ROOT I/O dictionary for the default I/O system | |
PODIO_ADD_ROOT_IO_DICT(newdmDict newdm "${headers}" src/selection.xml) | |
# Compile the SIOBlocks shared library for the SIO backend | |
PODIO_ADD_SIO_IO_BLOCKS(newdm "${headers}" "${sources}") |
Since these are unchanged wrt the basic examples above and these don't have too many customization points, we can simply remove them here to reduce the "noise" a bit.
Hi @tmadlener @m-fila, I noticed two checks are failing: pre-commit and sanitizers (gcc13, Address). I've reviewed the logs, but I'm unsure how to resolve the pylint & missing file issues. Will retrying the build solve this? Could you please provide some guidance on what might be going wrong here? |
The failing CI is unrelated to the changes you made. The sanitizer one wasn't able to download a test file. I am not yet sure what is wrong with pre-commit, but it has been failing for other PRs as well. I am investigating at the moment. |
If you rebase this onto the latest master branch, CI should fix itself |
BEGINRELEASENOTES
PODIO_GENERATE_DATAMODEL
to docsENDRELEASENOTES
Fixes #613