<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le mer. 3 oct. 2018 à 09:19, Jan Wielemaker <<a href="mailto:jan@swi-prolog.org">jan@swi-prolog.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Debugging dependencies is not always easy. The -graphviz option is a <br>
nice try, but only seems to do the built-in target types. Is there<br>
some way to get the whole dependency graph, including custom targets<br>
and possibly also the individual files? </blockquote><div><br></div><div>Not yet I guess:</div><div><br></div><div><a href="https://gitlab.kitware.com/cmake/cmake/issues/17960">https://gitlab.kitware.com/cmake/cmake/issues/17960</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Of course this can get huge.<br>
Possibly there is some way to concentrate on anything relevant to a<br>
particular target?<br></blockquote><div><br></div><div>Besides the custom target issue. I did craft a python script which loads the dependency graph spitted out by CMake</div><div>and do various thing on it:</div><div><br></div><div>- search if there exist a path between two targets</div><div>- find all path between two targets</div><div>- reduce the graph (transitive closure)</div><div>etc...</div><div> </div><div>If you use ninja Generator you may try the browse or graph </div><div>extra tool:</div><div><a href="https://ninja-build.org/manual.html">https://ninja-build.org/manual.html</a></div><div><br></div><div>This is generator specific and it may be difficult to follow your "original" CMake target in the generated ninja version.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The problem I'm faced with is this:<br>
<br>
- I have an ordinary executable target `swipl`<br>
- To run, this requires a boot file `swipl.prc` that is created<br>
by calling `swipl -b ...`<br></blockquote><div><br></div><div>Hum... I don't get it.</div><div>For running? creating? target "swipl" you need to run it? </div><div>There is a chicken & eggs problem or I misread what you said?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- I'd like to run `swipl` for creating a library index file.<br>
<br>
So, these targets need to be built in the order above. It turns<br>
out that sometimes step 3 runs before 2 completes. At least, this<br>
happens on MacOS using cmake 3.11.2. So far I haven't seen it on<br>
Linux (where I use 3.10). The definition goes like this:<br>
<br>
add_custom_command(<br>
OUTPUT swipl.prc<br>
COMMAND swipl -O -b ${SWIPL_BOOT_ROOT}/<a href="http://init.pl" rel="noreferrer" target="_blank">init.pl</a><br>
DEPENDS swipl ${SWIPL_BOOT_FILES}<br>
)<br>
<br>
add_custom_command(<br>
OUTPUT ${PL_LIB_INDEX}<br>
COMMAND swipl -f none -g <br>
"\"make_library_index('${SWIPL_LIBRARY_ROOT}')\"" -t halt<br>
DEPENDS swipl.prc ${PL_LIB_FILES_ALL}<br>
)<br>
<br>
add_custom_target(prolog_products ALL<br>
DEPENDS swipl.prc ${PL_LIB_INDEX}<br>
)<br>
<br>
The first specifies building swipl.prc, the second the index<br>
file and the custom target ensures the default build will<br>
create both files. I don't see what is wrong and a visual<br>
dependency graph might reveal this ...<br></blockquote><div><br></div><div>Are those three add_custom_xxx in the same directory?</div><div>DEPENDS for custom_xxx do not cross directory.</div><div><br></div><div>i.e:</div><div><div>``DEPENDS``</div><div> Reference files and outputs of custom commands created with</div><div> ``add_custom_command()`` command calls in the same directory</div><div> (``CMakeLists.txt`` file). They will be brought up to date when</div><div> the target is built.</div></div><div><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div></div></div></div></div>