SanderMertens / bake

Bake, A build system for building, testing and running C & C++ projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Way to programmatically generate a standalone release (or statically linked executable)

lambdadog opened this issue · comments

Is there a way I can either 1) take the executable I'm building and instruct bake to build all of its libraries as static libraries then link them into the executable, or 2) programmatically get all the libraries depended on so that I can copy them into a directory to bundle alongside of the executable for a standalone release?

I've looked into the various configuration options and haven't found anything yet in regards to doing either

While it would be possible to manually do it myself because I do generally know where bake keeps the libraries, it would be pretty helpful to not have to do this pretty major step in the release process of, say, a game, manually.

This has been on my wishlist for a while, and maybe it's time to implement it. You can currently build static binaries by adding the static property and set it to true. You can then link with static libraries by specifying them in the static-lib property. Both properties should be added to lang.c, and are documented here: https://github.com/SanderMertens/bake/tree/master/drivers/lang/c

However, it would be (much) nicer if there were a command line option like --static or something that would compile the entire project as a self-contained binary. This is something that is definitely possible to do, but will take some time to build.

How does the static-lib property interact with bake-managed dependencies, would I need to remove them from there first and would it be able to access them without any hacks?

Also, current documentation for the static property indicates that it only works with packages, meaning in bake-speak, libraries. I assume from what you're saying, that's changed?