[CMake] [GTK] Add support for GObject introspection
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Dec 2013 18:44:31 +0000 (18:44 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Dec 2013 18:44:31 +0000 (18:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126162

Reviewed by Daniel Bates.

.:

* Source/PlatformGTK.cmake: Add a 'gir' target that builds all GIR files.
* Source/cmake/OptionsGTK.cmake: Add a macro for propagating typelib
targets to the Source level of the build.

Source/JavaScriptCore:

* PlatformGTK.cmake: Add the GIR targets.

Source/WebCore:

* PlatformGTK.cmake: Build a list of WebKitDOM headers and expose it to the
parent scope of the build.

Source/WebKit:

* PlatformGTK.cmake: Add the GIR targets.

Source/WebKit2:

* PlatformGTK.cmake: Add the GIR targets, split the installed headers list
between WebKitWebExtension and the WebKit2 library. Update the headers list
with new headers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161144 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/PlatformGTK.cmake
Source/PlatformGTK.cmake
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/cmake/OptionsGTK.cmake

index 3da8df6..82a6ceb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-12-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] [GTK] Add support for GObject introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126162
+
+        Reviewed by Daniel Bates.
+
+        * Source/PlatformGTK.cmake: Add a 'gir' target that builds all GIR files.
+        * Source/cmake/OptionsGTK.cmake: Add a macro for propagating typelib
+        targets to the Source level of the build.
+
 2013-12-29  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK][CMake] Translations must be built
index e56fe9b..a8ddada 100644 (file)
@@ -1,3 +1,12 @@
+2013-12-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] [GTK] Add support for GObject introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126162
+
+        Reviewed by Daniel Bates.
+
+        * PlatformGTK.cmake: Add the GIR targets.
+
 2013-12-28  Filip Pizlo  <fpizlo@apple.com>
 
         Get rid of DFG forward exiting
index d6d119f..1f46fce 100644 (file)
@@ -1,2 +1,10 @@
 configure_file(javascriptcoregtk.pc.in ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-3.0.pc @ONLY)
+configure_file(JavaScriptCore.gir.in ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir @ONLY)
 
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
+    COMMAND g-ir-compiler ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir -o ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib
+)
+
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib)
index 3e3c182..82c6b9e 100644 (file)
@@ -1,5 +1,8 @@
 add_subdirectory(${WEBCORE_DIR}/platform/gtk/po)
 
+# This allows exposing a 'gir' target which builds all GObject introspection files.
+add_custom_target(gir ALL DEPENDS ${GObjectIntrospectionTargets})
+
 if (ENABLE_API_TESTS)
     if (ENABLE_WEBKIT)
         add_subdirectory(${WEBKIT_DIR}/gtk/tests)
index 0eb13c5..aba5bc7 100644 (file)
@@ -1,3 +1,13 @@
+2013-12-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] [GTK] Add support for GObject introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126162
+
+        Reviewed by Daniel Bates.
+
+        * PlatformGTK.cmake: Build a list of WebKitDOM headers and expose it to the
+        parent scope of the build.
+
 2013-12-30  Andreas Kling  <akling@apple.com>
 
         Text::createTextRenderer() should return a RenderPtr.
index 5c09efe..f66980a 100644 (file)
@@ -445,22 +445,13 @@ if (ENABLE_WEBKIT2)
 
     list(APPEND GObjectDOMBindings_SOURCES
         bindings/gobject/ConvertToUTF8String.cpp
-        bindings/gobject/ConvertToUTF8String.h
         bindings/gobject/DOMObjectCache.cpp
-        bindings/gobject/DOMObjectCache.h
         bindings/gobject/GObjectEventListener.cpp
-        bindings/gobject/GObjectEventListener.h
         bindings/gobject/WebKitDOMCustom.cpp
-        bindings/gobject/WebKitDOMCustom.h
         bindings/gobject/WebKitDOMEventTarget.cpp
-        bindings/gobject/WebKitDOMEventTarget.h
-        bindings/gobject/WebKitDOMEventTargetPrivate.h
         bindings/gobject/WebKitDOMHTMLPrivate.cpp
-        bindings/gobject/WebKitDOMHTMLPrivate.h
         bindings/gobject/WebKitDOMObject.cpp
-        bindings/gobject/WebKitDOMObject.h
         bindings/gobject/WebKitDOMPrivate.cpp
-        bindings/gobject/WebKitDOMPrivate.h
         ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
         ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
     )
@@ -636,11 +627,22 @@ if (ENABLE_WEBKIT2)
         )
     endif ()
 
-    foreach (file Custom EventTarget Object Deprecated ${GObjectDOMBindings_IDL_FILES})
-        get_filename_component(file ${file} NAME_WE)
-        list(APPEND GObjectDOMBindings_CLASS_LIST ${file})
+    set(GObjectDOMBindings_CLASS_LIST Custom EventTarget Object Deprecated)
+    set(GObjectDOMBindings_INSTALLED_HEADERS
+         ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
+         ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
+         ${WEBCORE_DIR}/bindings/gobject/WebKitDOMCustom.h
+    )
+
+    foreach (file ${GObjectDOMBindings_IDL_FILES})
+        get_filename_component(classname ${file} NAME_WE)
+        list(APPEND GObjectDOMBindings_CLASS_LIST ${classname})
+        list(APPEND GObjectDOMBindings_INSTALLED_HEADERS ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/WebKitDOM${classname}.h)
     endforeach ()
 
+    # Propagate this variable to the parent scope, so that it can be used in other parts of the build.
+    set(GObjectDOMBindings_INSTALLED_HEADERS ${GObjectDOMBindings_INSTALLED_HEADERS} PARENT_SCOPE)
+
     set(GOBJECT_DOM_BINDINGS_FEATURES_DEFINES "LANGUAGE_GOBJECT=1 ${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}")
     string(REPLACE "ENABLE_INDEXED_DATABASE=1" "" GOBJECT_DOM_BINDINGS_FEATURES_DEFINES ${GOBJECT_DOM_BINDINGS_FEATURES_DEFINES})
     string(REPLACE REGEX "ENABLE_SVG[A-Z_]+=1" "" GOBJECT_DOM_BINDINGS_FEATURES_DEFINES ${GOBJECT_DOM_BINDINGS_FEATURES_DEFINES})
index 8ecd7c9..fbec853 100644 (file)
@@ -1,3 +1,12 @@
+2013-12-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] [GTK] Add support for GObject introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126162
+
+        Reviewed by Daniel Bates.
+
+        * PlatformGTK.cmake: Add the GIR targets.
+
 2013-12-29  Ryuan Choi  <ryuan.choi@samsung.com>
 
         [EFL] Remove ewk_view_tiled
index 2c6541c..f53a7b9 100644 (file)
@@ -95,7 +95,6 @@ list(APPEND WebKit_SOURCES
 list(APPEND WebKitGTK_INSTALLED_HEADERS
     ${WEBKIT_DIR}/gtk/webkit/webkit.h
     ${WEBKIT_DIR}/gtk/webkit/webkitapplicationcache.h
-    ${WEBKIT_DIR}/gtk/webkit/webkitauthenticationdialog.h
     ${WEBKIT_DIR}/gtk/webkit/webkitdefines.h
     ${WEBKIT_DIR}/gtk/webkit/webkitdom.h
     ${WEBKIT_DIR}/gtk/webkit/webkitdownload.h
@@ -111,7 +110,6 @@ list(APPEND WebKitGTK_INSTALLED_HEADERS
     ${WEBKIT_DIR}/gtk/webkit/webkitsecurityorigin.h
     ${WEBKIT_DIR}/gtk/webkit/webkitsoupauthdialog.h
     ${WEBKIT_DIR}/gtk/webkit/webkitspellchecker.h
-    ${WEBKIT_DIR}/gtk/webkit/webkitspellcheckerenchant.h
     ${WEBKIT_DIR}/gtk/webkit/webkitviewportattributes.h
     ${WEBKIT_DIR}/gtk/webkit/webkitwebbackforwardlist.h
     ${WEBKIT_DIR}/gtk/webkit/webkitwebdatabase.h
@@ -161,3 +159,50 @@ add_custom_command(
     COMMAND glib-mkenums --template ${WEBKIT_DIR}/gtk/webkit/webkitenumtypes.cpp.template ${WebKitGTK_INSTALLED_HEADERS} | sed s/web_kit/webkit/ > ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.cpp
     VERBATIM
 )
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+    DEPENDS WebKit
+    DEPENDS JavaScriptCore-3-gir
+    COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
+        g-ir-scanner
+        --quiet
+        --warn-all
+        --symbol-prefix=webkit
+        --identifier-prefix=WebKit
+        --namespace=WebKit
+        --nsversion=3.0
+        --include=GObject-2.0
+        --include=Gtk-3.0
+        --include=Soup-2.4
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
+        --library=webkitgtk-3.0
+        --library=javascriptcoregtk-3.0
+        -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+        --no-libtool
+        --pkg=gobject-2.0
+        --pkg=gtk+-3.0
+        --pkg=libsoup-2.4
+        --pkg-export=webkitgtk-3.0
+        --output=${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+        --c-include="webkit/webkit.h"
+        -DBUILDING_WEBKIT
+        -I${CMAKE_SOURCE_DIR}/Source
+        -I${WEBKIT_DIR}/gtk
+        -I${JAVASCRIPTCORE_DIR}/ForwardingHeaders
+        -I${DERIVED_SOURCES_DIR}
+        -I${DERIVED_SOURCES_WEBKITGTK_DIR}
+        -I${WEBCORE_DIR}/platform/gtk
+        ${GObjectDOMBindings_INSTALLED_HEADERS}
+        ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitenumtypes.h
+        ${WebKitGTK_INSTALLED_HEADERS}
+        ${WEBKIT_DIR}/gtk/webkit/*.cpp
+)
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-3.0.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+    COMMAND g-ir-compiler --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit-3.0.typelib
+)
+
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit-3.0.typelib)
index 7c25bfa..7f0d5f0 100644 (file)
@@ -1,3 +1,14 @@
+2013-12-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] [GTK] Add support for GObject introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126162
+
+        Reviewed by Daniel Bates.
+
+        * PlatformGTK.cmake: Add the GIR targets, split the installed headers list
+        between WebKitWebExtension and the WebKit2 library. Update the headers list
+        with new headers.
+
 2013-12-30  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
 
         [EFL][WK2] Replace ecore_main_loop_iterate with waitUntilTrue in ewk tests
index 6a75124..87ac510 100644 (file)
@@ -298,9 +298,11 @@ list(APPEND WebKit2_SOURCES
 )
 
 set(WebKit2_INSTALLED_HEADERS
+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitAuthenticationRequest.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitBackForwardList.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitBackForwardListItem.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitCertificateInfo.h
+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitCredential.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitContextMenu.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitContextMenuActions.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitContextMenuItem.h
@@ -338,19 +340,13 @@ set(WebKit2_INSTALLED_HEADERS
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitWebViewGroup.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitWindowProperties.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/webkit2.h
+)
 
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp
+set(WebKit2WebExtension_INSTALLED_HEADERS
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitFrame.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorldPrivate.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionPrivate.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h
-    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebPagePrivate.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h
 )
 
@@ -650,3 +646,100 @@ add_library(webkit2gtkinjectedbundle MODULE
     "${WEBKIT2_DIR}/WebProcess/gtk/WebGtkInjectedBundleMain.cpp"
 )
 add_dependencies(webkit2gtkinjectedbundle GObjectDOMBindings)
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+    DEPENDS WebKit2
+    DEPENDS JavaScriptCore-3-gir
+    COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
+        g-ir-scanner
+        --quiet
+        --warn-all
+        --symbol-prefix=webkit
+        --identifier-prefix=WebKit
+        --namespace=WebKit2
+        --nsversion=3.0
+        --include=GObject-2.0
+        --include=Gtk-3.0
+        --include=Soup-2.4
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
+        --library=webkit2gtk-3.0
+        --library=javascriptcoregtk-3.0
+        -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+        --no-libtool
+        --pkg=gobject-2.0
+        --pkg=gtk+-3.0
+        --pkg=libsoup-2.4
+        --pkg-export=webkit2gtk-3.0
+        --output=${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+        --c-include="webkit2/webkit2.h"
+        -DBUILDING_WEBKIT
+        -DWEBKIT2_COMPILATION
+        -I${CMAKE_SOURCE_DIR}/Source
+        -I${WEBKIT2_DIR}
+        -I${JAVASCRIPTCORE_DIR}/ForwardingHeaders
+        -I${DERIVED_SOURCES_DIR}
+        -I${DERIVED_SOURCES_WEBKIT2GTK_DIR}
+        -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+        ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.h
+        ${WebKit2_INSTALLED_HEADERS}
+        ${WEBKIT2_DIR}/UIProcess/API/gtk/*.cpp
+)
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+    DEPENDS JavaScriptCore-3-gir
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+    COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
+        g-ir-scanner
+        --quiet
+        --warn-all
+        --symbol-prefix=webkit
+        --identifier-prefix=WebKit
+        --namespace=WebKit2WebExtension
+        --nsversion=3.0
+        --include=GObject-2.0
+        --include=Gtk-3.0
+        --include=Soup-2.4
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
+        --include-uninstalled=${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+        --library=webkit2gtk-3.0
+        --library=javascriptcoregtk-3.0
+        -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+        --no-libtool
+        --pkg=gobject-2.0
+        --pkg=gtk+-3.0
+        --pkg=libsoup-2.4
+        --pkg-export=webkit2gtk-3.0
+        --output=${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+        --c-include="webkit2/webkit-web-extension.h"
+        -DBUILDING_WEBKIT
+        -DWEBKIT2_COMPILATION
+        -I${CMAKE_SOURCE_DIR}/Source
+        -I${WEBKIT2_DIR}
+        -I${JAVASCRIPTCORE_DIR}/ForwardingHeaders
+        -I${DERIVED_SOURCES_DIR}
+        -I${DERIVED_SOURCES_WEBKIT2GTK_DIR}
+        -I${FORWARDING_HEADERS_DIR}
+        -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+        -I${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}
+        -I${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk
+        ${GObjectDOMBindings_INSTALLED_HEADERS}
+        ${WebKit2WebExtension_INSTALLED_HEADERS}
+        ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/*.cpp
+)
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+    COMMAND g-ir-compiler --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib
+)
+
+add_custom_command(
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+    COMMAND g-ir-compiler --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib
+)
+
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib)
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib)
index d759ac7..e98bfe1 100644 (file)
@@ -215,3 +215,12 @@ set(DERIVED_SOURCES_WEBKIT2GTK_API_DIR ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/webkit2
 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
 set(FORWARDING_HEADERS_WEBKIT2GTK_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk)
 set(FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk-webextension)
+
+# Add a typelib file to the list of all typelib dependencies. This makes it easy to
+# expose a 'gir' target with all gobject-introspection files.
+macro(ADD_TYPELIB typelib)
+    get_filename_component(target_name ${typelib} NAME_WE)
+    add_custom_target(${target_name}-gir ALL DEPENDS ${typelib})
+    list(APPEND GObjectIntrospectionTargets ${target_name}-gir)
+    set(GObjectIntrospectionTargets ${GObjectIntrospectionTargets} PARENT_SCOPE)
+endmacro()