root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.65k stars 1.26k forks source link

[cmake] Glob when copying headers and tutorials #14953

Open vgvassilev opened 6 months ago

vgvassilev commented 6 months ago

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

ferdymercury commented 6 months ago

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

dpiparo commented 6 months ago

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

dpiparo commented 6 months ago

@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?

vgvassilev commented 6 months ago

@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.

amadio commented 6 months ago

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.

ferdymercury commented 6 months ago

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

dpiparo commented 1 month ago

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.

vgvassilev commented 1 month ago

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.

guitargeek commented 1 day ago

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?