AX: Implement AutoFill Available attribute for a text field
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2 project(WebKit)
3
4 # This should be removed once we require CMake 3.3.
5 if (POLICY CMP0058)
6     cmake_policy(SET CMP0058 NEW)
7 endif ()
8
9 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
10
11 set(ENABLE_WEBCORE ON)
12
13 if (NOT DEFINED ENABLE_WEBKIT)
14     set(ENABLE_WEBKIT ON)
15 endif ()
16
17 if (NOT DEFINED ENABLE_TOOLS AND EXISTS "${CMAKE_SOURCE_DIR}/Tools")
18     set(ENABLE_TOOLS ON)
19 endif ()
20
21 # -----------------------------------------------------------------------------
22 # Determine which port will be built
23 # -----------------------------------------------------------------------------
24 set(ALL_PORTS
25     AppleWin
26     Efl
27     GTK
28     JSCOnly
29     Mac
30     WinCairo
31 )
32 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
33
34 list(FIND ALL_PORTS ${PORT} RET)
35 if (${RET} EQUAL -1)
36     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
37 endif ()
38
39 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
40
41 # -----------------------------------------------------------------------------
42 # Determine the target processor
43 # -----------------------------------------------------------------------------
44 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
45 # since the later one just resolves to the host processor on Windows.
46 if (MSVC_CXX_ARCHITECTURE_ID)
47     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
48 else ()
49     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
50 endif ()
51 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
52     set(WTF_CPU_ARM 1)
53 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
54     set(WTF_CPU_ARM64 1)
55 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
56     set(WTF_CPU_MIPS 1)
57 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
58     set(WTF_CPU_SH4 1)
59 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
60     set(WTF_CPU_X86_64 1)
61 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
62     set(WTF_CPU_X86 1)
63 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")
64     set(WTF_CPU_PPC 1)
65 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
66     set(WTF_CPU_PPC64 1)
67 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
68     set(WTF_CPU_PPC64LE 1)
69 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "parisc*")
70     set(WTF_CPU_HPPA 1)
71 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
72     set(WTF_CPU_S390 1)
73 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
74     set(WTF_CPU_S390X 1)
75 else ()
76     message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
77 endif ()
78
79 # -----------------------------------------------------------------------------
80 # Determine the operating system
81 # -----------------------------------------------------------------------------
82 if (UNIX)
83     if (APPLE)
84         set(WTF_OS_MAC_OS_X 1)
85     else ()
86         set(WTF_OS_UNIX 1)
87     endif ()
88 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
89     set(WTF_OS_WINDOWS 1)
90 else ()
91     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
92 endif ()
93
94 # -----------------------------------------------------------------------------
95 # Default library types
96 # -----------------------------------------------------------------------------
97 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
98
99 if (SHARED_CORE)
100     set(JavaScriptCore_LIBRARY_TYPE SHARED)
101     set(WebCore_LIBRARY_TYPE SHARED)
102 else ()
103     set(JavaScriptCore_LIBRARY_TYPE SHARED)
104     set(WebCore_LIBRARY_TYPE STATIC)
105 endif ()
106
107 set(WebKit_LIBRARY_TYPE SHARED)
108 set(WebKit2_LIBRARY_TYPE SHARED)
109 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
110
111 # -----------------------------------------------------------------------------
112 # Install JavaScript shell
113 # -----------------------------------------------------------------------------
114 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
115
116 # -----------------------------------------------------------------------------
117 # Default output directories, which can be overwritten by ports
118 #------------------------------------------------------------------------------
119 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
120 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
121 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
122
123 # -----------------------------------------------------------------------------
124 # Common configuration
125 #------------------------------------------------------------------------------
126 include(WebKitCommon)
127
128 # -----------------------------------------------------------------------------
129 # Enable API unit tests and create a target for the test runner
130 # -----------------------------------------------------------------------------
131 if (ENABLE_API_TESTS)
132     enable_testing()
133 endif ()
134
135 # -----------------------------------------------------------------------------
136 # Define packaging
137 # -----------------------------------------------------------------------------
138 include(WebKitPackaging)
139
140 # -----------------------------------------------------------------------------
141 # Add module directories
142 # -----------------------------------------------------------------------------
143 add_subdirectory(Source)
144
145 # -----------------------------------------------------------------------------
146 # Add tools
147 # -----------------------------------------------------------------------------
148 if (ENABLE_TOOLS)
149     add_subdirectory(Tools)
150 endif ()
151
152 # -----------------------------------------------------------------------------
153 # Print the features list last, for maximum visibility.
154 # -----------------------------------------------------------------------------
155 PRINT_WEBKIT_OPTIONS()