Fix a typo in my previous commit that is causing test failures.
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.3)
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(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
15 set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
16 set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
17 set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
18 set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
19 set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
20
21 set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
22
23 set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
24 set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
25 set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
26 set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
27 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
28
29 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
30
31 set(ENABLE_WEBCORE ON)
32
33 if (NOT DEFINED ENABLE_WEBKIT)
34     set(ENABLE_WEBKIT ON)
35 endif ()
36
37 if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
38     set(ENABLE_TOOLS ON)
39 endif ()
40
41 include(WebKitMacros)
42 include(WebKitFS)
43 include(WebKitHelpers)
44 include(WebKitFeatures)
45
46 # -----------------------------------------------------------------------------
47 # Determine which port will be built
48 # -----------------------------------------------------------------------------
49 set(ALL_PORTS Efl WinCE BlackBerry)
50 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
51
52 list(FIND ALL_PORTS ${PORT} RET)
53 if (${RET} EQUAL -1)
54     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
55 endif ()
56
57 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
58
59 # -----------------------------------------------------------------------------
60 # Find common packages (used by all ports)
61 # -----------------------------------------------------------------------------
62 find_package(BISON REQUIRED)
63 find_package(FLEX REQUIRED)
64 find_package(Gperf REQUIRED)
65 find_package(Perl REQUIRED)
66 find_package(PythonInterp REQUIRED)
67 find_package(Ruby)
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 set(WebCoreTestSupport_LIBRARY_NAME WebCoreTestSupport)
113
114 # -----------------------------------------------------------------------------
115 # Default library types
116 # -----------------------------------------------------------------------------
117 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
118
119 if (SHARED_CORE)
120     set(JavaScriptCore_LIBRARY_TYPE SHARED)
121     set(WebCore_LIBRARY_TYPE SHARED)
122 else ()
123     set(JavaScriptCore_LIBRARY_TYPE STATIC)
124     set(WebCore_LIBRARY_TYPE STATIC)
125 endif ()
126
127 set(WebKit_LIBRARY_TYPE SHARED)
128 set(WebKit2_LIBRARY_TYPE SHARED)
129 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
130
131 # -----------------------------------------------------------------------------
132 # Common options
133 #------------------------------------------------------------------------------
134 include(OptionsCommon)
135 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
136 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
137 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${EXEC_INSTALL_DIR})
138
139 # -----------------------------------------------------------------------------
140 # Port-specific options
141 # -----------------------------------------------------------------------------
142 include(Options${PORT})
143
144 # -----------------------------------------------------------------------------
145 # Enable API unit tests and create a target for the test runner
146 # -----------------------------------------------------------------------------
147 if (ENABLE_API_TESTS)
148     enable_testing()
149 endif ()
150
151 # -----------------------------------------------------------------------------
152 # Install JavaScript shell
153 # -----------------------------------------------------------------------------
154 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
155
156 # -----------------------------------------------------------------------------
157 # Define packaging
158 # -----------------------------------------------------------------------------
159 include(WebKitPackaging)
160
161 # -----------------------------------------------------------------------------
162 # Add module directories
163 # -----------------------------------------------------------------------------
164 add_subdirectory(Source)
165
166 # -----------------------------------------------------------------------------
167 # Add tools
168 # -----------------------------------------------------------------------------
169 if (ENABLE_TOOLS)
170     add_subdirectory(Tools)
171 endif ()