[GTK] Fix HPPA build
[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(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_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 set(DERIVED_SOURCES_WTF_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WTF")
24
25 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
26
27 set(ENABLE_WEBCORE ON)
28
29 if (NOT DEFINED ENABLE_WEBKIT)
30     set(ENABLE_WEBKIT ON)
31 endif ()
32
33 if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
34     set(ENABLE_TOOLS ON)
35 endif ()
36
37 include(WebKitMacros)
38 include(WebKitFS)
39 include(WebKitHelpers)
40 include(WebKitFeatures)
41
42 # -----------------------------------------------------------------------------
43 # Determine which port will be built
44 # -----------------------------------------------------------------------------
45 set(ALL_PORTS Efl GTK AppleWin WinCairo Mac)
46 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
47
48 list(FIND ALL_PORTS ${PORT} RET)
49 if (${RET} EQUAL -1)
50     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
51 endif ()
52
53 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
54
55 # -----------------------------------------------------------------------------
56 # Find common packages (used by all ports)
57 # -----------------------------------------------------------------------------
58 find_package(BISON 2.3 REQUIRED)
59 if (!APPLE)
60     find_package(FLEX 2.5.34 REQUIRED)
61 endif ()
62
63 # TODO Enforce version requirement for gperf
64 find_package(Gperf 3.0.1 REQUIRED)
65
66 # TODO Enforce version requirement for perl
67 find_package(Perl 5.10.0 REQUIRED)
68
69 find_package(PythonInterp 2.7.0 REQUIRED)
70 find_package(Ruby 1.8.7)
71
72 # -----------------------------------------------------------------------------
73 # Determine the target processor
74 # -----------------------------------------------------------------------------
75 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
76 # since the later one just resolves to the host processor on Windows.
77 if (MSVC_CXX_ARCHITECTURE_ID)
78     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
79 else ()
80     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
81 endif ()
82 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
83     set(WTF_CPU_ARM 1)
84 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
85     set(WTF_CPU_ARM64 1)
86 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
87     set(WTF_CPU_MIPS 1)
88 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
89     set(WTF_CPU_SH4 1)
90 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
91     set(WTF_CPU_X86_64 1)
92 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
93     set(WTF_CPU_X86 1)
94 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")
95     set(WTF_CPU_PPC 1)
96 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
97     set(WTF_CPU_PPC64 1)
98 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
99     set(WTF_CPU_PPC64LE 1)
100 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "parisc*")
101     set(WTF_CPU_HPPA 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     set(JavaScriptCore_LIBRARY_TYPE SHARED)
135     set(WebCore_LIBRARY_TYPE STATIC)
136 endif ()
137
138 set(WebKit_LIBRARY_TYPE SHARED)
139 set(WebKit2_LIBRARY_TYPE SHARED)
140 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
141
142 # -----------------------------------------------------------------------------
143 # Install JavaScript shell
144 # -----------------------------------------------------------------------------
145 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
146
147 # -----------------------------------------------------------------------------
148 # Common options
149 #------------------------------------------------------------------------------
150 include(OptionsCommon)
151 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
152 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
153 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
154
155 # -----------------------------------------------------------------------------
156 # Port-specific options
157 # -----------------------------------------------------------------------------
158 include(Options${PORT})
159
160 # -----------------------------------------------------------------------------
161 # Enable API unit tests and create a target for the test runner
162 # -----------------------------------------------------------------------------
163 if (ENABLE_API_TESTS)
164     enable_testing()
165 endif ()
166
167 # -----------------------------------------------------------------------------
168 # Define packaging
169 # -----------------------------------------------------------------------------
170 include(WebKitPackaging)
171
172 # -----------------------------------------------------------------------------
173 # Add module directories
174 # -----------------------------------------------------------------------------
175 add_subdirectory(Source)
176
177 # -----------------------------------------------------------------------------
178 # Add tools
179 # -----------------------------------------------------------------------------
180 if (ENABLE_TOOLS)
181     add_subdirectory(Tools)
182 endif ()