Skip to content

Draft: Allow poppler dll on Windows by creating export headers

Maarten DB requested to merge madebr/poppler:export-symbols into master

Hello! In the past months, I have been working on adding poppler to conan (which is a c/c++ package manager). See here for poppler-data and here for poppler.

I noticed that on MSVC the poppler library cannot be built as a dll. Also, poppler-cpp, poppler-qt5 and poppler-qt6 are always tagged with __declspec(dllimport) when built as a static library on Windows. I used CMake's GenerateExportHeader to generate an export header. This requires to tag every symbol with POPPLER_EXPORT to export it or not. By using this, it also enables to hide or deprecate symbols using POPPLER_DEPRECATED. This will make the build behave the same on all platforms.

Other changes:

  • I renamed CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR with PROJECT_SOURCE_DIR/PROJECT_BINARY_DIR to enable building poppler as a subproject.
  • Optionally build the tests. They are still built by default.
  • Include directories of iconv. When using conan, libiconv is located in a non-standard location. This means that its include directories must be included.

I tested this using MSVC2017 and gcc9 (on Linux)

Thanks

Edited by Maarten DB

Merge request reports