Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build both shared and static library #12

Closed
wants to merge 1 commit into from
Closed

Build both shared and static library #12

wants to merge 1 commit into from

Conversation

jeroen
Copy link

@jeroen jeroen commented Jun 16, 2017

This enabled building a static library, in addition to a shared one. Windows has a different linking system so this is only enabled for unix. References:

I need this myself for building standalone applications, but I think it is generally useful.

Thank you for your review!

@mhosken mhosken requested a review from tim-eves June 16, 2017 14:53
@jeroen
Copy link
Author

jeroen commented Jun 21, 2017

@tim-eves could you have a quick look? Thanks!

@jeroen
Copy link
Author

jeroen commented Jun 26, 2017

Anyone please? This is a very small fix that would be super helpful.

@tim-eves
Copy link
Contributor

tim-eves commented Jun 27, 2017

Hi jeroen,

Sorry for the delay this, slipped under my radar. There's no problem with adding a static lib output, though I'll want to take a quick look as we already build a static version (in pieces) for testing and I want to check if that will suffice, if not i'll merge yours in tomorrow (my time, so probably more like 24 hours)

@jeroen
Copy link
Author

jeroen commented Jun 27, 2017

Hi @tim-eves,

Thanks for your reply. I mostly use graphite via homebrew and the recipe uses the standard steps (cmake, make install) which does not seem to produce static libs by default. I am hoping that this would fix that. I'm not a cmake expert though, perhaps there is an alternate way.

@tim-eves
Copy link
Contributor

tim-eves commented Jun 28, 2017

I'd like to try an alternaive way first: I've added support in branch switchable-static-shared-library-build, to have cmake build libgraphite2 as static instead of shared, rather than produce both (which can be done using this approach but with two build directories one configured each way). This is controlled by the BUILD_SHARED_LIBS:BOOL option by using ccmake or passing it to the cmake invocation, like so cmake .. -DBUILD_SHARED_LIBS:BOOL=OFF. This defaults to ON so as to not change current expectations for a default build for existing packaging e.g. on Debian or Fedora.
As this allows an easy way to make a static version I hope this will meet your need.
I don't know enough about homebrew to know how you'd pass build options (of which graphite already has several) to cmake without editing the formula (which I notice is a supported operation with brew edit <formula name>). I'm reluctant to just build a static version and produce both forms, as that requires building a 2nd copy, doubling build times, without having tried this option first and even then I'd be inclined to make building both an option rather than the default, and lastly by doing some more significant modifications to the build system it might be possible avoid the duplicate build cost but before doing that and testing etc I'd like to give this idea a try. I'm going to close this pull request and ask if this doesn't work for you please open an issue so we can continue the discussion there since I'm unlikely to use this code as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants