Title: [161017] trunk
Revision
161017
Author
g...@gnome.org
Date
2013-12-23 14:01:12 -0800 (Mon, 23 Dec 2013)

Log Message

[GTK] [CMake] Add support for generating gtkdoc
https://bugs.webkit.org/show_bug.cgi?id=116376

Reviewed by Martin Robinson.

.:

* Source/PlatformGTK.cmake: Added. New custom target that depends on a custom command
which calls our generate-gtkdoc script. It uses a docs-build.stamp for simplicity,
like the autotools build.

Source/WebKit2:

* PlatformGTK.cmake: make generated API files go to DerivedSources/WebKit2, to
match the autotools build and gtkdoc.py's expectation.

Tools:

* gtk/common.py: look for files in the directories used by the cmake build as well.

Modified Paths

Diff

Modified: trunk/ChangeLog (161016 => 161017)


--- trunk/ChangeLog	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/ChangeLog	2013-12-23 22:01:12 UTC (rev 161017)
@@ -1,3 +1,14 @@
+2013-12-23  Gustavo Noronha Silva  <g...@gnome.org>
+
+        [GTK] [CMake] Add support for generating gtkdoc
+        https://bugs.webkit.org/show_bug.cgi?id=116376
+
+        Reviewed by Martin Robinson.
+
+        * Source/PlatformGTK.cmake: Added. New custom target that depends on a custom command
+        which calls our generate-gtkdoc script. It uses a docs-build.stamp for simplicity,
+        like the autotools build.
+
 2013-12-23  Martin Robinson  <mrobin...@igalia.com>
 
         [GTK] [CMake] Build the WebKit2 GObject API tests

Modified: trunk/Source/PlatformGTK.cmake (161016 => 161017)


--- trunk/Source/PlatformGTK.cmake	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Source/PlatformGTK.cmake	2013-12-23 22:01:12 UTC (rev 161017)
@@ -1,7 +1,40 @@
+set(DocumentationDependencies
+    "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitenvironment.xml"
+)
+
 if (ENABLE_WEBKIT)
-    add_subdirectory(${WEBKIT_DIR}/gtk/tests)
+    list(APPEND DocumentationDependencies
+        WebKit
+        "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-docs.sgml"
+        "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-sections.txt"
+    )
 endif ()
 
 if (ENABLE_WEBKIT2)
-    add_subdirectory(${WEBKIT2_DIR}/UIProcess/API/gtk/tests)
+    list(APPEND DocumentationDependencies
+        WebKit2
+        "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml"
+        "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt"
+    )
 endif ()
+
+add_custom_command(
+    OUTPUT docs-build.stamp
+    DEPENDS ${DocumentationDependencies}
+    COMMAND CC="${CMAKE_C_COMPILER}" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc
+    COMMAND touch docs-build.stamp
+    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+add_custom_target(fake-docs-target ALL
+    DEPENDS docs-build.stamp
+)
+
+if (ENABLE_WEBKIT)
+    add_dependencies(fake-docs-target WebKit)
+endif ()
+
+if (ENABLE_WEBKIT2)
+    add_dependencies(fake-docs-target WebKit2)
+endif ()
+

Modified: trunk/Source/WebKit2/ChangeLog (161016 => 161017)


--- trunk/Source/WebKit2/ChangeLog	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-23 22:01:12 UTC (rev 161017)
@@ -1,3 +1,13 @@
+2013-12-23  Gustavo Noronha Silva  <g...@gnome.org>
+
+        [GTK] [CMake] Add support for generating gtkdoc
+        https://bugs.webkit.org/show_bug.cgi?id=116376
+
+        Reviewed by Martin Robinson.
+
+        * PlatformGTK.cmake: make generated API files go to DerivedSources/WebKit2, to
+        match the autotools build and gtkdoc.py's expectation.
+
 2013-12-23  Martin Robinson  <mrobin...@igalia.com>
 
         [GTK] [CMake] Build the WebKit2 GObject API tests

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (161016 => 161017)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2013-12-23 22:01:12 UTC (rev 161017)
@@ -1,5 +1,5 @@
 set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom)
-set(DERIVED_SOURCES_WEBKIT2GTK_DIR ${DERIVED_SOURCES_DIR}/webkit2gtk)
+set(DERIVED_SOURCES_WEBKIT2GTK_DIR ${DERIVED_SOURCES_DIR}/WebKit2/webkit2gtk)
 set(WEBKIT2_BUILT_API_DIR ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/webkit2)
 set(WEBKIT2_FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders/webkit2gtk)
 

Modified: trunk/Tools/ChangeLog (161016 => 161017)


--- trunk/Tools/ChangeLog	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Tools/ChangeLog	2013-12-23 22:01:12 UTC (rev 161017)
@@ -1,3 +1,12 @@
+2013-12-23  Gustavo Noronha Silva  <g...@gnome.org>
+
+        [GTK] [CMake] Add support for generating gtkdoc
+        https://bugs.webkit.org/show_bug.cgi?id=116376
+
+        Reviewed by Martin Robinson.
+
+        * gtk/common.py: look for files in the directories used by the cmake build as well.
+
 2013-12-23  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Build with network process unconditionally

Modified: trunk/Tools/gtk/common.py (161016 => 161017)


--- trunk/Tools/gtk/common.py	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Tools/gtk/common.py	2013-12-23 22:01:12 UTC (rev 161017)
@@ -23,8 +23,32 @@
 
 script_dir = None
 build_dir = None
+library_build_dir = None
+is_cmake = None
 
 
+def is_cmake_build():
+    global is_cmake
+
+    if is_cmake is None:
+        if build_path('CMakeCache.txt'):
+            is_cmake = True
+        else:
+            is_cmake = False
+
+    return is_cmake
+
+
+def library_build_path(*args):
+    global library_build_dir
+    if not library_build_dir:
+        if is_cmake_build():
+            library_build_dir = build_path('lib', *args)
+        else:
+            library_build_dir = build_path('.libs', *args)
+    return library_build_dir
+
+
 def script_path(*args):
     global script_dir
     if not script_dir:
@@ -43,7 +67,11 @@
 
     def is_valid_build_directory(path):
         return os.path.exists(os.path.join(path, 'GNUmakefile')) or \
-            os.path.exists(os.path.join(path, 'Programs', 'DumpRenderTree'))
+            os.path.exists(os.path.join(path, 'Programs', 'GtkLauncher')) or \
+            os.path.exists(os.path.join(path, 'Programs', 'MiniBrowser')) or \
+            os.path.exists(os.path.join(path, 'CMakeCache.txt')) or \
+            os.path.exists(os.path.join(path, 'bin/GtkLauncher')) or \
+            os.path.exists(os.path.join(path, 'bin/MiniBrowser'))
 
     if len(sys.argv[1:]) > 1 and os.path.exists(sys.argv[-1]) and is_valid_build_directory(sys.argv[-1]):
         return sys.argv[-1]

Modified: trunk/Tools/gtk/generate-gtkdoc (161016 => 161017)


--- trunk/Tools/gtk/generate-gtkdoc	2013-12-23 21:49:43 UTC (rev 161016)
+++ trunk/Tools/gtk/generate-gtkdoc	2013-12-23 22:01:12 UTC (rev 161017)
@@ -61,7 +61,7 @@
     return {
         'decorator': 'WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\(.+\)',
         'deprecation_guard': 'WEBKIT_DISABLE_DEPRECATED',
-        'library_path' : common.build_path('.libs'),
+        'library_path' : common.library_build_path(),
         'virtual_root' : virtual_root,
     }
 
@@ -120,6 +120,12 @@
     def src_path(*args):
         return common.top_level_path(*(('Source', 'WebKit', 'gtk') + args))
 
+    def webkitversionh_path():
+        if common.is_cmake_build():
+            return common.build_path('DerivedSources', 'webkit')
+        else:
+            return common.build_path('Source', 'WebKit', 'gtk', 'webkit')
+
     xref_deps = get_common_xref_deps().copy()
     if gtk_version == 3:
         xref_deps.update({
@@ -136,7 +142,7 @@
         'namespace' : 'webkit',
         'doc_dir' : src_path('docs'),
         'output_dir' : common.build_path('Documentation', 'webkitgtk'),
-        'source_dirs' : [src_path('webkit'), common.build_path('Source', 'WebKit', 'gtk', 'webkit')],
+        'source_dirs' : [src_path('webkit'), webkitversionh_path()],
         'cflags' : ' -I' + common.build_path('WebKit', 'gtk') + \
                    ' -I' + common.build_path('DerivedSources') + \
                    ' -I' + src_path() + \
@@ -216,17 +222,20 @@
     pkg_config_path = wk2_pkg_config_path
 elif os.path.exists(wk1_pkg_config_path):
     pkg_config_path = wk1_pkg_config_path
-generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkitdom_options())
-if '--rebase' not in sys.argv:
-    print("\nGenerating WebKitDOM documentation...")
-    saw_webkitdom_warnings = generate_doc(generator)
-else:
-    print("\nRebasing WebKitDOM documentation...")
-    try:
-        generator.rebase_installed_docs()
-    except Exception:
-        print("Rebase did not happen, likely no documentation is present.")
 
+webkitdom_docs_path = common.build_path('DerivedSources', 'webkitdom', 'docs')
+if not common.is_cmake_build():
+    generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkitdom_options())
+    if '--rebase' not in sys.argv:
+        print("\nGenerating WebKitDOM documentation...")
+        saw_webkitdom_warnings = generate_doc(generator)
+    else:
+        print("\nRebasing WebKitDOM documentation...")
+        try:
+            generator.rebase_installed_docs()
+        except Exception:
+            print("Rebase did not happen, likely no documentation is present.")
+
 pkg_config_path = wk1_pkg_config_path
 if os.path.exists(pkg_config_path):
     options = get_webkit1_options(common.gtk_version_of_pkg_config_file(pkg_config_path))
@@ -255,4 +264,7 @@
         except Exception:
             print("Rebase did not happen, likely no documentation is present.")
 
-sys.exit(saw_webkit1_warnings or saw_webkit2_warnings)
+# For CMake we are still generating warnings because we lack DOM bindings docs,
+# so do not cause the build to fail for now.
+if not common.is_cmake_build():
+    sys.exit(saw_webkit1_warnings or saw_webkit2_warnings)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to