[iOS] Tiling coverage sometimes inflated by outdated scale factor.
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2 project(WebKit)
3
4 # -----------------------------------------------------------------------------
5 # Default library type
6 # -----------------------------------------------------------------------------
7 set(BMALLOC_DIR "${CMAKE_SOURCE_DIR}/Source/bmalloc")
8 set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
9 set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
10 set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
11 set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
12 set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
13 set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
14
15 set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
16
17 set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
18 set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
19 set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
20 set(DERIVED_SOURCES_WEBKITLEGACY_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKitLegacy")
21 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
22 set(DERIVED_SOURCES_WEBINSPECTORUI_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebInspectorUI")
23 set(DERIVED_SOURCES_WTF_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WTF")
24
25 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
26
27 if (NOT DEFINED ENABLE_WEBKIT)
28     set(ENABLE_WEBKIT ON)
29 endif ()
30
31 if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
32     set(ENABLE_TOOLS ON)
33 endif ()
34
35 include(WebKitMacros)
36 include(WebKitFS)
37 include(WebKitHelpers)
38 include(WebKitFeatures)
39
40 # -----------------------------------------------------------------------------
41 # Determine which port will be built
42 # -----------------------------------------------------------------------------
43 set(ALL_PORTS Efl GTK AppleWin WinCairo Mac)
44 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
45
46 list(FIND ALL_PORTS ${PORT} RET)
47 if (${RET} EQUAL -1)
48     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
49 endif ()
50
51 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
52
53 # -----------------------------------------------------------------------------
54 # Find common packages (used by all ports)
55 # -----------------------------------------------------------------------------
56 find_package(BISON 2.3 REQUIRED)
57 if (!APPLE)
58     find_package(FLEX 2.5.34 REQUIRED)
59 endif ()
60
61 # TODO Enforce version requirement for gperf
62 find_package(Gperf 3.0.1 REQUIRED)
63
64 # TODO Enforce version requirement for perl
65 find_package(Perl 5.10.0 REQUIRED)
66
67 find_package(PythonInterp 2.7.0 REQUIRED)
68
69 # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
70 # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
71 # for finding only the Ruby interpreter.
72 find_package(Ruby 1.8.7)
73 if (NOT RUBY_EXECUTABLE OR RUBY_VERSION VERSION_LESS 1.8.7)
74     message(FATAL_ERROR "Ruby 1.8.7 or higher is required.")
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 "^arm")
88     set(WTF_CPU_ARM 1)
89 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
90     set(WTF_CPU_ARM64 1)
91 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
92     set(WTF_CPU_MIPS 1)
93 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
94     set(WTF_CPU_SH4 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 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "parisc*")
106     set(WTF_CPU_HPPA 1)
107 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
108     set(WTF_CPU_S390 1)
109 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
110     set(WTF_CPU_S390X 1)
111 else ()
112     message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
113 endif ()
114
115 # -----------------------------------------------------------------------------
116 # Determine the operating system
117 # -----------------------------------------------------------------------------
118 if (UNIX)
119     if (APPLE)
120         set(WTF_OS_MAC_OS_X 1)
121     else ()
122         set(WTF_OS_UNIX 1)
123     endif ()
124 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
125     set(WTF_OS_WINDOWS 1)
126 else ()
127     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
128 endif ()
129
130 # -----------------------------------------------------------------------------
131 # Default library types
132 # -----------------------------------------------------------------------------
133 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
134
135 if (SHARED_CORE)
136     set(JavaScriptCore_LIBRARY_TYPE SHARED)
137     set(WebCore_LIBRARY_TYPE SHARED)
138 else ()
139     set(JavaScriptCore_LIBRARY_TYPE SHARED)
140     set(WebCore_LIBRARY_TYPE STATIC)
141 endif ()
142
143 set(WebKit_LIBRARY_TYPE SHARED)
144 set(WebKit2_LIBRARY_TYPE SHARED)
145 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
146
147 # -----------------------------------------------------------------------------
148 # Install JavaScript shell
149 # -----------------------------------------------------------------------------
150 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
151
152 # -----------------------------------------------------------------------------
153 # Common options
154 #------------------------------------------------------------------------------
155 include(OptionsCommon)
156 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
157 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
158 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
159
160 # -----------------------------------------------------------------------------
161 # Port-specific options
162 # -----------------------------------------------------------------------------
163 include(Options${PORT})
164
165 # -----------------------------------------------------------------------------
166 # Enable API unit tests and create a target for the test runner
167 # -----------------------------------------------------------------------------
168 if (ENABLE_API_TESTS)
169     enable_testing()
170 endif ()
171
172 # -----------------------------------------------------------------------------
173 # Define packaging
174 # -----------------------------------------------------------------------------
175 include(WebKitPackaging)
176
177 # -----------------------------------------------------------------------------
178 # Add module directories
179 # -----------------------------------------------------------------------------
180 add_subdirectory(Source)
181
182 # -----------------------------------------------------------------------------
183 # Add tools
184 # -----------------------------------------------------------------------------
185 if (ENABLE_TOOLS)
186     add_subdirectory(Tools)
187 endif ()
188
189 # -----------------------------------------------------------------------------
190 # Print the features list last, for maximum visibility.
191 # -----------------------------------------------------------------------------
192 PRINT_WEBKIT_OPTIONS()
193
194 # -----------------------------------------------------------------------------
195 # Create the configuration header
196 # -----------------------------------------------------------------------------
197 CREATE_CONFIGURATION_HEADER()