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