Giter VIP home page Giter VIP logo

Comments (8)

hunar1997 avatar hunar1997 commented on May 18, 2024 1

Thanks :D
will this project include those library configurations out of the box? like CMake does it with find_package(SFML 2 REQUIRED) or every user should write one of its own

from bake.

yamadapc avatar yamadapc commented on May 18, 2024

Maybe https://github.com/SanderMertens/bake#can-i-link-with-non-bake-libraries

from bake.

hunar1997 avatar hunar1997 commented on May 18, 2024

Ok, i actually saw that but it didn't work, then i found that this is the problem:

{
    "id": "sfml",
    "type": "application",
    "value": {
        "language": "cpp"
    },
    "lang.c":{
	"lib":["sfml-graphics", "sfml-window", "sfml-system","stdc++"]
    }
}

I removed the "value": {"language": "cpp"} section and it works now .. but why? it is a C++ application not C? and why lang.c instead of lang.cpp?

from bake.

SanderMertens avatar SanderMertens commented on May 18, 2024

Ah, I can see why this is a bit confusing. I just added an example to the C++ folder. The correct configuration is:

{
    "id": "sfml",
    "type": "application",
    "value": {
        "language": "cpp"
    },
    "lang.cpp":{
	"lib":["sfml-graphics", "sfml-window", "sfml-system","stdc++"]
    }
}

Bake's configuration is composed out of generic configuration (id, type, value) and driver-specific configuration (everything else). In this example, everything under "lang.cpp" is configuration for the C++ driver.

Bake automatically loads the correct language driver based on the "language" attribute, which by default is C. In your example, you selected C++ as the language, but you provided configuration for the C driver, which is why it wasn't picking up the settings.

When you removed the "language": "cpp" attribute, the project became a C project, and bake correctly loaded the configuration in "lang.c" which is why it worked.

In practice, the C and C++ drivers are almost the same (C++ inherits the definitions from C) so most configuration settings apply to both. If you would like to know more about driver configuration, see the READMEs in the driver projects:

C: https://github.com/SanderMertens/bake/tree/master/drivers/lang/c
C++: https://github.com/SanderMertens/bake/tree/master/drivers/lang/cpp

from bake.

SanderMertens avatar SanderMertens commented on May 18, 2024

Btw, here is a trick that, based on your example, you may find useful. You can encapsulate the SFML configuration, by doing this:

{
    "id": "sfml",
    "type": "package",
    "value": {
        "language": "none"
    },
    "dependee": {
        "lang.cpp": {
	    "lib":["sfml-graphics", "sfml-window", "sfml-system","stdc++"]
        }
    }
}

Then, in your application project, you can simply do this:

{
    "id": "my_sfml_app",
    "type": "application",
    "value": {
        "language": "c++",
        "use": ["sfml"]
    }
}

Note I changed the name of the application, so that it doesn't clash with the SFML package.

from bake.

SanderMertens avatar SanderMertens commented on May 18, 2024

That is a good question. It would be nice if bake could provide configurations for well-known libraries out of the box. There could be a folder in the repository called libraries in which these configurations can be stored. During the bake setup, these libraries will then automatically be made available for user projects.

It would be great if you could upload the sfml configuration, once it is in place

from bake.

SanderMertens avatar SanderMertens commented on May 18, 2024

I just implemented the above functionality. Any projects you add to the location below will be automatically installed during bake setup:

https://github.com/SanderMertens/bake/tree/master/libraries

See the SDL2 template for an example.

from bake.

SanderMertens avatar SanderMertens commented on May 18, 2024

Closing the issue as question is answered.

from bake.

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.