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.

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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to