Web Inspector: CSS Pretty Printing fails to wrap long lines of selectors with pseudo...
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.8)
2 project(WebKit)
3
4 # -----------------------------------------------------------------------------
5 # Default library type
6 # -----------------------------------------------------------------------------
7 set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
8 set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
9 set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
10 set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
11 set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
12 set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
13 set(PLATFORM_DIR "${CMAKE_SOURCE_DIR}/Source/Platform")
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_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
21 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
22 set(DERIVED_SOURCES_WEBINSPECTORUI_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebInspectorUI")
23
24 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
25
26 set(ENABLE_WEBCORE ON)
27
28 if (NOT DEFINED ENABLE_WEBKIT)
29     set(ENABLE_WEBKIT ON)
30 endif ()
31
32 if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
33     set(ENABLE_TOOLS ON)
34 endif ()
35
36 # Do not create transitive library dependencies by default
37 set(CMAKE_LINK_INTERFACE_LIBRARIES "")
38
39 include(WebKitMacros)
40 include(WebKitFS)
41 include(WebKitHelpers)
42 include(WebKitFeatures)
43
44 # -----------------------------------------------------------------------------
45 # Determine which port will be built
46 # -----------------------------------------------------------------------------
47 set(ALL_PORTS Efl WinCE GTK AppleWin WinCairo Mac)
48 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
49
50 list(FIND ALL_PORTS ${PORT} RET)
51 if (${RET} EQUAL -1)
52     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
53 endif ()
54
55 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
56
57 # -----------------------------------------------------------------------------
58 # Find common packages (used by all ports)
59 # -----------------------------------------------------------------------------
60 find_package(BISON 2.3 REQUIRED)
61 if (!APPLE)
62     find_package(FLEX 2.5.34 REQUIRED)
63 endif ()
64
65 # TODO Enforce version requirement for gperf
66 find_package(Gperf 3.0.1 REQUIRED)
67
68 # TODO Enforce version requirement for perl
69 find_package(Perl 5.10.0 REQUIRED)
70
71 find_package(PythonInterp 2.6.0 REQUIRED)
72 find_package(Ruby 1.8.7)
73
74 # -----------------------------------------------------------------------------
75 # Determine the target processor
76 # -----------------------------------------------------------------------------
77 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
78 # since the later one just resolves to the host processor on Windows.
79 if (MSVC_CXX_ARCHITECTURE_ID)
80     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
81 else ()
82     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
83 endif ()
84 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
85     set(WTF_CPU_ARM 1)
86 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
87     set(WTF_CPU_ARM64 1)
88 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
89     set(WTF_CPU_MIPS 1)
90 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
91     set(WTF_CPU_SH4 1)
92 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
93     set(WTF_CPU_X86_64 1)
94 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
95     set(WTF_CPU_X86 1)
96 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")
97     set(WTF_CPU_PPC 1)
98 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
99     set(WTF_CPU_PPC64 1)
100 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
101     set(WTF_CPU_PPC64LE 1)
102 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
103     set(WTF_CPU_S390 1)
104 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
105     set(WTF_CPU_S390X 1)
106 else ()
107     message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
108 endif ()
109
110 # -----------------------------------------------------------------------------
111 # Determine the operating system
112 # -----------------------------------------------------------------------------
113 if (UNIX)
114     if (APPLE)
115         set(WTF_OS_MAC_OS_X 1)
116     else ()
117         set(WTF_OS_UNIX 1)
118     endif ()
119 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
120     set(WTF_OS_WINDOWS 1)
121 else ()
122     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
123 endif ()
124
125 # -----------------------------------------------------------------------------
126 # Default library types
127 # -----------------------------------------------------------------------------
128 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
129
130 if (SHARED_CORE)
131     set(JavaScriptCore_LIBRARY_TYPE SHARED)
132     set(WebCore_LIBRARY_TYPE SHARED)
133 else ()
134     if (${PORT} STREQUAL GTK)
135         set(JavaScriptCore_LIBRARY_TYPE SHARED)
136     else ()
137         set(JavaScriptCore_LIBRARY_TYPE STATIC)
138     endif ()
139     set(WebCore_LIBRARY_TYPE STATIC)
140 endif ()
141
142 set(WebKit_LIBRARY_TYPE SHARED)
143 set(WebKit2_LIBRARY_TYPE SHARED)
144 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
145
146 # -----------------------------------------------------------------------------
147 # Install JavaScript shell
148 # -----------------------------------------------------------------------------
149 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
150
151 # -----------------------------------------------------------------------------
152 # Common options
153 #------------------------------------------------------------------------------
154 include(OptionsCommon)
155 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
156 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
157 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
158
159 # -----------------------------------------------------------------------------
160 # Port-specific options
161 # -----------------------------------------------------------------------------
162 include(Options${PORT})
163
164 # -----------------------------------------------------------------------------
165 # Enable API unit tests and create a target for the test runner
166 # -----------------------------------------------------------------------------
167 if (ENABLE_API_TESTS)
168     enable_testing()
169 endif ()
170
171 # -----------------------------------------------------------------------------
172 # Define packaging
173 # -----------------------------------------------------------------------------
174 include(WebKitPackaging)
175
176 # -----------------------------------------------------------------------------
177 # Add module directories
178 # -----------------------------------------------------------------------------
179 add_subdirectory(Source)
180
181 # -----------------------------------------------------------------------------
182 # Add tools
183 # -----------------------------------------------------------------------------
184 if (ENABLE_TOOLS)
185     add_subdirectory(Tools)
186 endif ()