[GTK] [CMake] Improve the way we locate gobject-introspection
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Jan 2014 17:46:06 +0000 (17:46 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Jan 2014 17:46:06 +0000 (17:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126452

Reviewed by Philippe Normand.

.:

* Source/cmake/FindGObjectIntrospection.cmake: Added.
* Source/cmake/OptionsGTK.cmake: Load the new  FindGObjectIntrospection file.

Source/JavaScriptCore:

* PlatformGTK.cmake: Use the new introspection variables.

Source/WebKit:

* PlatformGTK.cmake: Use the new introspection variables.

Source/WebKit2:

* PlatformGTK.cmake: Use the new introspection variables.

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

ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/PlatformGTK.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/cmake/FindGObjectIntrospection.cmake [new file with mode: 0644]
Source/cmake/OptionsGTK.cmake

index 5510773..8d9bd32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2014-01-04  Martin Robinson  <mrobinson@igalia.com>
 
+        [GTK] [CMake] Improve the way we locate gobject-introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126452
+
+        Reviewed by Philippe Normand.
+
+        * Source/cmake/FindGObjectIntrospection.cmake: Added.
+        * Source/cmake/OptionsGTK.cmake: Load the new  FindGObjectIntrospection file.
+
+2014-01-04  Martin Robinson  <mrobinson@igalia.com>
+
         [GTK] [CMake] Fix the video and audio build
         https://bugs.webkit.org/show_bug.cgi?id=126464
 
index 0aeb0e9..91410c2 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-04  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Improve the way we locate gobject-introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126452
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Use the new introspection variables.
+
 2014-01-04  Zan Dobersek  <zdobersek@igalia.com>
 
         Explicitly use the std:: nested name specifier when using std::pair, std::make_pair
index 1f46fce..5f4146c 100644 (file)
@@ -4,7 +4,7 @@ configure_file(JavaScriptCore.gir.in ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
 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
+    COMMAND ${INTROSPECTION_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 2ed55a0..e6eb8b3 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-04  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Improve the way we locate gobject-introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126452
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Use the new introspection variables.
+
 2014-01-03  Simon Fraser  <simon.fraser@apple.com>
 
         Attempt to fix EFL build.
index f53a7b9..2d56b52 100644 (file)
@@ -165,7 +165,7 @@ add_custom_command(
     DEPENDS WebKit
     DEPENDS JavaScriptCore-3-gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
-        g-ir-scanner
+        ${INTROSPECTION_SCANNER}
         --quiet
         --warn-all
         --symbol-prefix=webkit
@@ -202,7 +202,7 @@ add_custom_command(
 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
+    COMMAND ${INTROSPECTION_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 641cb4a..fb656ca 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-04  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Improve the way we locate gobject-introspection
+        https://bugs.webkit.org/show_bug.cgi?id=126452
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Use the new introspection variables.
+
 2014-01-04  Zan Dobersek  <zdobersek@igalia.com>
 
         Explicitly use the std:: nested name specifier when using std::pair, std::make_pair
index 56dbc1f..1893d81 100644 (file)
@@ -651,7 +651,7 @@ add_custom_command(
     DEPENDS WebKit2
     DEPENDS JavaScriptCore-3-gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
-        g-ir-scanner
+        ${INTROSPECTION_SCANNER}
         --quiet
         --warn-all
         --symbol-prefix=webkit
@@ -690,7 +690,7 @@ add_custom_command(
     DEPENDS JavaScriptCore-3-gir
     DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
-        g-ir-scanner
+        ${INTROSPECTION_SCANNER}
         --quiet
         --warn-all
         --symbol-prefix=webkit
@@ -731,13 +731,13 @@ add_custom_command(
 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
+    COMMAND ${INTROSPECTION_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
+    COMMAND ${INTROSPECTION_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)
diff --git a/Source/cmake/FindGObjectIntrospection.cmake b/Source/cmake/FindGObjectIntrospection.cmake
new file mode 100644 (file)
index 0000000..08ec7b3
--- /dev/null
@@ -0,0 +1,63 @@
+# - Try to find gobject-introspection
+# Once done, this will define
+#
+#  INTROSPECTION_FOUND - system has gobject-introspection
+#  INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+#  INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+#  INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+#  INTROSPECTION_GIRDIR
+#  INTROSPECTION_TYPELIBDIR
+#  INTROSPECTION_CFLAGS
+#  INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname _extra_args)
+    execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} ${_extra_args} gobject-introspection-1.0
+        OUTPUT_VARIABLE _result
+        RESULT_VARIABLE _null
+    )
+
+    if (_null)
+    else ()
+        string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+        string(REGEX REPLACE " +$" ""  _result "${_result}")
+        separate_arguments(_result)
+        set(${_outvar} ${_result} CACHE INTERNAL "")
+    endif ()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+    if (PACKAGE_FIND_VERSION_COUNT GREATER 0)
+        set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+    endif ()
+    pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+    if (_pc_gir_FOUND)
+        set(INTROSPECTION_FOUND TRUE)
+        _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir" "")
+        _gir_get_pkgconfig_var(INTROSPECTION_INSTALL_GIRDIR "girdir" "--define-variable=prefix=${CMAKE_INSTALL_PREFIX}")
+        _gir_get_pkgconfig_var(INTROSPECTION_INSTALL_TYPELIBDIR "typelibdir" "--define-variable=prefix=${CMAKE_INSTALL_PREFIX}")
+        set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+        set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+    endif ()
+endif ()
+
+mark_as_advanced(
+    INTROSPECTION_SCANNER
+    INTROSPECTION_COMPILER
+    INTROSPECTION_GENERATE
+    INTROSPECTION_GIRDIR
+    INTROSPECTION_TYPELIBDIR
+    INTROSPECTION_CFLAGS
+    INTROSPECTION_LIBS
+    INTROSPECTION_INSTALL_GIRDIR
+    INTROSPECTION_INSTALL_TYPELIBDIR
+)
index 7dc5e80..59f6cea 100644 (file)
@@ -168,6 +168,7 @@ find_package(ATK REQUIRED)
 find_package(WebP REQUIRED)
 find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 find_package(ATSPI 2.5.3)
+find_package(GObjectIntrospection)
 
 # We don't use find_package for GLX because it is part of -lGL, unlike EGL.
 find_package(OpenGL)