[CMake] Autogenerate cmakeconfig.h.cmake
[WebKit-https.git] / Source / cmake / OptionsGTK.cmake
index 34357a4..9920078 100644 (file)
@@ -135,6 +135,8 @@ else ()
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC OFF)
 endif ()
 
+# FIXME: There is no reason these should be different.
+SET_AND_EXPOSE_TO_BUILD(DEVELOPMENT_BUILD ${DEVELOPER_MODE})
 if (DEVELOPER_MODE)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC ON)
@@ -198,6 +200,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_QUOTA PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOLUTION_MEDIA_QUERY PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REQUEST_ANIMATION_FRAME PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SECCOMP_FILTERS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEMPLATE_ELEMENT PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
@@ -210,34 +213,20 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_PROCESS PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THREADED_COMPOSITOR PRIVATE OFF)
 WEBKIT_OPTION_END()
 
-if (LIBNOTIFY_FOUND)
-    add_definitions(-DWTF_USE_LIBNOTIFY=1)
-else ()
-    add_definitions(-DWTF_USE_LIBNOTIFY=0)
-endif ()
-
 if (ENABLE_PLUGIN_PROCESS_GTK2)
     find_package(GTK2 2.24.10 REQUIRED)
     find_package(GDK2 2.24.10 REQUIRED)
-    add_definitions(-DENABLE_PLUGIN_PROCESS_GTK2=1)
 endif ()
 
-if (ENABLE_X11_TARGET)
-    add_definitions(-DWTF_PLATFORM_X11=1)
-    add_definitions(-DMOZ_X11=1)
-    if (WTF_OS_UNIX)
-        add_definitions(-DXP_UNIX)
-    endif ()
-endif ()
-
-if (ENABLE_WAYLAND_TARGET)
-    add_definitions(-DWTF_PLATFORM_WAYLAND=1)
-endif ()
+SET_AND_EXPOSE_TO_BUILD(WTF_USE_LIBNOTIFY ${LIBNOTIFY_FOUND})
+SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_X11 ${ENABLE_X11_TARGET})
+SET_AND_EXPOSE_TO_BUILD(MOZ_X11 ${ENABLE_X11_TARGET})
+SET_AND_EXPOSE_TO_BUILD(XP_UNIX ${WTF_OS_UNIX})
+SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_WAYLAND ${ENABLE_WAYLAND_TARGET})
 
 set(ENABLE_WEBKIT OFF)
 set(ENABLE_WEBKIT2 ON)
 set(ENABLE_PLUGIN_PROCESS ON)
-set(ENABLE_SMOOTH_SCROLLING ON)
 
 set(GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_6)
 set(GTK_API_VERSION 3.0)
@@ -263,27 +252,22 @@ add_definitions(-DUSER_AGENT_GTK_MAJOR_VERSION=601)
 add_definitions(-DUSER_AGENT_GTK_MINOR_VERSION=1)
 add_definitions(-DWEBKITGTK_API_VERSION_STRING="${WEBKITGTK_API_VERSION}")
 
-if (DEVELOPER_MODE)
-    add_definitions(-DDEVELOPMENT_BUILD=1)
-endif ()
-
 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
     set(GSTREAMER_COMPONENTS app pbutils)
-    add_definitions(-DWTF_USE_GSTREAMER)
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_GSTREAMER TRUE)
     if (ENABLE_VIDEO)
         list(APPEND GSTREAMER_COMPONENTS video mpegts tag gl)
     endif ()
 
     if (ENABLE_WEB_AUDIO)
         list(APPEND GSTREAMER_COMPONENTS audio fft)
-        add_definitions(-DWTF_USE_WEBAUDIO_GSTREAMER)
+        SET_AND_EXPOSE_TO_BUILD(WTF_USE_WEBAUDIO_GSTREAMER TRUE)
     endif ()
 
     find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 
     if (PC_GSTREAMER_MPEGTS_FOUND)
-        add_definitions(-DWTF_USE_GSTREAMER_MPEGTS)
-        set(USE_GSTREAMER_MPEGTS TRUE)
+        SET_AND_EXPOSE_TO_BUILD(WTF_USE_GSTREAMER_MPEGTS TRUE)
     endif ()
 endif ()
 
@@ -307,32 +291,22 @@ endif ()
 find_package(GLIB 2.33.2 REQUIRED COMPONENTS ${glib_components})
 
 if (ENABLE_GEOLOCATION)
-    if (GEOCLUE2_FOUND)
-      set(WTF_USE_GEOCLUE2 1)
-    else ()
-      set(WTF_USE_GEOCLUE2 0)
-    endif ()
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_GEOCLUE2 ${GEOCLUE2_FOUND})
 endif ()
 
 if (ENABLE_MEDIA_STREAM)
     find_package(OpenWebRTC)
-    if (OPENWEBRTC_FOUND)
-        add_definitions(-DWTF_USE_OPENWEBRTC)
-    endif ()
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_OPENWEBRTC ${OPENWEBRTC_FOUND})
 endif ()
 
 find_package(GTKUnixPrint)
-if (GTK_UNIX_PRINT_FOUND)
-    set(HAVE_GTK_UNIX_PRINTING 1)
-endif ()
+SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTK_UNIX_PRINT_FOUND})
 
 if (ENABLE_CREDENTIAL_STORAGE)
     find_package(Libsecret REQUIRED)
 endif ()
 
-if (GTK_SUPPORTS_GESTURES)
-    add_definitions(-DHAVE_GTK_GESTURES=1)
-endif ()
+SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_GESTURES ${GTK_SUPPORTS_GESTURES})
 
 # This part can be simplified once CMake 2.8.6 is required and
 # CMakePushCheckState can be used. We need to have OPENGL_INCLUDE_DIR as part
@@ -342,14 +316,6 @@ if (ENABLE_X11_TARGET)
     set(REQUIRED_INCLUDES_OLD ${CMAKE_REQUIRED_INCLUDES})
     set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
     set(CMAKE_REQUIRED_INCLUDES ${REQUIRED_INCLUDES_OLD})
-
-    if (GLX_FOUND)
-        set(WTF_USE_GLX 1)
-    endif ()
-endif ()
-
-if (EGL_FOUND)
-    set(WTF_USE_EGL 1)
 endif ()
 
 if (ENABLE_SPELLCHECK)
@@ -358,43 +324,30 @@ endif ()
 
 if ((OPENGL_FOUND OR OPENGLES2_FOUND) AND (GLX_FOUND OR EGL_FOUND))
     set(ENABLE_TEXTURE_MAPPER 1)
-    set(WTF_USE_3D_GRAPHICS 1)
 
-    add_definitions(-DWTF_USE_3D_GRAPHICS=1)
-    add_definitions(-DWTF_USE_TEXTURE_MAPPER=1)
-    add_definitions(-DWTF_USE_TEXTURE_MAPPER_GL=1)
-    add_definitions(-DENABLE_3D_RENDERING=1)
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_3D_GRAPHICS TRUE)
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_TEXTURE_MAPPER TRUE)
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_TEXTURE_MAPPER_GL TRUE)
+    set(ENABLE_3D_RENDERING ON) # This is already exposed by WEBKIT_OPTION_DEFINE.
 
     if (ENABLE_X11_TARGET AND USE_REDIRECTED_XCOMPOSITE_WINDOW)
         add_definitions(-DWTF_USE_REDIRECTED_XCOMPOSITE_WINDOW=1)
     endif ()
 
     if (OPENGLES2_FOUND)
-        set(WTF_USE_OPENGL_ES_2 1)
-        add_definitions(-DWTF_USE_OPENGL_ES_2=1)
+        SET_AND_EXPOSE_TO_BUILD(WTF_USE_OPENGL_ES_2 TRUE)
     else ()
-        set(WTF_USE_OPENGL 1)
-        add_definitions(-DWTF_USE_OPENGL=1)
-    endif ()
-
-    if (EGL_FOUND)
-        add_definitions(-DWTF_USE_EGL=1)
+        SET_AND_EXPOSE_TO_BUILD(WTF_USE_OPENGL TRUE)
     endif ()
 
-    if (GLX_FOUND)
-        add_definitions(-DWTF_USE_GLX=1)
-    endif ()
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_EGL ${EGL_FOUND})
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_GLX ${GLX_FOUND})
 
-    if (ENABLE_THREADED_COMPOSITOR)
-        add_definitions(-DWTF_USE_TILED_BACKING_STORE=1)
-        add_definitions(-DWTF_USE_COORDINATED_GRAPHICS=1)
-        add_definitions(-DWTF_USE_COORDINATED_GRAPHICS_THREADED=1)
-    endif ()
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_TILED_BACKING_STORE ${ENABLE_THREADED_COMPOSITOR})
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_COORDINATED_GRAPHICS ${ENABLE_THREADED_COMPOSITOR})
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_COORDINATED_GRAPHICS_THREADED ${ENABLE_THREADED_COMPOSITOR})
 
-    if (PC_GSTREAMER_GL_FOUND)
-        add_definitions(-DWTF_USE_GSTREAMER_GL)
-        set(USE_GSTREAMER_GL TRUE)
-    endif ()
+    SET_AND_EXPOSE_TO_BUILD(WTF_USE_GSTREAMER_GL ${PC_GSTREAMER_GL_FOUND})
 endif ()
 
 if (ENABLE_GAMEPAD_DEPRECATED)
@@ -403,7 +356,7 @@ endif ()
 
 if (ENABLE_FTL_JIT)
     find_package(LLVM REQUIRED)
-    set(HAVE_LLVM ON)
+    SET_AND_EXPOSE_TO_BUILD(HAVE_LLVM TRUE)
 endif ()
 
 set(CPACK_SOURCE_GENERATOR TBZ2)