Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: Fix and cleanup CDDL dependencies
The main problem was an extra, unnecessary CMake re-run that happened at the start of any build with CONFIG_SUIT_PROCESSOR=y. This had to do with tracking CDDL file changes to trigger regeneration of zcbor files, which was set up incorrectly. On the initial CMake run, this module would do the following: 1. Execute zcbor commands to generate some *.c, *.h, *.cmake files. 2. Include the generated *.cmake files. 3. Add custom commands and targets to regenerate the *.cmake files at build time, using the same commands from step 1. Then, Ninja would start with generating the files again. This is because whenever Ninja decides whether to run a command, it doesn't check if the output files already exist; it only checks if (and when) it has executed the command before. Here's the abridged output from `ninja -d explain`: ninja explain: command line not found in log for cose.cmake ninja explain: cose.cmake is dirty ninja explain: command line not found in log for manifest.cmake ninja explain: manifest.cmake is dirty [1/3] Generating cose.cmake [2/3] Generating manifest.cmake [2/3] Re-running CMake... In principle, we cannot set up these files to be generated at both configure time and build time. It only really makes sense to do it at configure time, because rewriting CMake sources forces a re-run anyway. Therefore, instead of using custom commands to track CDDL dependencies, use the CMAKE_CONFIGURE_DEPENDS directory property. While at it, refactor the module to move the zcbor generation code into a common function for the `cose` and `manifest` libraries. This reduces duplication and fixes another issue, where not all CDDL files were able to trigger regeneration (such as `cose_encrypt.cddl`). Signed-off-by: Grzegorz Swiderski <[email protected]>
- Loading branch information