[iOS] Handle hit testing for subframes
[WebKit-https.git] / CMakeLists.txt
1 # -----------------------------------------------------------------------------
2 # Determine CMake version and build type.
3 # -----------------------------------------------------------------------------
4 #
5 # NOTE: cmake_minimum_required() and project() *MUST* be the two fist commands
6 # used, see https://cmake.org/cmake/help/v3.3/command/project.html -- the
7 # latter in particular handles loading a bunch of shared CMake definitions
8 # and loading the cross-compilation settings from CMAKE_TOOLCHAIN_FILE.
9 #
10
11 cmake_minimum_required(VERSION 3.3)
12
13 project(WebKit)
14
15 if (NOT CMAKE_BUILD_TYPE)
16     message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to RelWithDebInfo.")
17     set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
18 else ()
19     message(STATUS "The CMake build type is: ${CMAKE_BUILD_TYPE}")
20 endif ()
21
22 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
23
24 set(ENABLE_WEBCORE ON)
25
26 if (NOT DEFINED ENABLE_WEBKIT)
27     set(ENABLE_WEBKIT ON)
28 endif ()
29
30 if (NOT DEFINED ENABLE_TOOLS AND EXISTS "${CMAKE_SOURCE_DIR}/Tools")
31     set(ENABLE_TOOLS ON)
32 endif ()
33
34 # -----------------------------------------------------------------------------
35 # Determine which port will be built
36 # -----------------------------------------------------------------------------
37 set(ALL_PORTS
38     AppleWin
39     Efl
40     GTK
41     JSCOnly
42     Mac
43     PlayStation
44     WPE
45     WinCairo
46 )
47 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
48
49 list(FIND ALL_PORTS ${PORT} RET)
50 if (${RET} EQUAL -1)
51     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
52 endif ()
53
54 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
55
56 # -----------------------------------------------------------------------------
57 # Determine the compiler
58 # -----------------------------------------------------------------------------
59 if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
60     set(COMPILER_IS_CLANG ON)
61 endif ()
62
63 if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
64     if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "6.0.0")
65         message(FATAL_ERROR "GCC 6.0.0 is required to build WebKitGTK+, use a newer GCC version or clang")
66     endif ()
67 endif ()
68
69 if (CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
70     set(COMPILER_IS_GCC_OR_CLANG ON)
71 endif ()
72
73 if (MSVC AND COMPILER_IS_CLANG)
74     set(COMPILER_IS_CLANG_CL ON)
75 endif ()
76
77 # -----------------------------------------------------------------------------
78 # Determine the target processor
79 # -----------------------------------------------------------------------------
80 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
81 # since the later one just resolves to the host processor on Windows.
82 if (MSVC_CXX_ARCHITECTURE_ID)
83     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
84 else ()
85     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
86 endif ()
87 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(^aarch64|^arm64)")
88     set(WTF_CPU_ARM64 1)
89 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
90     set(WTF_CPU_ARM 1)
91 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64")
92     set(WTF_CPU_MIPS64 1)
93 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
94     set(WTF_CPU_MIPS 1)
95 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
96     set(WTF_CPU_X86_64 1)
97 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
98     set(WTF_CPU_X86 1)
99 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")
100     set(WTF_CPU_PPC 1)
101 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
102     set(WTF_CPU_PPC64 1)
103 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
104     set(WTF_CPU_PPC64LE 1)
105 else ()
106     set(WTF_CPU_UNKNOWN 1)
107 endif ()
108
109 # -----------------------------------------------------------------------------
110 # Determine the operating system
111 # -----------------------------------------------------------------------------
112 if (UNIX)
113     if (APPLE)
114         set(WTF_OS_MAC_OS_X 1)
115     elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
116         set(WTF_OS_LINUX 1)
117     else ()
118         set(WTF_OS_UNIX 1)
119     endif ()
120 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
121     set(WTF_OS_WINDOWS 1)
122 elseif (CMAKE_SYSTEM_NAME MATCHES "Fuchsia")
123     set(WTF_OS_FUCHSIA 1)
124 else ()
125     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
126 endif ()
127
128 # -----------------------------------------------------------------------------
129 # Default library types
130 # -----------------------------------------------------------------------------
131 # By default, only the highest-level libraries, WebKitLegacy and WebKit, are
132 # shared, because properly building shared libraries that depend on each other
133 # can be tricky. Override these in Options*.cmake for your port as needed.
134 set(WTF_LIBRARY_TYPE STATIC)
135 set(JavaScriptCore_LIBRARY_TYPE STATIC)
136 set(PAL_LIBRARY_TYPE STATIC)
137 set(WebCore_LIBRARY_TYPE STATIC)
138 set(WebKitLegacy_LIBRARY_TYPE SHARED)
139 set(WebKit_LIBRARY_TYPE SHARED)
140 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
141
142 set(CMAKE_POSITION_INDEPENDENT_CODE True)
143
144 # -----------------------------------------------------------------------------
145 # Install JavaScript shell
146 # -----------------------------------------------------------------------------
147 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
148
149 # -----------------------------------------------------------------------------
150 # Default output directories, which can be overwritten by ports
151 #------------------------------------------------------------------------------
152 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
153 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
154 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
155
156 # -----------------------------------------------------------------------------
157 # Common configuration
158 #------------------------------------------------------------------------------
159 include(WebKitCommon)
160
161 # -----------------------------------------------------------------------------
162 # Enable API unit tests and create a target for the test runner
163 # -----------------------------------------------------------------------------
164 if (ENABLE_API_TESTS)
165     enable_testing()
166 endif ()
167
168 # -----------------------------------------------------------------------------
169 # Add module directories
170 # -----------------------------------------------------------------------------
171 add_subdirectory(Source)
172
173 # -----------------------------------------------------------------------------
174 # Add tools
175 # -----------------------------------------------------------------------------
176 if (ENABLE_TOOLS)
177     add_subdirectory(Tools)
178 endif ()
179
180 if ("${PORT}" STREQUAL "GTK" OR "${PORT}" STREQUAL "WPE")
181     if (DEVELOPER_MODE)
182         add_subdirectory(PerformanceTests)
183     endif ()
184 else ()
185     add_subdirectory(PerformanceTests)
186 endif ()
187
188 # -----------------------------------------------------------------------------
189 # Print the features list last, for maximum visibility.
190 # -----------------------------------------------------------------------------
191 PRINT_WEBKIT_OPTIONS()