Generate toCSSFooValue for CSS child values
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.3)
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
14 set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
15
16 set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
17 set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
18 set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
19 set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
20 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
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 ${TOOLS_DIR})
31     set(ENABLE_TOOLS ON)
32 endif ()
33
34 include(WebKitMacros)
35 include(WebKitFS)
36 include(WebKitHelpers)
37 include(WebKitFeatures)
38
39 # -----------------------------------------------------------------------------
40 # Determine which port will be built
41 # -----------------------------------------------------------------------------
42 set(ALL_PORTS Efl WinCE BlackBerry GTK)
43 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
44
45 list(FIND ALL_PORTS ${PORT} RET)
46 if (${RET} EQUAL -1)
47     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
48 endif ()
49
50 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
51
52 # -----------------------------------------------------------------------------
53 # Find common packages (used by all ports)
54 # -----------------------------------------------------------------------------
55 find_package(BISON 2.4.1 REQUIRED)
56 find_package(FLEX 2.5.34 REQUIRED)
57
58 # TODO Enforce version requirement for gperf
59 find_package(Gperf 3.0.1 REQUIRED)
60
61 # TODO Enforce version requirement for perl
62 find_package(Perl 5.10.0 REQUIRED)
63
64 find_package(PythonInterp 2.6.0 REQUIRED)
65 find_package(Ruby 1.8.7)
66
67 # -----------------------------------------------------------------------------
68 # Determine the target processor
69 # -----------------------------------------------------------------------------
70 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
71 # since the later one just resolves to the host processor on Windows.
72 if (MSVC_CXX_ARCHITECTURE_ID)
73     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
74 else ()
75     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
76 endif ()
77 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
78     set(WTF_CPU_ARM 1)
79 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
80     set(WTF_CPU_MIPS 1)
81 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
82     set(WTF_CPU_X86_64 1)
83 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
84     set(WTF_CPU_X86 1)
85 else ()
86     message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
87 endif ()
88
89 # -----------------------------------------------------------------------------
90 # Determine the operating system
91 # -----------------------------------------------------------------------------
92 if (UNIX)
93     if (APPLE)
94         set(WTF_OS_MAC_OS_X 1)
95     else ()
96         set(WTF_OS_UNIX 1)
97     endif ()
98 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
99     set(WTF_OS_WINDOWS 1)
100 elseif (CMAKE_SYSTEM_NAME MATCHES "QNX")
101     set(WTF_OS_QNX 1)
102     set(WTF_OS_UNIX 1)
103 else ()
104     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
105 endif ()
106
107 # -----------------------------------------------------------------------------
108 # Default library types
109 # -----------------------------------------------------------------------------
110 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
111
112 if (SHARED_CORE)
113     set(JavaScriptCore_LIBRARY_TYPE SHARED)
114     set(WebCore_LIBRARY_TYPE SHARED)
115 else ()
116     set(JavaScriptCore_LIBRARY_TYPE STATIC)
117     set(WebCore_LIBRARY_TYPE STATIC)
118 endif ()
119
120 set(WebKit_LIBRARY_TYPE SHARED)
121 set(WebKit2_LIBRARY_TYPE SHARED)
122 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
123
124 # -----------------------------------------------------------------------------
125 # Common options
126 #------------------------------------------------------------------------------
127 include(OptionsCommon)
128 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
129 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
130 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${EXEC_INSTALL_DIR})
131
132 # -----------------------------------------------------------------------------
133 # Port-specific options
134 # -----------------------------------------------------------------------------
135 include(Options${PORT})
136
137 # -----------------------------------------------------------------------------
138 # Enable API unit tests and create a target for the test runner
139 # -----------------------------------------------------------------------------
140 if (ENABLE_API_TESTS)
141     enable_testing()
142 endif ()
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 # Define packaging
151 # -----------------------------------------------------------------------------
152 include(WebKitPackaging)
153
154 # -----------------------------------------------------------------------------
155 # Add module directories
156 # -----------------------------------------------------------------------------
157 add_subdirectory(Source)
158
159 # -----------------------------------------------------------------------------
160 # Add tools
161 # -----------------------------------------------------------------------------
162 if (ENABLE_TOOLS)
163     add_subdirectory(Tools)
164 endif ()