Git Product home page Git Product logo

Comments (3)

memsharded avatar memsharded commented on August 17, 2024

Hi @s-mlr

Thanks for your question.

Have you considered using the cppinfo.resdirs definition? (https://docs.conan.io/2/reference/conanfile/methods/package_info.html). This would be intended for directories containing resource files for consumers.

Then, the only issue is that there is no standard way to use these files in the consumers. CMakeToolchain will have the <pkgname>_RES_DIRS_<config> variables defines, you might want to directly use these variables in your consumer CMakeLists.txt after the find_package?

If not, it is possible to directly access from the consumers:

# in the consumer conanfile.py
def generate(self):
     res_folder = self.dependencies["mydep"].cpp_info.resdirs
     # do whatever operation you need to do with the ``res_folder`` or the files inside it

Note this doesn't really hardcode the path to the files in the dependency, the resdirs is an abstraction/parameterization, and can be used to change it in the dependency without altering the consumer.

Please let me know if this helps.

from conan.

s-mlr avatar s-mlr commented on August 17, 2024

Thanks @memsharded for your immediate reply. Your response times are second to none!

That approach certainly works and I'm completely fine with. I mainly wanted to make sure there is no other design available to completely take care of this from the consumer side. As long as I'm following best practices it's all good.

It does feel like it would be aligned with the general idea / behavior of current generators (as I read them) to fully define it from consumer side and the tc basically already added that option, so I'm keen to see if something along those lines might be coming in the future?

Please consider the question answered. Thanks a bunch!

from conan.

memsharded avatar memsharded commented on August 17, 2024

It does feel like it would be aligned with the general idea / behavior of current generators (as I read them) to fully define it from consumer side and the tc basically already added that option, so I'm keen to see if something along those lines might be coming in the future?

The challenge here is that we haven't seen any common pattern or usage of resource files, that are wildly varying in nature and usage. For a built-in generator it would be necessary to have some well known and popular usage patterns to implement anything in Conan. As always, we are open to feedback to learn about the use cases, but so far seems a bit unlikely.

Thanks to you for the feedback!

from conan.

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.