Commit 6802f30
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]>1 parent c97fbb3 commit 6802f30
1 file changed
+43
-74
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 30 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
48 | 35 | | |
| 36 | + | |
49 | 37 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
55 | 41 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
76 | 51 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 52 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
97 | 66 | | |
98 | 67 | | |
99 | 68 | | |
| |||
0 commit comments