Differentiate between SVG/CSS width/height attributes/properties
[WebKit-https.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2 PROJECT(WebKit)
3
4 # Set a default build type if and only if user did not define one as command
5 # line options and he did not give custom CFLAGS or CXXFLAGS. Otherwise, flags
6 # from default build type would overwrite user-defined ones.
7 IF (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS AND NOT CMAKE_CXX_FLAGS)
8     SET(CMAKE_BUILD_TYPE Release)
9 ENDIF ()
10
11 # -----------------------------------------------------------------------------
12 # Default library type
13 # -----------------------------------------------------------------------------
14 SET(ENABLE_WEBCORE On)
15
16 IF (NOT ENABLE_WEBKIT AND NOT ENABLE_WEBKIT2)
17     SET(ENABLE_WEBKIT On)
18 ENDIF ()
19
20 OPTION(ONLY_BUILD_JAVASCRIPTCORE "only build JavaScriptCore")
21 IF (ONLY_BUILD_JAVASCRIPTCORE)
22     SET(ENABLE_WEBCORE Off)
23     SET(ENABLE_WEBKIT Off)
24     SET(ENABLE_WEBKIT2 Off)
25 ENDIF ()
26
27 SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
28 SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
29 SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
30 SET(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
31 SET(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
32
33 SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
34
35 SET(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
36 SET(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
37 SET(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
38 SET(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
39
40 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
41
42 INCLUDE(WebKitMacros)
43 INCLUDE(WebKitFS)
44 INCLUDE(WebKitHelpers)
45 INCLUDE(WebKitFeatures)
46
47 # -----------------------------------------------------------------------------
48 # Determine which port will be built
49 # -----------------------------------------------------------------------------
50 SET(ALL_PORTS Efl WinCE BlackBerry)
51 SET(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
52
53 LIST(FIND ALL_PORTS ${PORT} RET)
54 IF (${RET} EQUAL -1)
55     MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
56 ENDIF ()
57
58 STRING(TOLOWER ${PORT} WEBKIT_PORT_DIR)
59
60 # -----------------------------------------------------------------------------
61 # Find common packages (used by all ports)
62 # -----------------------------------------------------------------------------
63 FIND_PACKAGE(BISON REQUIRED)
64 FIND_PACKAGE(FLEX REQUIRED)
65 FIND_PACKAGE(Gperf REQUIRED)
66 FIND_PACKAGE(Perl REQUIRED)
67 FIND_PACKAGE(PythonInterp REQUIRED)
68
69 # -----------------------------------------------------------------------------
70 # Determine the target processor
71 # -----------------------------------------------------------------------------
72 STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
73 IF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
74     SET(WTF_CPU_ARM 1)
75 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
76     SET(WTF_CPU_MIPS 1)
77 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
78     SET(WTF_CPU_X86_64 1)
79 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
80     SET(WTF_CPU_X86 1)
81 ELSE ()
82     MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
83 ENDIF ()
84
85 # -----------------------------------------------------------------------------
86 # Determine the operating system
87 # -----------------------------------------------------------------------------
88 IF (UNIX)
89     IF (APPLE)
90         SET(WTF_OS_MAC_OS_X 1)
91     ELSE ()
92         SET(WTF_OS_UNIX 1)
93     ENDIF ()
94 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
95     SET(WTF_OS_WINDOWS 1)
96 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "QNX")
97     SET(WTF_OS_QNX 1)
98     SET(WTF_OS_UNIX 1)
99 ELSE ()
100     MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
101 ENDIF ()
102
103 # -----------------------------------------------------------------------------
104 # Default target names (can be overrriden in Options${PORT}.cmake file)
105 # -----------------------------------------------------------------------------
106 SET(JSC_EXECUTABLE_NAME JSC)
107 SET(WTF_LIBRARY_NAME WTF)
108 SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
109 SET(WebCore_LIBRARY_NAME WebCore)
110 SET(WebKit_LIBRARY_NAME WebKit)
111 SET(WebKit2_LIBRARY_NAME WebKit2)
112
113 # -----------------------------------------------------------------------------
114 # Default library types
115 # -----------------------------------------------------------------------------
116 OPTION(SHARED_CORE "build WTF, JavaScriptCore and WebCore as shared libraries")
117
118 IF (SHARED_CORE)
119     SET(WTF_LIBRARY_TYPE SHARED)
120     SET(JavaScriptCore_LIBRARY_TYPE SHARED)
121     SET(WebCore_LIBRARY_TYPE SHARED)
122 ELSE ()
123     SET(WTF_LIBRARY_TYPE STATIC)
124     SET(JavaScriptCore_LIBRARY_TYPE STATIC)
125     SET(WebCore_LIBRARY_TYPE STATIC)
126 ENDIF ()
127
128 SET(WebKit_LIBRARY_TYPE SHARED)
129 SET(WebKit2_LIBRARY_TYPE SHARED)
130
131 # -----------------------------------------------------------------------------
132 # Port-specific options
133 # -----------------------------------------------------------------------------
134 INCLUDE(OptionsCommon)
135 INCLUDE(Options${PORT})
136
137 # -----------------------------------------------------------------------------
138 # Install JavaScript shell
139 # -----------------------------------------------------------------------------
140 OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
141
142 # -----------------------------------------------------------------------------
143 # Define packaging
144 # -----------------------------------------------------------------------------
145 INCLUDE(WebKitPackaging)
146
147 # -----------------------------------------------------------------------------
148 # Add module directories
149 # -----------------------------------------------------------------------------
150 ADD_SUBDIRECTORY(Source)
151
152 # -----------------------------------------------------------------------------
153 # Add tools
154 # -----------------------------------------------------------------------------
155 ADD_SUBDIRECTORY(Tools)
156
157 # -----------------------------------------------------------------------------
158 # Prints a summary of all enabled/disabled features
159 # -----------------------------------------------------------------------------
160 WEBKIT_PRINT_FEATURES()