[poppler] cmake: gtk-doc support
Carlos Garcia Campos
carlosgc at gnome.org
Wed Sep 20 18:00:42 UTC 2017
Albert Astals Cid <aacid at kde.org> writes:
> El dimecres, 6 de setembre de 2017, a les 8:32:03 CEST, Carlos Garcia Campos
> va escriure:
>> Albert Astals Cid <aacid at kde.org> writes:
>> > So gtkdoc upstream seems to have cmake support, so I *almost* made it work
>> >
>> > But it's obviously failing to pick up some stuff since the generated files
>> > look wrong.
>> >
>> > See
>> > http://i.imgur.com/gdSH1pI.png
>> > vs
>> > http://i.imgur.com/5QSy6oP.png
>> >
>> > Patch attached.
>> >
>> > Can anyone try to have a look? Or anyone knows who could i ask for help on
>> > the glib/gnome side? I've sank a few hours into this and not sure i can
>> > move it forward without further help.
>>
>> I'll look at it (probably during the weekend)
>
> Any luck?
Yes, I tried to use the CMake files provided by gtk-doc but it didn't
really work, so in the end it was a lot easier to reuse the WebKit
approach. In WebKit we have a gtkdoc.py that is a standalone generic
module to deal with gtk-doc and another script called from CMake that
uses that module to generate the docs. In the patch attached I've added
the gtkdoc.py, just copied from WebKit, and a custom script to use it in
poppler. It also updates the CMake files to build, install and include
documentation in the tarball. It works fine here, please try it out and
let me know whether it works for you too.
> Is this something we could decouple from the build? (i.e. in the same way we
> have Doxygen for the cpp/qt4/qt5 frontends but you don't need cmake support)
>
> Cheers,
> Albert
>
>>
>> > Cheers,
>> >
>> > Albert
>> >
>> > diff --git a/CMakeLists.txt b/CMakeLists.txt
>> > index f557bdaf..4a012db4 100644
>> > --- a/CMakeLists.txt
>> > +++ b/CMakeLists.txt
>> > @@ -161,7 +161,10 @@ if(CAIRO_FOUND)
>> >
>> > set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "")
>> > if(ENABLE_GLIB)
>> >
>> > macro_optional_find_package(GLIB)
>> >
>> > - if(NOT GLIB_FOUND)
>> > + if(GLIB_FOUND)
>> > + find_package(GtkDoc 1.25 QUIET)
>> > + MESSAGE("GtkDoc_FOUND ${GtkDoc_FOUND}")
>> > + else()
>> >
>> > set(ENABLE_GLIB OFF)
>> >
>> > endif()
>> >
>> > endif()
>> >
>> > @@ -786,7 +789,7 @@ show_end_message_yesno("qt5 wrapper" ENABLE_QT5)
>> >
>> > show_end_message_yesno("glib wrapper" ENABLE_GLIB)
>> > show_end_message_yesno(" introspection" INTROSPECTION_FOUND)
>> > show_end_message_yesno("cpp wrapper" ENABLE_CPP)
>> >
>> > -show_end_message("use gtk-doc" "not supported with this CMake build
>> > system") +show_end_message_yesno("use gtk-doc" GtkDoc_FOUND)
>> >
>> > show_end_message_yesno("use libjpeg" ENABLE_LIBJPEG)
>> > show_end_message_yesno("use libpng" ENABLE_LIBPNG)
>> > show_end_message_yesno("use libtiff" ENABLE_LIBTIFF)
>> >
>> > diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
>> > index 26724ec1..455c9d49 100644
>> > --- a/glib/CMakeLists.txt
>> > +++ b/glib/CMakeLists.txt
>> > @@ -84,7 +84,7 @@ add_library(poppler-glib SHARED ${poppler_glib_SRCS}
>> > ${poppler_glib_generated_SR>
>> > set_target_properties(poppler-glib PROPERTIES VERSION 8.9.0 SOVERSION 8)
>> > target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES}
>> > ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES}) if(HAVE_PTHREAD)
>> >
>> > - target_link_libraries(poppler-glib -lpthread)
>> > + target_link_libraries(poppler-glib pthread)
>> >
>> > endif()
>> > install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION
>> > lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})>
>> > @@ -134,3 +134,7 @@ if (HAVE_INTROSPECTION)
>> >
>> > gir_add_introspections(INTROSPECTION_GIRS)
>> >
>> > endif ()
>> >
>> > +
>> > +if (GtkDoc_FOUND)
>> > + add_subdirectory(reference)
>> > +endif()
>> > diff --git a/glib/reference/CMakeLists.txt b/glib/reference/CMakeLists.txt
>> > new file mode 100644
>> > index 00000000..c22557fd
>> > --- /dev/null
>> > +++ b/glib/reference/CMakeLists.txt
>> > @@ -0,0 +1,26 @@
>> > +SET(exec_prefix "/usr/")
>> > +
>> > +find_package(GtkDoc 1.25 REQUIRED)
>> > +
>> > +# For some reason poppler has a -lpthread that I don't know exactly where
>> > it comes from +# but the GtkDoc cmake code chokes on it, so replace to
>> > pthread only +get_target_property(target_link_flags poppler
>> > LINK_LIBRARIES)
>> > +string(REPLACE "-lpthread" "pthread" fixed_target_link_flags
>> > "${target_link_flags}") +set_target_properties(poppler PROPERTIES
>> > LINK_LIBRARIES "${fixed_target_link_flags}") +
>> > +# Create the doc-poppler target.
>> > +gtk_doc_add_module(
>> > + poppler
>> > + SOURCE ${CMAKE_SOURCE_DIR}/glib/
>> > + ${CMAKE_SOURCE_DIR}/glib/reference/
>> > + LIBRARIES poppler-glib poppler
>> > +)
>> > +
>> > +# Build doc-poppler as part of the default target. Without this, you
>> > would
>> > +# have to explicitly run something like `make doc-poppler` to build the
>> > docs. +add_custom_target(documentation ALL DEPENDS doc-poppler)
>> > +
>> > +# # Install the docs. (This assumes you're using the GNUInstallDirs CMake
>> > module +# # to set the CMAKE_INSTALL_DOCDIR variable correctly).
>> > +# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/poppler/html
>> > +# DESTINATION ${CMAKE_INSTALL_DOCDIR})
>> > _______________________________________________
>> > poppler mailing list
>> > poppler at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/poppler
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170920/895715b3/attachment-0001.sig>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-gtk-doc-support-to-CMake-build.patch
Type: text/x-diff
Size: 26925 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170920/895715b3/attachment-0001.patch>
-------------- next part --------------
--
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
More information about the poppler
mailing list