[evolution-data-server/wip/tintou/fix-documentation] [Doc] Use the cmake file provided by Gtk-Doc and fix the GObject scanning part



commit 65741137d829ee53d2c0458ebaab816921fc5e8e
Author: Corentin Noël <corentin elementary io>
Date:   Fri Oct 5 18:06:17 2018 +0200

    [Doc] Use the cmake file provided by Gtk-Doc and fix the GObject scanning part

 CMakeLists.txt                                     |   1 -
 cmake/modules/GtkDoc.cmake                         | 145 --------
 cmake/modules/GtkDocConfig.cmake                   | 414 +++++++++++++++++++++
 cmake/modules/GtkDocScanGObjWrapper.cmake          |  67 ++++
 docs/reference/CMakeLists.txt                      | 187 +++++++++-
 docs/reference/{camel => }/camel-docs.sgml.in      |   4 +-
 docs/reference/camel/CMakeLists.txt                |  41 --
 .../evolution-data-server-docs.sgml.in             |   8 +-
 .../reference/evolution-data-server/CMakeLists.txt |  46 ---
 .../image-sources/cursor-alphabetic-indexes.odg    | Bin
 .../image-sources/cursor-positions-filtered.odg    | Bin
 .../image-sources/cursor-positions-step.odg        | Bin
 .../image-sources/cursor-positions.odg             | Bin
 .../images/cursor-alphabetic-indexes.png           | Bin
 .../images/cursor-positions-filtered.png           | Bin
 .../images/cursor-positions-step.png               | Bin
 .../images/cursor-positions.png                    | Bin
 .../{private => }/libedbus-private-docs.sgml.in    |   0
 docs/reference/private/CMakeLists.txt              |  13 -
 .../evolution-data-server-cursor-example.sgml.in   |   0
 20 files changed, 671 insertions(+), 255 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d34dd5503..0600aaafa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,7 +254,6 @@ include(CheckTarget)
 include(DistTargets)
 include(GLibTools)
 include(GObjectIntrospection)
-include(GtkDoc)
 include(InstalledTests)
 include(PkgConfigEx)
 include(SetupBuildFlags)
diff --git a/cmake/modules/GtkDocConfig.cmake b/cmake/modules/GtkDocConfig.cmake
new file mode 100644
index 000000000..8806ea100
--- /dev/null
+++ b/cmake/modules/GtkDocConfig.cmake
@@ -0,0 +1,414 @@
+# CMake macros to use the GtkDoc documentation system
+#
+# See the GTK-Doc manual (help/manual/C/index.docbook) for an example of how to
+# use this.
+
+# Output variables:
+#
+#   GTKDOC_FOUND            ... set to 1
+#
+#   GTKDOC_SCAN_EXE         ... the location of the gtkdoc-scan executable
+#   GTKDOC_SCANGOBJ_EXE     ... the location of the gtkdoc-scangobj executable
+#   GTKDOC_MKDB_EXE         ... the location of the gtkdoc-mkdb executable
+#   GTKDOC_MKHTML_EXE       ... the location of the gtkdoc-mkhtml executable
+#   GTKDOC_FIXXREF_EXE      ... the location of the gtkdoc-fixxref executable
+
+
+#=============================================================================
+# Copyright 2009 Rich Wareham
+# Copyright 2015 Lautsprecher Teufel GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#=============================================================================
+
+include(CMakeParseArguments)
+
+set(GTKDOC_FOUND 1)
+
+find_program(GTKDOC_SCAN_EXE gtkdoc-scan)
+find_program(GTKDOC_SCANGOBJ_EXE gtkdoc-scangobj)
+find_program(GTKDOC_MKDB_EXE gtkdoc-mkdb)
+find_program(GTKDOC_MKHTML_EXE gtkdoc-mkhtml)
+find_program(GTKDOC_FIXXREF_EXE gtkdoc-fixxref)
+
+get_filename_component(_this_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
+find_file(GTKDOC_SCANGOBJ_WRAPPER GtkDocScanGObjWrapper.cmake PATH ${_this_dir})
+
+# ::
+#
+# gtk_doc_add_module(doc_prefix
+#                    SOURCE <sourcedir> [...]
+#                    XML xmlfile
+#                    [LIBRARIES depend1...]
+#                    [FIXXREFOPTS fixxrefoption1...]
+#                    [IGNOREHEADERS header1...]
+#                    [CONTENT_FILES example1...])
+#
+# Add a module with documentation to be processed with GTK-Doc.
+#
+# <sourcedir> must be the *full* path to the source directory.
+#
+# If omitted, xmlfile defaults to the auto generated ${doc_prefix}/${doc_prefix}-docs.xml.
+#
+# The `gtkdoc-scangobj` program is used to get introspection information for
+# the module. You should pass the target(s) to be scanned as LIRARIES. This
+# will try to set the correct compiler and link flags for the introspection
+# build to use, and the correct LD_LIBRARY_PATH for it to run, and the correct
+# dependencies for the doc target.
+#
+# You *can* also set the compile and link flags manually, using the 'CFLAGS'
+# and 'LDFLAGS' options. The 'LDPATH' option controls the LD_LIBRARY_PATH. You
+# can also manually add additional targets as dependencies of the
+# documentation build with the DEPENDS option.
+#
+# The 'CONTENT_FILES' option is here to copy the files extending the documentation
+# such as exemples and custom xml files.
+#
+# This function a target named "doc-${doc_prefix}". You will need to manually
+# add it to the ALL target if you want it to be built by default, you can do
+# something like this:
+#
+#   gtk_doc_add_module(doc-mymodule
+#                      SOURCE ${CMAKE_SOURCE_DIR}/module ${CMAKE_BINARY_DIR}/module
+#                      LIBRARIES mylibrary
+#                      LIBRARY_DIRS ${GLIB_LIBRARY_DIRS} ${FOO_LIBRARY_DIRS}
+#   add_custom_target(all-documentation ALL)
+#   add_dependencies(all-documentation doc-mymodule)
+#
+function(gtk_doc_add_module _doc_prefix)
+    set(_one_value_args "XML")
+    set(_multi_value_args "FIXXREFOPTS" "IGNOREHEADERS" "LIBRARIES" "LIBRARY_DIRS" "SOURCE" "SUFFIXES"
+                          "CFLAGS" "DEPENDS" "LDFLAGS" "LDPATH" "CONTENT_FILES" "SCANOPTS")
+    cmake_parse_arguments("GTK_DOC" "" "${_one_value_args}" "${_multi_value_args}" ${ARGN})
+
+    if(NOT GTK_DOC_SOURCE)
+        message(FATAL_ERROR "No SOURCE specified for gtk_doc_add_module ${_doc_prefix}")
+    endif()
+
+    set(_xml_file ${GTK_DOC_XML})
+
+    set(_fixxrefopts ${GTK_DOC_FIXXREFOPTS})
+    set(_ignore_headers ${GTK_DOC_IGNOREHEADERS})
+    set(_libraries ${GTK_DOC_LIBRARIES})
+    set(_library_dirs ${GTK_DOC_LIBRARY_DIRS})
+    set(_suffixes ${GTK_DOC_SUFFIXES})
+
+    set(_content_files ${GTK_DOC_CONTENT_FILES})
+    set(_scanopts ${GTK_DOC_SCANOPTS})
+
+    set(_extra_cflags ${GTK_DOC_CFLAGS})
+    set(_depends ${GTK_DOC_DEPENDS})
+    set(_extra_ldflags ${GTK_DOC_LDFLAGS})
+    set(_extra_ldpath ${GTK_DOC_LDPATH})
+
+    if(_suffixes)
+        set(_doc_source_suffixes "")
+        foreach(_suffix ${_suffixes})
+            if(_doc_source_suffixes)
+                set(_doc_source_suffixes "${_doc_source_suffixes},${_suffix}")
+            else(_doc_source_suffixes)
+                set(_doc_source_suffixes "${_suffix}")
+            endif(_doc_source_suffixes)
+        endforeach(_suffix)
+    else(_suffixes)
+        set(_doc_source_suffixes "h")
+    endif(_suffixes)
+
+    # Parse the LIBRARIES option and collect compile and link flags for those
+    # targets.
+    foreach(target ${_libraries})
+        _gtk_doc_get_cflags_for_target(_target_cflags ${target})
+        _gtk_doc_get_ldflags_for_target(_target_ldflags ${target} "${_libraries}")
+        list(APPEND _extra_cflags ${_target_cflags})
+        list(APPEND _extra_ldflags ${_target_ldflags})
+        list(APPEND _extra_ldpath $<TARGET_FILE_DIR:${target}>)
+
+        list(APPEND _depends ${target})
+    endforeach()
+
+    list(REMOVE_DUPLICATES _extra_cflags)
+    list(REMOVE_DUPLICATES _extra_ldflags)
+    list(REMOVE_DUPLICATES _extra_ldpath)
+
+    # Link directories can't be specified per target, only for every target
+    # under a given directory.
+    get_property(all_library_directories DIRECTORY PROPERTY LINK_DIRECTORIES)
+    foreach(library_dir ${all_library_directories})
+        list(APPEND _extra_ldflags ${CMAKE_LIBRARY_PATH_FLAG}${library_dir})
+        list(APPEND _extra_ldpath ${library_dir})
+    endforeach()
+
+    # a directory to store output.
+    set(_output_dir "${CMAKE_CURRENT_BINARY_DIR}/${_doc_prefix}")
+    set(_output_dir_stamp "${_output_dir}/dir.stamp")
+
+    # set default sgml file if not specified
+    set(_default_xml_file "${_output_dir}/${_doc_prefix}-docs.xml")
+    get_filename_component(_default_xml_file ${_default_xml_file} ABSOLUTE)
+
+    # a directory to store html output.
+    set(_output_html_dir "${_output_dir}/html")
+    set(_output_html_dir_stamp "${_output_dir}/html_dir.stamp")
+
+    # The output files
+    set(_output_decl_list "${_output_dir}/${_doc_prefix}-decl-list.txt")
+    set(_output_decl "${_output_dir}/${_doc_prefix}-decl.txt")
+    set(_output_overrides "${_output_dir}/${_doc_prefix}-overrides.txt")
+    set(_output_sections "${_output_dir}/${_doc_prefix}-sections.txt")
+    set(_output_types "${_output_dir}/${_doc_prefix}.types")
+
+    set(_output_signals "${_output_dir}/${_doc_prefix}.signals")
+
+    set(_output_unused "${_output_dir}/${_doc_prefix}-unused.txt")
+    set(_output_undeclared "${_output_dir}/${_doc_prefix}-undeclared.txt")
+    set(_output_undocumented "${_output_dir}/${_doc_prefix}-undocumented.txt")
+
+    set(_output_xml_dir "${_output_dir}/xml")
+    set(_output_sgml_stamp "${_output_dir}/sgml.stamp")
+
+    set(_output_html_stamp "${_output_dir}/html.stamp")
+
+    # we depend on the content files being there before doing anything
+    if(_content_files)
+        list(APPEND _depends ${_content_files})
+    endif(_content_files)
+
+    # add a command to create output directory
+    add_custom_command(
+        OUTPUT "${_output_dir_stamp}" "${_output_dir}"
+        COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_dir}"
+        COMMAND ${CMAKE_COMMAND} -E touch ${_output_dir_stamp}
+        VERBATIM)
+
+    set(_ignore_headers_opt "")
+    if(_ignore_headers)
+        set(_ignore_headers_opt "--ignore-headers=")
+        foreach(_header ${_ignore_headers})
+            set(_ignore_headers_opt "${_ignore_headers_opt}${_header} ")
+        endforeach(_header ${_ignore_headers})
+    endif(_ignore_headers)
+
+    foreach(source_dir ${GTK_DOC_SOURCE})
+        set(_source_dirs_opt ${_source_dirs_opt} --source-dir=${source_dir})
+    endforeach()
+
+    # add a command to scan the input
+    add_custom_command(
+        OUTPUT
+            "${_output_decl_list}"
+            "${_output_decl}"
+            "${_output_overrides}"
+            "${_output_sections}"
+            "${_output_types}"
+        DEPENDS
+            "${_output_dir_stamp}"
+            ${_depends}
+        COMMAND
+            ${GTKDOC_SCAN_EXE}
+            --module=${_doc_prefix}
+            ${_ignore_headers_opt}
+            ${_source_dirs_opt}
+            --rebuild-sections
+            --rebuild-types
+            ${_scanopts}
+        WORKING_DIRECTORY ${_output_dir}
+        VERBATIM)
+
+    # add a command to scan the input via gtkdoc-scangobj
+    # This is such a disgusting hack!
+    add_custom_command(
+        OUTPUT
+            ${_output_signals}
+        DEPENDS
+            ${_output_types}
+        COMMAND ${CMAKE_COMMAND}
+            -D "GTKDOC_SCANGOBJ_EXE:STRING=${GTKDOC_SCANGOBJ_EXE}"
+            -D "doc_prefix:STRING=${_doc_prefix}"
+            -D "output_types:STRING=${_output_types}"
+            -D "output_dir:STRING=${_output_dir}"
+            -D "EXTRA_CFLAGS:STRING=${_extra_cflags}"
+            -D "EXTRA_LDFLAGS:STRING=${_extra_ldflags}"
+            -D "EXTRA_LDPATH:STRING=${_extra_ldpath}"
+            -P ${GTKDOC_SCANGOBJ_WRAPPER}
+        WORKING_DIRECTORY "${_output_dir}"
+        VERBATIM)
+
+    set(_copy_xml_if_needed "")
+    if(_xml_file)
+        get_filename_component(_xml_file ${_xml_file} ABSOLUTE)
+        set(_copy_xml_if_needed
+            COMMAND ${CMAKE_COMMAND} -E copy "${_xml_file}" "${_default_xml_file}")
+    endif(_xml_file)
+
+    set(_remove_xml_if_needed "")
+    if(_xml_file)
+        set(_remove_xml_if_needed
+            COMMAND ${CMAKE_COMMAND} -E remove ${_default_xml_file})
+    endif(_xml_file)
+
+    set(_copy_content_files_if_needed "")
+    if(_content_files)
+        foreach(_content_file ${_content_files})
+            # We need to copy the content files to the build directory.
+            # We respect the folder tree if the file comes from the current
+            # source or binary directory but copy the file to the current binary
+            # directory if it comes from somewhere else.
+            get_filename_component(_content_file ${_content_file} ABSOLUTE)
+            string(REGEX MATCH "^${CMAKE_CURRENT_SOURCE_DIR}" _is_in_source ${_content_file})
+            string(REGEX MATCH "^${CMAKE_CURRENT_BINARY_DIR}" _is_in_binary ${_content_file})
+            if (_is_in_source OR _is_in_binary)
+                if(_is_in_source)
+                    file(RELATIVE_PATH _content_file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${_content_file})
+                else(_is_in_source)
+                    file(RELATIVE_PATH _content_file_relative ${CMAKE_CURRENT_BINARY_DIR} ${_content_file})
+                endif(_is_in_source)
+                set(_content_file_destination
+                    "${_output_dir}/${_content_file_relative}")
+            else(_is_in_source OR _is_in_binary)
+                get_filename_component(_content_file_name ${_content_file} NAME)
+                set(_content_file_destination
+                    "${_output_dir}/${_content_file_name}")
+            endif(_is_in_source OR _is_in_binary)
+            get_filename_component(_content_file_destination ${_content_file_destination} ABSOLUTE)
+            if(NOT ${_content_file_destination} EQUAL ${_content_file})
+                set(_copy_content_files_if_needed
+                    ${_copy_content_files_if_needed}
+                    COMMAND ${CMAKE_COMMAND} -E copy "${_content_file}" "${_content_file_destination}")
+            endif(NOT ${_content_file_destination} EQUAL ${_content_file})
+        endforeach(_content_file)
+    endif(_content_files)
+
+    # add a command to make the database
+    add_custom_command(
+        OUTPUT
+            ${_output_sgml_stamp}
+            ${_default_xml_file}
+        DEPENDS
+            ${_output_types}
+            ${_output_signals}
+            ${_output_sections}
+            ${_output_overrides}
+            ${_depends}
+        ${_remove_xml_if_needed}
+        COMMAND ${CMAKE_COMMAND} -E remove_directory ${_output_xml_dir}
+        ${_copy_xml_if_needed}
+        ${_copy_content_files_if_needed}
+        COMMAND ${GTKDOC_MKDB_EXE}
+            --module=${_doc_prefix}
+            ${_source_dirs_opt}
+            --source-suffixes=${_doc_source_suffixes}
+            --output-format=xml
+            --main-sgml-file=${_default_xml_file}
+        WORKING_DIRECTORY "${_output_dir}"
+        VERBATIM)
+
+    # add a command to create html directory
+    add_custom_command(
+        OUTPUT "${_output_html_dir_stamp}" "${_output_html_dir}"
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${_output_html_dir}
+        COMMAND ${CMAKE_COMMAND} -E touch ${_output_html_dir_stamp}
+        VERBATIM)
+
+    # add a command to output HTML
+    add_custom_command(
+        OUTPUT
+            ${_output_html_stamp}
+        DEPENDS
+            ${_output_html_dir_stamp}
+            ${_output_sgml_stamp}
+            ${_xml_file}
+            ${_depends}
+        ${_copy_xml_if_needed}
+        # The binary dir needs adding to --path in order for mkhtml to pick up
+        # any version.xml file there might be in there
+        COMMAND
+            cd ${_output_html_dir} && ${GTKDOC_MKHTML_EXE}
+                ${_doc_prefix}
+                ${_default_xml_file}
+        COMMAND
+            cd ${_output_dir} && ${GTKDOC_FIXXREF_EXE}
+                --module=${_doc_prefix}
+                --module-dir=${_output_html_dir}
+                ${_fixxref_opts}
+        COMMENT
+            "Generating HTML documentation for ${_doc_prefix} module with gtkdoc-mkhtml"
+        VERBATIM)
+
+    add_custom_target(doc-${_doc_prefix}
+        DEPENDS "${_output_html_stamp}")
+endfunction(gtk_doc_add_module)
+
+# These two functions reimplement some of the core logic of CMake, in order
+# to generate compiler and linker flags from the relevant target properties.
+# It sucks that we have to do this, but CMake's own code for this doesn't seem
+# to be reusable -- there's no way to say "tell me the flags that you would
+# pass to a linker for this target".
+
+function(_gtk_doc_get_cflags_for_target result_var target)
+    get_target_property(target_definitions ${target} COMPILE_DEFINITIONS)
+    if(target_definitions)
+        foreach(target_definition ${target_definitions})
+            list(APPEND cflags -D${target_definition})
+        endforeach()
+    endif()
+
+    get_target_property(target_options ${target} COMPILE_OPTIONS)
+    if(target_options)
+        list(APPEND cflags ${target_options})
+    endif()
+
+    get_target_property(target_include_dirs ${target} INCLUDE_DIRECTORIES)
+    foreach(target_include_dir ${target_include_dirs})
+        list(APPEND cflags -I${target_include_dir})
+    endforeach()
+
+    list(REMOVE_DUPLICATES cflags)
+    list(SORT cflags)
+
+    set(${result_var} ${cflags} PARENT_SCOPE)
+endfunction()
+
+function(_gtk_doc_get_ldflags_for_target result_var target all_targets)
+    get_target_property(target_link_flags ${target} LINK_FLAGS)
+    if(target_link_flags)
+        list(APPEND ldflags ${target_link_flags})
+    endif()
+
+    get_target_property(target_link_libraries ${target} LINK_LIBRARIES)
+    foreach(target_library ${target_link_libraries})
+        # The IN_LIST operator is new in CMake 3.3, so I've tried to avoid using it.
+        list(FIND all_targets ${target_library} target_library_is_explicit_dependency)
+        if(NOT ${target_library_is_explicit_dependency} EQUAL -1)
+            # This target is part of the current project. We will add it to
+            # LDFLAGS explicitly, so don't try to add it with -l<target> as
+            # well. In fact, we can't do that, as the containing directory
+            # probably won't be in the linker search path, and we can't find
+            # that out and add it ourselves.
+        elseif(EXISTS ${target_library})
+            # Pass the filename directly to the linker.
+            list(APPEND ldflags "${target_library}")
+        else()
+            # Pass -l<filename> to the linker.
+            list(APPEND ldflags "${target_library}")
+        endif()
+    endforeach()
+
+    # Link in the actual target, as well.
+    list(APPEND ldflags $<TARGET_FILE:${target}>)
+
+    list(REMOVE_DUPLICATES ldflags)
+    list(SORT ldflags)
+
+    set(${result_var} ${ldflags} PARENT_SCOPE)
+endfunction()
diff --git a/cmake/modules/GtkDocScanGObjWrapper.cmake b/cmake/modules/GtkDocScanGObjWrapper.cmake
new file mode 100644
index 000000000..72921087f
--- /dev/null
+++ b/cmake/modules/GtkDocScanGObjWrapper.cmake
@@ -0,0 +1,67 @@
+# Internal -- for use with UseGtkDoc.cmake
+#
+#=============================================================================
+# Copyright 2009 Rich Wareham
+# Copyright 2015 Lautsprecher Teufel GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#=============================================================================
+
+# This is needed for find_package(PkgConfig) to work correctly --
+# CMAKE_MINIMUM_REQUIRED_VERSION needs to be defined.
+cmake_minimum_required(VERSION 3.2)
+
+if(NOT APPLE)
+    # We use pkg-config to find glib et al
+    find_package(PkgConfig)
+    # Find glib et al
+    pkg_check_modules(GLIB REQUIRED glib-2.0 gobject-2.0)
+
+foreach(_flag ${EXTRA_CFLAGS} ${GLIB_CFLAGS})
+    set(ENV{CFLAGS} "$ENV{CFLAGS} '${_flag}'")
+endforeach(_flag)
+
+foreach(_flag ${EXTRA_LDFLAGS} ${GLIB_LDFLAGS})
+    set(ENV{LDFLAGS} "$ENV{LDFLAGS} '${_flag}'")
+endforeach(_flag)
+
+foreach(_flag ${EXTRA_LDPATH})
+    if(DEFINED ENV{LD_LIBRARY_PATH})
+        set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${_flag}")
+    else(DEFINED ENV{LD_LIBRARY_PATH})
+        set(ENV{LD_LIBRARY_PATH} "${_flag}")
+    endif(DEFINED ENV{LD_LIBRARY_PATH})
+endforeach(_flag)
+
+message(STATUS "Executing gtkdoc-scangobj with:")
+message(STATUS "   CFLAGS: $ENV{CFLAGS}")
+message(STATUS "  LDFLAGS: $ENV{LDFLAGS}")
+message(STATUS "   LDPATH: $ENV{LD_LIBRARY_PATH}")
+
+execute_process(COMMAND ${GTKDOC_SCANGOBJ_EXE}
+    "--module=${doc_prefix}"
+    "--types=${output_types}"
+    "--output-dir=${output_dir}"
+    WORKING_DIRECTORY "${output_dir}"
+    RESULT_VARIABLE _scan_result)
+
+if(_scan_result EQUAL 0)
+    message(STATUS "Scan succeeded.")
+else(_scan_result EQUAL 0)
+    message(SEND_ERROR "Scan failed.")
+endif(_scan_result EQUAL 0)
+
+endif(NOT APPLE)
+
+# vim:sw=4:ts=4:et:autoindent
diff --git a/docs/reference/CMakeLists.txt b/docs/reference/CMakeLists.txt
index 9a9144b7e..c78ae1350 100644
--- a/docs/reference/CMakeLists.txt
+++ b/docs/reference/CMakeLists.txt
@@ -1,6 +1,187 @@
-add_subdirectory(camel)
-add_subdirectory(evolution-data-server)
+# We need to use our own CMake module until the one upstream is fixed
+find_package(GtkDoc NO_DEFAULT_PATH PATHS "${CMAKE_SOURCE_DIR}/cmake/modules")
+
+set(INSTALL_DOCDIR "${SHARE_INSTALL_PREFIX}/gtk-doc/html")
+
+# ******************************
+# Camel Documentation
+# ******************************
+
+set(CAMEL_SOURCEDIRS
+       ${CMAKE_SOURCE_DIR}/src/camel
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/local
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/imapx
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/nntp
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/pop3
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/sendmail
+       ${CMAKE_SOURCE_DIR}/src/camel/providers/smtp
+)
+
+set(CAMEL_DEPENDENCIES
+       camel
+       camellocal
+       camelimapx
+       camelnntp
+       camelpop3
+       camelsendmail
+       camelsmtp
+)
+
+set(CAMEL_IGNORE_HEADERS
+       addresses.h
+       address-data.h
+       camel-charset-map-private.h
+       camel-enumtypes.h
+       camel-i18n.h
+       camel-imapx-tokenise.h
+       camel-imapx-utils.h
+       camel-local-private.h
+       camel-nntp-private.h
+       camel-nntp-resp-codes.h
+       camel-search-private.h
+       camel-test.h
+       camel-test-provider.h
+       camel-win32.h
+       folders.h
+       messages.h
+       session.h
+)
+
+set(CAMEL_XML ${CMAKE_CURRENT_BINARY_DIR}/camel-docs.sgml)
+configure_file(
+       ${CMAKE_CURRENT_SOURCE_DIR}/camel-docs.sgml.in
+       ${CAMEL_XML}
+       @ONLY
+)
+
+gtk_doc_add_module(
+       camel
+       XML ${CAMEL_XML}
+       SOURCE ${CAMEL_SOURCEDIRS}
+       LIBRARIES ${CAMEL_DEPENDENCIES}
+       IGNOREHEADERS ${CAMEL_IGNORE_HEADERS}
+       SCANOPTS "--deprecated-guards=CAMEL_DISABLE_DEPRECATED"
+)
+
+add_custom_target(camel-documentation ALL DEPENDS doc-camel)
+
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/camel/html
+                 DESTINATION ${INSTALL_DOCDIR}/camel)
+
+# ******************************
+# Evolution Data Server documentation
+# ******************************
+
+set(EDS_SOURCEDIRS
+       ${CMAKE_SOURCE_DIR}/src/libedataserver
+       ${CMAKE_BINARY_DIR}/src/libedataserver
+       ${CMAKE_SOURCE_DIR}/src/libebackend
+       ${CMAKE_SOURCE_DIR}/src/addressbook/libebook
+       ${CMAKE_SOURCE_DIR}/src/addressbook/libebook-contacts
+       ${CMAKE_SOURCE_DIR}/src/addressbook/libedata-book
+       ${CMAKE_SOURCE_DIR}/src/calendar/libecal
+       ${CMAKE_SOURCE_DIR}/src/calendar/libedata-cal
+       ${CMAKE_SOURCE_DIR}/tests/test-server-utils
+)
+
+set(EDS_DEPENDENCIES
+       camel
+       edataserver-private
+       edbus-private
+       egdbus-book
+       egdbus-cal
+       ebackend
+       edataserver
+       ebook
+       ebook-contacts
+       edata-book
+       ecal
+       edata-cal
+       etestserverutils
+)
+
+set(EDS_IGNORE_HEADERS
+       e-alphabet-index-private.h
+       e-backend-enumtypes.h
+       e-book-enumtypes.h
+       e-book-contacts-enumtypes.h
+       e-book-view-private.h
+       e-cal-enumtypes.h
+       e-cal-view-private.h
+       e-client-private.h
+       e-data-cal-types.h
+       e-phone-number-private.h
+       e-source-enumtypes.h
+       e-transliterator-private.h
+       libedataserver-private.h
+       ximian-vcard.h
+)
+
+set(EDS_EXAMPLE ${CMAKE_CURRENT_BINARY_DIR}/xml/evolution-data-server-cursor-example.sgml)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/xml/evolution-data-server-cursor-example.sgml.in
+       ${EDS_EXAMPLE}
+       @ONLY
+)
+
+set(EDS_XML ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-docs.sgml)
+configure_file(
+       ${CMAKE_CURRENT_SOURCE_DIR}/evolution-data-server-docs.sgml.in
+       ${EDS_XML}
+       @ONLY
+)
+
+file(GLOB EDS_IMAGES "${CMAKE_CURRENT_SOURCE_DIR}/images/*.png")
+
+gtk_doc_add_module(
+       evolution-data-server
+       XML ${EDS_XML}
+       SOURCE ${EDS_SOURCEDIRS}
+       LIBRARIES ${EDS_DEPENDENCIES}
+       IGNOREHEADERS ${EDS_IGNORE_HEADERS}
+       CONTENT_FILES ${EDS_EXAMPLE} ${EDS_IMAGES}
+       SCANOPTS "--deprecated-guards=EDS_DISABLE_DEPRECATED"
+)
+
+add_custom_target(evolution-data-server-documentation ALL DEPENDS doc-evolution-data-server)
+
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server/html
+                 DESTINATION ${INSTALL_DOCDIR}/evolution-data-server)
+
+# ******************************
+# Private documentation
+# ******************************
 
 if(WITH_PRIVATE_DOCS)
-       add_subdirectory(private)
+       set(EDBUS_PRIVATE_XML ${CMAKE_CURRENT_BINARY_DIR}/libedbus-private-docs.sgml)
+       configure_file(
+               ${CMAKE_CURRENT_SOURCE_DIR}/libedbus-private-docs.sgml.in
+               ${EDBUS_PRIVATE_XML}
+               @ONLY
+       )
+
+       set(EDBUS_PRIVATE_SOURCEDIRS
+               ${CMAKE_BINARY_DIR}/src/private
+       )
+
+       set(EDBUS_PRIVATE_DEPENDENCIES
+               edbus-private
+       )
+
+       set(EDBUS_PRIVATE_IGNORE_HEADERS
+               e-dbus-localed.h
+       )
+
+       gtk_doc_add_module(
+               libedbus-private
+               XML ${EDBUS_PRIVATE_XML}
+               SOURCE ${EDBUS_PRIVATE_SOURCEDIRS}
+               LIBRARIES ${EDBUS_PRIVATE_DEPENDENCIES}
+               IGNOREHEADERS ${EDBUS_PRIVATE_IGNORE_HEADERS}
+               SCANOPTS "--deprecated-guards=EDS_DISABLE_DEPRECATED"
+       )
+
+       add_custom_target(private-documentation ALL DEPENDS doc-libedbus-private)
+
+       install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libedbus-private/html
+                         DESTINATION ${INSTALL_DOCDIR}/libedbus-private)
 endif(WITH_PRIVATE_DOCS)
diff --git a/docs/reference/camel/camel-docs.sgml.in b/docs/reference/camel-docs.sgml.in
similarity index 99%
rename from docs/reference/camel/camel-docs.sgml.in
rename to docs/reference/camel-docs.sgml.in
index 2e66b6d4a..80aae313f 100644
--- a/docs/reference/camel/camel-docs.sgml.in
+++ b/docs/reference/camel-docs.sgml.in
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"; [
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
+                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
 <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
 ]>
 <book id="index" xmlns:xi="http://www.w3.org/2003/XInclude";>
diff --git a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in 
b/docs/reference/evolution-data-server-docs.sgml.in
similarity index 98%
rename from docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
rename to docs/reference/evolution-data-server-docs.sgml.in
index d9673b592..3d08da4d2 100644
--- a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
+++ b/docs/reference/evolution-data-server-docs.sgml.in
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"; [
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
+                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
 <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
 ]>
-<book id="index" xmlns:xi="http://www.w3.org/2001/XInclude";>
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude";>
   <bookinfo>
     <title>Evolution-Data-Server Reference Manual</title>
-    <releaseinfo>Reference Manual for @PACKAGE_VERSION@</releaseinfo>
+    <releaseinfo>Reference Manual for @PROJECT_VERSION@</releaseinfo>
     <abstract>
       <para>
        Evolution-Data-Server is a collection of libraries and services
diff --git a/docs/reference/evolution-data-server/image-sources/cursor-alphabetic-indexes.odg 
b/docs/reference/image-sources/cursor-alphabetic-indexes.odg
similarity index 100%
rename from docs/reference/evolution-data-server/image-sources/cursor-alphabetic-indexes.odg
rename to docs/reference/image-sources/cursor-alphabetic-indexes.odg
diff --git a/docs/reference/evolution-data-server/image-sources/cursor-positions-filtered.odg 
b/docs/reference/image-sources/cursor-positions-filtered.odg
similarity index 100%
rename from docs/reference/evolution-data-server/image-sources/cursor-positions-filtered.odg
rename to docs/reference/image-sources/cursor-positions-filtered.odg
diff --git a/docs/reference/evolution-data-server/image-sources/cursor-positions-step.odg 
b/docs/reference/image-sources/cursor-positions-step.odg
similarity index 100%
rename from docs/reference/evolution-data-server/image-sources/cursor-positions-step.odg
rename to docs/reference/image-sources/cursor-positions-step.odg
diff --git a/docs/reference/evolution-data-server/image-sources/cursor-positions.odg 
b/docs/reference/image-sources/cursor-positions.odg
similarity index 100%
rename from docs/reference/evolution-data-server/image-sources/cursor-positions.odg
rename to docs/reference/image-sources/cursor-positions.odg
diff --git a/docs/reference/evolution-data-server/images/cursor-alphabetic-indexes.png 
b/docs/reference/images/cursor-alphabetic-indexes.png
similarity index 100%
rename from docs/reference/evolution-data-server/images/cursor-alphabetic-indexes.png
rename to docs/reference/images/cursor-alphabetic-indexes.png
diff --git a/docs/reference/evolution-data-server/images/cursor-positions-filtered.png 
b/docs/reference/images/cursor-positions-filtered.png
similarity index 100%
rename from docs/reference/evolution-data-server/images/cursor-positions-filtered.png
rename to docs/reference/images/cursor-positions-filtered.png
diff --git a/docs/reference/evolution-data-server/images/cursor-positions-step.png 
b/docs/reference/images/cursor-positions-step.png
similarity index 100%
rename from docs/reference/evolution-data-server/images/cursor-positions-step.png
rename to docs/reference/images/cursor-positions-step.png
diff --git a/docs/reference/evolution-data-server/images/cursor-positions.png 
b/docs/reference/images/cursor-positions.png
similarity index 100%
rename from docs/reference/evolution-data-server/images/cursor-positions.png
rename to docs/reference/images/cursor-positions.png
diff --git a/docs/reference/private/libedbus-private-docs.sgml.in 
b/docs/reference/libedbus-private-docs.sgml.in
similarity index 100%
rename from docs/reference/private/libedbus-private-docs.sgml.in
rename to docs/reference/libedbus-private-docs.sgml.in
diff --git a/docs/reference/evolution-data-server/evolution-data-server-cursor-example.sgml.in 
b/docs/reference/xml/evolution-data-server-cursor-example.sgml.in
similarity index 100%
rename from docs/reference/evolution-data-server/evolution-data-server-cursor-example.sgml.in
rename to docs/reference/xml/evolution-data-server-cursor-example.sgml.in


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]