[CMake] Share build system options across ports
[WebKit-https.git] / Source / cmake / WebKitFeatures.cmake
index bca17d2..aec3dcc 100644 (file)
-SET(DEFAULT 0)
-SET(DEPENDS 1)
-SET(ALWAYS 2)
+SET(_WEBKIT_AVAILABLE_OPTIONS "")
 
-SET(WEBKIT_FEATURES "")
+MACRO (WEBKIT_OPTION_DEFINE _name _description _initialvalue)
+    SET(_WEBKIT_AVAILABLE_OPTIONS_INITALVALUE_${_name} ${_initialvalue})
+    SET(_WEBKIT_AVAILABLE_OPTIONS_DESCRIPTION_${_name} ${_description})
+    LIST(APPEND _WEBKIT_AVAILABLE_OPTIONS ${_name})
+ENDMACRO ()
 
+MACRO (WEBKIT_OPTION_DEFAULT_PORT_VALUE _name _value)
+    SET(_WEBKIT_AVAILABLE_OPTIONS_INITALVALUE_${_name} ${_value})
+ENDMACRO ()
 
-MACRO(WEBKIT_FEATURE_CHECK_DEPS _deps _deps_ok)
-        SET(${_deps_ok} TRUE)
+MACRO (WEBKIT_OPTION_BEGIN)
+    WEBKIT_OPTION_DEFINE(ENABLE_3D_RENDERING "Toggle 3D rendering support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_ACCELERATED_2D_CANVAS "Toggle accelerated 2D canvas support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_ANIMATION_API "Toggle animation API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_ASSEMBLER_WX_EXCLUSIVE "Toggel Assembler WX Exclusive support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_BATTERY_STATUS "Toggle battery status API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_BLOB "Toggle Blob support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_CHANNEL_MESSAGING "Toggle MessageChannel and MessagePort support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_CSS_FILTERS "Toggle CSS Filters support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_CSS_GRID_LAYOUT "Toggle CSS Grid Layout support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_CSS_SHADERS "Toggle CSS Shaders (within CSS Filters) support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DATALIST "Toggle HTML5 datalist support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DATA_TRANSFER_ITEMS "Toggle HTML5 data transfer items support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DETAILS "Toggle HTML5 details support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_DEVICE_ORIENTATION "Toggle DeviceOrientation support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DIRECTORY_UPLOAD "Toogle Directory upload support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DOWNLOAD_ATTRIBUTE "Toggle download attribute support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_DRAG_SUPPORT "Toggle Drag Support" DEFAULT OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_FAST_MOBILE_SCROLLING "Toogle Fast Mobile Scrolling support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_FILE_SYSTEM "Toggle FileSystem support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_FILTERS "Toggle SVG Filters support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_FTPDIR "Toggle FTP directory support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_FULLSCREEN_API "Toggle Fullscreen API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_GAMEPAD "Toggle Gamepad support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_GEOLOCATION "Toggle Geolocation support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_GLIB_SUPPORT "Toggle Glib support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_HIGH_DPI_CANVAS "Toggle high-DPI canvas backing store support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_ICONDATABASE "Toggle Icon database support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING "Toggle image decoder down sampling support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INDEXED_DATABASE "Toggle Indexed Database API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_COLOR "Toggle Color Input support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_SPEECH "Toggle Speech Input API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATE "Toggle date type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATETIME "Toggle datetime type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATETIMELOCAL "Toggle datetime-local type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_MONTH "Toggle month type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_TIME "Toggle time type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_WEEK "Toggle week type <input> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_INSPECTOR "Toggle Web Inspector support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_JAVASCRIPT_DEBUGGER "Toggle JavaScript Debugger/Profiler support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_JIT "Enable JustInTime javascript support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_NOTIFICATIONS "Toggle Legacy Desktop Notifications Support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_LINK_PREFETCH "Toggle pre fetching support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_MATHML "Toggle MathML support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SOURCE "Toggle Media Source support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STATISTICS "Toggle Media Statistics support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STREAM "Toggle Media Stream API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_METER_TAG "Toggle Meter Tag support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_MHTML "Toggle MHTML support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_MICRODATA "Toggle Microdata support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_MUTATION_OBSERVERS "Toggle DOM mutation observer support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_NETSCAPE_PLUGIN_API "Toggle Netscape Plugin support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_NETWORK_INFO "Toggle Network Information API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_NOTIFICATIONS "Toggle Desktop Notifications Support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_ORIENTATION_EVENTS "Toggle Orientation Events support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_PAGE_VISIBILITY_API "Toggle Page Visibility API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_PROGRESS_TAG "Toggle Progress Tag support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_PLUGIN_PROXY_FOR_VIDEO "Toggle Plugin Proxy for Video support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_QUOTA "Toggle Quota support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_REGISTER_PROTOCOL_HANDLER "Toggle Register Protocol Handler support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_REPAINT_THROTTLING "Toggle repaint throttling support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_REQUEST_ANIMATION_FRAME "Toggle requestAnimationFrame support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SCRIPTED_SPEECH "Toggle Scripted Speech API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SHADOW_DOM "Toggle Shadow DOM support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SHARED_WORKERS "Toggle SharedWorkers support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SQL_DATABASE "Toggle SQL Database Support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_STYLE_SCOPED "Toggle <style scoped> support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SVG "Toggle SVG support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_SVG_DOM_OBJC_BINDINGS "Toggle SVG DOM Objective-C bindings support (implies SVG support)" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_SVG_FONTS "Toggle SVG fonts support (imples SVG support)" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_EVENTS "Toggle Touch Events support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_ICON_LOADING "Toggle Touch Icon Loading Support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_VIBRATION "Toggle Vibration API support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_VIDEO "Toggle Video support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_WEBGL "Toggle 3D canvas (WebGL) support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_WEB_AUDIO "Toggle Web Audio support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_WEB_SOCKETS "Toggle Web Sockets support" ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_WEB_TIMING "Toggle Web Timing support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_WORKERS "Toggle Web Workers support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_XSLT "Toggle XSLT support" ON)
+    WEBKIT_OPTION_DEFINE(USE_SYSTEM_MALLOC "Toggle system allocator instead of TCmalloc" OFF)
+    WEBKIT_OPTION_DEFINE(USE_TILED_BACKING_STORE "Toggle Tiled Backing Store support" OFF)
+    WEBKIT_OPTION_DEFINE(USE_WTFURL "Toogle the use of WTFURL for URL parsing" OFF)
+ENDMACRO ()
 
-       LIST(LENGTH ${_deps} ${_deps_ok}_LIST_SIZE)
-       IF (${${_deps_ok}_LIST_SIZE} GREATER 1)
-               FOREACH(_dep ${${_deps}})
-                       IF (NOT ${_dep})
-                               SET(${_deps_ok} FALSE)
-                               BREAK()
-                       ENDIF ()
-               ENDFOREACH ()
-       ELSE ()
-               IF (NOT ${_deps})
-                       SET(${_deps_ok} FALSE)
-               ENDIF ()
-       ENDIF ()
-ENDMACRO()
+MACRO (WEBKIT_OPTION_END)
+    FOREACH (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+        OPTION(${_name} "${_WEBKIT_AVAILABLE_OPTIONS_DESCRIPTION_${_name}}" ${_WEBKIT_AVAILABLE_OPTIONS_INITALVALUE_${_name}})
+    ENDFOREACH ()
 
-MACRO(WEBKIT_FEATURE _feature _description _type _args)
-       IF (${_type} EQUAL ${DEPENDS})
-                WEBKIT_FEATURE_CHECK_DEPS(${_args} DEPS_OK_${_feature})
-               OPTION(${_feature} "${_description}" DEPS_OK_${_feature})
-       ELSEIF (${_type} EQUAL ${DEFAULT})
-               OPTION(${_feature} "${_description}" ${_args})
-       ELSEIF (${_type} EQUAL ${ALWAYS})
-               SET(${_feature} ${_args})
-       ENDIF ()
 
-       LIST(APPEND WEBKIT_FEATURES ${_feature})
+    MESSAGE(STATUS "Enabled features:")
 
-       IF (${_feature})
-               LIST(APPEND FEATURE_DEFINES ${_feature})
-       ENDIF ()
-ENDMACRO()
+    SET(_MAX_FEATURE_LENGTH 0)
+    FOREACH (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+        STRING(LENGTH ${_name} _NAME_LENGTH)
+        IF (_NAME_LENGTH GREATER _MAX_FEATURE_LENGTH)
+            SET(_MAX_FEATURE_LENGTH ${_NAME_LENGTH})
+        ENDIF ()
+    ENDFOREACH ()
 
-MACRO(WEBKIT_PRINT_FEATURES)
-       MESSAGE(STATUS "Enabled features:")
+    SET(_SHOULD_PRINT_POINTS OFF)
+    FOREACH (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+        STRING(LENGTH ${_name} _NAME_LENGTH)
 
-       SET(MAX_FEATURE_LENGTH 0)
-       FOREACH (_feature ${WEBKIT_FEATURES})
-               STRING(LENGTH ${_feature} FEATURE_LENGTH)
-               IF (FEATURE_LENGTH GREATER MAX_FEATURE_LENGTH)
-                       SET(MAX_FEATURE_LENGTH ${FEATURE_LENGTH})
-               ENDIF ()
-       ENDFOREACH ()
+        SET(_MESSAGE " ${_name} ")
 
-       SET(ODD 0)
-       FOREACH (_feature ${WEBKIT_FEATURES})
-               STRING(LENGTH ${_feature} FEATURE_LENGTH)
-               SET(SPACES "")
+        IF (_SHOULD_PRINT_POINTS)
+            FOREACH (IGNORE RANGE ${_NAME_LENGTH} ${_MAX_FEATURE_LENGTH})
+                SET(_MESSAGE "${_MESSAGE} ")
+            ENDFOREACH ()
+            SET(_SHOULD_PRINT_POINTS OFF)
+        ELSE ()
+            FOREACH (IGNORE RANGE ${_NAME_LENGTH} ${_MAX_FEATURE_LENGTH})
+                SET(_MESSAGE "${_MESSAGE}.")
+            ENDFOREACH ()
+            SET(_SHOULD_PRINT_POINTS ON)
+        ENDIF ()
 
-               IF (ODD)
-                       FOREACH (IGNORE RANGE ${FEATURE_LENGTH} ${MAX_FEATURE_LENGTH})
-                               SET(SPACES "${SPACES} ")
-                       ENDFOREACH ()
-                       SET(ODD 0)
-               ELSE ()
-                       FOREACH (IGNORE RANGE ${FEATURE_LENGTH} ${MAX_FEATURE_LENGTH})
-                               SET(SPACES "${SPACES}.")
-                       ENDFOREACH ()
-                       SET(ODD 1)
-               ENDIF ()
+        IF (${_name})
+            LIST(APPEND FEATURE_DEFINES ${_name})
+            SET(_MESSAGE "${_MESSAGE} ON")
+        ELSE ()
+            SET(_MESSAGE "${_MESSAGE} OFF")
+        ENDIF ()
 
-               IF (${_feature})
-                       MESSAGE(STATUS "  ${_feature} ${SPACES} ON")
-               ELSE ()
-                       MESSAGE(STATUS "  ${_feature} ${SPACES} OFF")
-               ENDIF ()
-       ENDFOREACH ()
-
-       UNSET(FEATURE_LENGTH)
-       UNSET(MAX_FEATURE_LENGTH)
-       UNSET(ODD)
-ENDMACRO()
+        MESSAGE(STATUS "${_MESSAGE}")
+    ENDFOREACH ()
+ENDMACRO ()