[evolution] eds-I#41 - Documentation doesn't go through gtkdoc-scangobj
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] eds-I#41 - Documentation doesn't go through gtkdoc-scangobj
- Date: Mon, 5 Nov 2018 10:05:13 +0000 (UTC)
commit e72cf9ab45ed0500bba2f300f2279790c443358d
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 5 11:05:45 2018 +0100
eds-I#41 - Documentation doesn't go through gtkdoc-scangobj
Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/41
CMakeLists.txt | 4 +-
cmake/modules/GtkDoc.cmake | 96 ++++++++++++++++++++++
docs/reference/CMakeLists.txt | 7 +-
.../evolution-mail-composer/CMakeLists.txt | 2 +-
.../reference/evolution-mail-engine/CMakeLists.txt | 2 +-
.../evolution-mail-formatter/CMakeLists.txt | 2 +-
docs/reference/evolution-shell/CMakeLists.txt | 2 +-
docs/reference/evolution-util/CMakeLists.txt | 2 +-
src/em-format/e-mail-formatter.c | 4 +-
src/em-format/e-mail-parser.c | 4 +-
10 files changed, 114 insertions(+), 11 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e556a52a17..2236d3da3f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -759,7 +759,6 @@ add_pkgconfig_file(evolution-mail.pc.in evolution-mail-${INTERFACE_VERSION}.pc)
add_pkgconfig_file(evolution-shell.pc.in evolution-shell-${INTERFACE_VERSION}.pc)
add_subdirectory(data)
-add_subdirectory(docs)
add_subdirectory(po)
add_subdirectory(src)
add_subdirectory(tests)
@@ -767,3 +766,6 @@ add_subdirectory(tests)
if(WITH_HELP)
add_subdirectory(help)
endif(WITH_HELP)
+
+# Add it as the last, because it looks for targets defined above
+add_subdirectory(docs)
diff --git a/cmake/modules/GtkDoc.cmake b/cmake/modules/GtkDoc.cmake
index e82ee0a198..b3519aeb52 100644
--- a/cmake/modules/GtkDoc.cmake
+++ b/cmake/modules/GtkDoc.cmake
@@ -2,6 +2,9 @@
#
# Macros to support develper documentation build from sources with gtk-doc.
#
+# Note that every target and dependency should be defined before the macro is
+# called, because it uses information from those targets.
+#
# add_gtkdoc(_module _namespace _deprecated_guards _srcdirsvar _depsvar _ignoreheadersvar)
# Adds rules to build developer documentation using gtk-doc for some part.
# Arguments:
@@ -24,6 +27,7 @@ if(NOT ENABLE_GTK_DOC)
endif(NOT ENABLE_GTK_DOC)
find_program(GTKDOC_SCAN gtkdoc-scan)
+find_program(GTKDOC_SCANGOBJ gtkdoc-scangobj)
find_program(GTKDOC_MKDB gtkdoc-mkdb)
find_program(GTKDOC_MKHTML gtkdoc-mkhtml)
find_program(GTKDOC_FIXXREF gtkdoc-fixxref)
@@ -63,6 +67,82 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
set(_mkhtml_prefix "${CMAKE_COMMAND} -E env XML_CATALOG_FILES=\"/usr/local/etc/xml/catalog\"")
endif(APPLE)
+ set(_scangobj_deps)
+ set(_scangobj_cflags_list)
+ set(_scangobj_cflags "")
+ set(_scangobj_ldflags "")
+ set(_scangobj_ld_lib_dirs "")
+
+ list(APPEND _scangobj_cflags_list -I${INCLUDE_INSTALL_DIR})
+ list(APPEND _scangobj_ldflags -L${LIB_INSTALL_DIR})
+
+ foreach(opt IN LISTS ${_depsvar})
+ if(TARGET ${opt})
+ set(_target_type)
+ get_target_property(_target_type ${opt} TYPE)
+ if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL
"SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ set(_compile_options)
+ set(_link_libraries)
+
+ get_target_property(_compile_options ${opt} COMPILE_OPTIONS)
+ get_target_property(_link_libraries ${opt} LINK_LIBRARIES)
+
+ list(APPEND _scangobj_cflags_list ${_compile_options})
+ list(APPEND _scangobj_deps ${_link_libraries})
+
+ unset(_compile_options)
+ unset(_link_libraries)
+ endif((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL
"SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ unset(_target_type)
+ endif(TARGET ${opt})
+
+ list(APPEND _scangobj_deps ${opt})
+ endforeach(opt)
+
+ if(_scangobj_deps)
+ list(REMOVE_DUPLICATES _scangobj_deps)
+ endif(_scangobj_deps)
+ if(_scangobj_cflags_list)
+ list(REMOVE_DUPLICATES _scangobj_cflags_list)
+ endif(_scangobj_cflags_list)
+
+ foreach(opt IN LISTS _scangobj_cflags_list)
+ set(_scangobj_cflags "${_scangobj_cflags} ${opt}")
+ endforeach(opt)
+
+ foreach(opt IN LISTS _scangobj_deps)
+ if(TARGET ${opt})
+ set(_target_type)
+ get_target_property(_target_type ${opt} TYPE)
+ if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL
"SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ set(_output_name "")
+ get_target_property(_output_name ${opt} OUTPUT_NAME)
+ if(NOT _output_name)
+ set(_output_name ${opt})
+ endif(NOT _output_name)
+ set(_scangobj_ldflags "${_scangobj_ldflags} -L$<TARGET_FILE_DIR:${opt}>
-l${_output_name}")
+
+ if(_target_type STREQUAL "SHARED_LIBRARY" OR (_target_type STREQUAL
"MODULE_LIBRARY"))
+ set(_scangobj_ld_lib_dirs
"${_scangobj_ld_lib_dirs}:$<TARGET_FILE_DIR:${opt}>")
+ endif(_target_type STREQUAL "SHARED_LIBRARY" OR (_target_type STREQUAL
"MODULE_LIBRARY"))
+ unset(_output_name)
+ endif((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL
"SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ unset(_target_type)
+ else(TARGET ${opt})
+ set(_scangobj_ldflags "${_scangobj_ldflags} ${opt}")
+ endif(TARGET ${opt})
+ endforeach(opt)
+
+ set(_scangobj_prefix ${CMAKE_COMMAND} -E env
LD_LIBRARY_PATH="${_scangobj_ld_lib_dirs}:${LIB_INSTALL_DIR}")
+
+ if(NOT (_scangobj_cflags STREQUAL ""))
+ set(_scangobj_cflags --cflags "${_scangobj_cflags}")
+ endif(NOT (_scangobj_cflags STREQUAL ""))
+
+ if(NOT (_scangobj_ldflags STREQUAL ""))
+ set(_scangobj_ldflags --ldflags "${_scangobj_ldflags}")
+ endif(NOT (_scangobj_ldflags STREQUAL ""))
+
add_custom_command(OUTPUT html/index.html
COMMAND ${GTKDOC_SCAN}
--module=${_module}
@@ -72,6 +152,11 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
--rebuild-types
${_srcdirs}
+ COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}" ${_scangobj_prefix}
${GTKDOC_SCANGOBJ}
+ --module=${_module}
+ ${_scangobj_cflags}
+ ${_scangobj_ldflags}
+
COMMAND ${GTKDOC_MKDB}
--module=${_module}
--name-space=${_namespace}
@@ -126,6 +211,11 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
--rebuild-types
${_srcdirs}
+ COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}" ${_scangobj_prefix}
${GTKDOC_SCANGOBJ}
+ --module=${_module}
+ ${_scangobj_cflags}
+ ${_scangobj_ldflags}
+
COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/tmp"
${GTKDOC_MKDB}
--module=${_module}
@@ -142,4 +232,10 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
add_dependencies(gtkdoc-rebuild-sgmls gtkdoc-rebuild-${_module}-sgml)
+ unset(_scangobj_prefix)
+ unset(_scangobj_deps)
+ unset(_scangobj_cflags_list)
+ unset(_scangobj_cflags)
+ unset(_scangobj_ldflags)
+ unset(_scangobj_ld_lib_dirs)
endmacro(add_gtkdoc)
diff --git a/docs/reference/CMakeLists.txt b/docs/reference/CMakeLists.txt
index cea870cb55..872529e026 100644
--- a/docs/reference/CMakeLists.txt
+++ b/docs/reference/CMakeLists.txt
@@ -1,5 +1,6 @@
-add_subdirectory(evolution-mail-composer)
+# In order as they are built, because GtkDoc requires them to be defined
+add_subdirectory(evolution-util)
add_subdirectory(evolution-mail-engine)
-add_subdirectory(evolution-mail-formatter)
add_subdirectory(evolution-shell)
-add_subdirectory(evolution-util)
+add_subdirectory(evolution-mail-formatter)
+add_subdirectory(evolution-mail-composer)
diff --git a/docs/reference/evolution-mail-composer/CMakeLists.txt
b/docs/reference/evolution-mail-composer/CMakeLists.txt
index 5598a91c7f..e82ab48825 100644
--- a/docs/reference/evolution-mail-composer/CMakeLists.txt
+++ b/docs/reference/evolution-mail-composer/CMakeLists.txt
@@ -15,4 +15,4 @@ set(IGNORE_HEADERS
e-composer-private.h
)
-add_gtkdoc(evolution-mail-composer composer "" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
+add_gtkdoc(evolution-mail-composer composer "EVO_DISABLE_DEPRECATED" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
diff --git a/docs/reference/evolution-mail-engine/CMakeLists.txt
b/docs/reference/evolution-mail-engine/CMakeLists.txt
index 83527b9b49..67f29d5e2a 100644
--- a/docs/reference/evolution-mail-engine/CMakeLists.txt
+++ b/docs/reference/evolution-mail-engine/CMakeLists.txt
@@ -11,4 +11,4 @@ set(IGNORE_HEADERS
e-mail-engine-enumtypes.h
)
-add_gtkdoc(evolution-mail-engine email-engine "" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
+add_gtkdoc(evolution-mail-engine email-engine "EVO_DISABLE_DEPRECATED" SOURCEDIRS DEPENDENCIES
IGNORE_HEADERS)
diff --git a/docs/reference/evolution-mail-formatter/CMakeLists.txt
b/docs/reference/evolution-mail-formatter/CMakeLists.txt
index 26bb0c09b0..e7bcd30699 100644
--- a/docs/reference/evolution-mail-formatter/CMakeLists.txt
+++ b/docs/reference/evolution-mail-formatter/CMakeLists.txt
@@ -11,4 +11,4 @@ set(IGNORE_HEADERS
e-mail-formatter-enumtypes.h
)
-add_gtkdoc(evolution-mail-formatter em-format "" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
+add_gtkdoc(evolution-mail-formatter em-format "EVO_DISABLE_DEPRECATED" SOURCEDIRS DEPENDENCIES
IGNORE_HEADERS)
diff --git a/docs/reference/evolution-shell/CMakeLists.txt b/docs/reference/evolution-shell/CMakeLists.txt
index 0ea7b2409e..903d834381 100644
--- a/docs/reference/evolution-shell/CMakeLists.txt
+++ b/docs/reference/evolution-shell/CMakeLists.txt
@@ -16,4 +16,4 @@ set(IGNORE_HEADERS
e-shell-enumtypes.h
)
-add_gtkdoc(evolution-shell shell "" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
+add_gtkdoc(evolution-shell shell "EVO_DISABLE_DEPRECATED" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
diff --git a/docs/reference/evolution-util/CMakeLists.txt b/docs/reference/evolution-util/CMakeLists.txt
index 355d2fd8a8..96b06a3654 100644
--- a/docs/reference/evolution-util/CMakeLists.txt
+++ b/docs/reference/evolution-util/CMakeLists.txt
@@ -46,4 +46,4 @@ set(IGNORE_HEADERS
test-keyfile-settings-backend.h
)
-add_gtkdoc(evolution-util e-util "" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
+add_gtkdoc(evolution-util e-util "EVO_DISABLE_DEPRECATED" SOURCEDIRS DEPENDENCIES IGNORE_HEADERS)
diff --git a/src/em-format/e-mail-formatter.c b/src/em-format/e-mail-formatter.c
index cc157d1dfa..2d3002098a 100644
--- a/src/em-format/e-mail-formatter.c
+++ b/src/em-format/e-mail-formatter.c
@@ -577,7 +577,9 @@ e_mail_formatter_base_init (EMailFormatterClass *class)
CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
shell = e_shell_get_default ();
- g_object_weak_ref (G_OBJECT (shell), shell_gone_cb, class);
+ /* It can be NULL when creating developer documentation */
+ if (shell)
+ g_object_weak_ref (G_OBJECT (shell), shell_gone_cb, class);
}
static void
diff --git a/src/em-format/e-mail-parser.c b/src/em-format/e-mail-parser.c
index c81bcc2aca..b601600ffa 100644
--- a/src/em-format/e-mail-parser.c
+++ b/src/em-format/e-mail-parser.c
@@ -332,7 +332,9 @@ e_mail_parser_base_init (EMailParserClass *class)
e_extensible_load_extensions (E_EXTENSIBLE (class->extension_registry));
shell = e_shell_get_default ();
- g_object_weak_ref (G_OBJECT (shell), shell_gone_cb, class);
+ /* It can be NULL when creating developer documentation */
+ if (shell)
+ g_object_weak_ref (G_OBJECT (shell), shell_gone_cb, class);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]