root icon indicating copy to clipboard operation
root copied to clipboard

[cmake] Glob when copying headers and tutorials

Open vgvassilev opened this issue 1 year ago • 9 comments

Explain what you would like to see improved and how.

We can copy all the tutorials and header files at once. We do not need to do these operations individually causing things like:

[ 45%] Copying /Users/sftnight/vvassilev/root-src/tutorials/proof/ProofSimple.h
[ 45%] Copying /Users/sftnight/vvassilev/root-src/tutorials/proof/ProofSimpleFile.C
[ 45%] Copying /Users/sftnight/vvassilev/root-src/tutorials/proof/ProofSimpleFile.h
[ 45%] Copying /Users/sftnight/vvassilev/root-src/tutorials/proof/ProofStdVect.C

When using the Makefile Generator that's quite slow for no good reason...

ROOT version

master

Installation method

N/A

Operating system

N/A

Additional context

No response

vgvassilev avatar Mar 13 '24 10:03 vgvassilev

One question, why copying and not just sym-linking? (At least for the build step, later install can do the copy)

ferdymercury avatar Mar 14 '24 08:03 ferdymercury

suppose we do not install and delete the src dir...

dpiparo avatar Mar 14 '24 12:03 dpiparo

@vgvassilev I have a doubt here. We can certainly copy individual directories and reduce the churn, but then how can we express that if a certain file, e.g. a tutorial, is modified it then needs to be recopied?

dpiparo avatar Mar 14 '24 13:03 dpiparo

@vgvassilev I have a doubt here. We can certainly copy individual directories and reduce the churn, but then how can we express that if a certain file, e.g. a tutorial, is modified it then needs to be recopied?

We can make a cmake target depend on multiple files. Then if one gets invalidated the target gets re-run. To avoid copying everything iirc cmake had some copy-if-different functionality.

vgvassilev avatar Mar 14 '24 16:03 vgvassilev

My suggestion is to first look into solutions which do not require copying anything. For example, you could run the tutorial located in the source directory, but with a working directory in the build directory and a full path. If that doesn't work, the whole directory could be copied in one go with file(COPY ...) or with execute_process() and calling cmake -E copy_directory. The other solution which may also work well is to turn it into a full subproject and just use add_directory(tutorials). I worked a bit on this in the past and it was not that difficult to make it work.

amadio avatar Mar 15 '24 15:03 amadio

When using the Makefile Generator that's quite slow for no good reason...

Maybe related: https://github.com/root-project/root/issues/6432 https://github.com/root-project/root/issues/6432#issuecomment-2009372525

ferdymercury avatar Mar 15 '24 19:03 ferdymercury

I'd like to take a step back here. What does "slow" mean in this context? On a machine with a SSD it's not slow, but maybe it's just my perception.

dpiparo avatar Aug 22 '24 04:08 dpiparo

It may not seem slow but could be done easily faster. Treating every single header separate has also impact on configure time I bet.

we should not copy the header files but that’s a whole different story.

vgvassilev avatar Aug 22 '24 05:08 vgvassilev

Is it really necessary to keep this possibility to abuse the root build directory as your working ROOT installation?

If we relax this requirement, then many things would be much easier. We wouldn't have to copy or link the header files at all.

Maybe something for ROOT 7?

guitargeek avatar Oct 04 '24 10:10 guitargeek