Giter VIP home page Giter VIP logo

Comments (10)

TheLartians avatar TheLartians commented on July 28, 2024 1

Yeah I was thinking about something like that, though there could be issues with the Path's name and length if simply appended. Perhaps .cache/CPM/{lowercase name}/{SHA1 Hash of all origin parameters} would work.

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024 1

Awesome, thanks!
I've also been testing this for the last days and it works quite well. Some small issues occurred when updating dependencies or clearing the cache, but those should be resolved by now.
I agree, we should rename the var to CPM_SOURCE_CACHE.

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024

It should be possible to read in an environmental environment and set the value, if it exists. However I believe sharing downloads could easily break if different projects use different versions/sources of the same dependency.
We should investigate this first before endorsing a global download location. Perhaps it's possible to safely encode the version/source information in the download path?
Also note that only the download itself and not the build can be cached, as builds would break when different options or generators are used. For faster builds I recommend checking out caching compiler wrappers such as sccache.

from cpm.cmake.

aggsol avatar aggsol commented on July 28, 2024

I use ccache already. It is more about caching the downloads, the version should be in then path name then. If everything is found in the cache then no online connection would be required. I wonder if this is out of scope for CPM. So the cache contains all downloads like this named by CPM params already required?

.cache/CPM/{NAME}-{URL}-{VERSION}

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024

I've implemented the above suggestion here: CPM.cmake. CPM should now check for the environmental variable CPM_SOURCE_ROOT which should be set to the absolute path of the download directory.
@aggsol It would be great if you could check if that works for your projects and solves your use-case.

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024

So I just did a simple test and it seems that CMake actually removes the source directories before trying to repopulate them. That kinda makes the whole concept of caching downloads obsolete. I'll investigate if we can change this behaviour.

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024

I've updated the source to override the download step if the directory already exists: CPM.cmake. Could you check if it works for you now @aggsol ?

from cpm.cmake.

aggsol avatar aggsol commented on July 28, 2024

@TheLartians I will give it a go, please gimme some days. Currently busy T_T

from cpm.cmake.

TheLartians avatar TheLartians commented on July 28, 2024

Thanks! NP, I just want to make sure it’s battle tested before publishing as this seems to be a big feature.

from cpm.cmake.

aggsol avatar aggsol commented on July 28, 2024

I tested it in two different systems with environment variable and as command line parameter. Different builds and different versions of libraries. I used $HOME/.cache/CPM for both and checked creation of folders and files. This works really good! Maybe the var should be renamed CPM_SOURCE_CACHE then? I will check how it behaves in the following weeks.

from cpm.cmake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.