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

Fix: #197 windows shared libraries build support #198

Merged
merged 1 commit into from
Feb 25, 2023
Merged

Conversation

galkahana
Copy link
Owner

#197 reports that building on windows with -DBUILD_SHARED_LIBS fails.
The direct failure is to find zlib.lib which is used by few targets within pdfhummus project (pdfwriter, libtiff, libpng).
The failure is because no symbols are exported when compiling zlib and therfore no .lib file is created, only a dll.
This problem is not specific to the bundled zlib target, but is also true to all other targets, including PDFWriter. As a result building with BUILD_SHARED_LIBS is kinda pointless - you'll get a dll out but can't do anything with it.

This PR tends to that by adding symbol exporting to all targets. as a result lib files are created and linking completes. also symbols are exported for PDFWriter.

Most bundled lib had existing support for symbol exporting and just adding a compile definition solved the problem. I had to upgrade freetype for this...but it's not all bad cause while doing so i figured there's quite a bit of included code i don't need for freetype and got rid of quite a bit of content. Only libtiff and PDFWriter didn't have export symbols setup for them. For those two i added WINDOWS_EXPORT_ALL_SYMBOLS so that they'll automatically export all symbols. effective if not very sensitive.

One last note. when building shared libs the Ctest bit will fail because the executable created cant find the shared dlls. i solved this by copying the other 6 dlls to its folder and then it passed all tests. didn't bother with automating something here because i'm not sure it's super interesting to make it work this way.

anyways, problem solved and building succeeds.

building with -DBUILD_SHARED_LIBS would fail as no symbols were exported and so no .lib files created
@galkahana galkahana merged commit f2518c9 into master Feb 25, 2023
@galkahana galkahana deleted the win-shared-libs branch February 25, 2023 13:15
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.

1 participant