[EFL] Quit debug build without -DSHARED_CORE=ON
[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 string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
11
12 # -----------------------------------------------------------------------------
13 # Default library type
14 # -----------------------------------------------------------------------------
15 set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
16 set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
17 set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
18 set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
19 set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
20 set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
21
22 set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
23
24 set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
25 set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
26 set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
27 set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
28 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
29
30 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
31
32 set(ENABLE_WEBCORE ON)
33
34 if (NOT DEFINED ENABLE_WEBKIT)
35     set(ENABLE_WEBKIT ON)
36 endif ()
37
38 if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
39     set(ENABLE_TOOLS ON)
40 endif ()
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 find_package(Ruby)
69
70 # -----------------------------------------------------------------------------
71 # Determine the target processor
72 # -----------------------------------------------------------------------------
73 string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
74 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
75     set(WTF_CPU_ARM 1)
76 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
77     set(WTF_CPU_MIPS 1)
78 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
79     set(WTF_CPU_X86_64 1)
80 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
81     set(WTF_CPU_X86 1)
82 else ()
83     message(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
84 endif ()
85
86 # -----------------------------------------------------------------------------
87 # Determine the operating system
88 # -----------------------------------------------------------------------------
89 if (UNIX)
90     if (APPLE)
91         set(WTF_OS_MAC_OS_X 1)
92     else ()
93         set(WTF_OS_UNIX 1)
94     endif ()
95 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
96     set(WTF_OS_WINDOWS 1)
97 elseif (CMAKE_SYSTEM_NAME MATCHES "QNX")
98     set(WTF_OS_QNX 1)
99     set(WTF_OS_UNIX 1)
100 else ()
101     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
102 endif ()
103
104 # -----------------------------------------------------------------------------
105 # Default target names (can be overrriden in Options${PORT}.cmake file)
106 # -----------------------------------------------------------------------------
107 set(JSC_EXECUTABLE_NAME JSC)
108 set(WTF_LIBRARY_NAME WTF)
109 set(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
110 set(WebCore_LIBRARY_NAME WebCore)
111 set(WebKit_LIBRARY_NAME WebKit)
112 set(WebKit2_LIBRARY_NAME WebKit2)
113 set(WebCoreTestSupport_LIBRARY_NAME WebCoreTestSupport)
114
115 # -----------------------------------------------------------------------------
116 # Default library types
117 # -----------------------------------------------------------------------------
118 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
119
120 if (SHARED_CORE)
121     set(JavaScriptCore_LIBRARY_TYPE SHARED)
122     set(WebCore_LIBRARY_TYPE SHARED)
123 else ()
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 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
131
132 # -----------------------------------------------------------------------------
133 # Common options
134 #------------------------------------------------------------------------------
135 include(OptionsCommon)
136 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
137 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
138 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${EXEC_INSTALL_DIR})
139
140 # -----------------------------------------------------------------------------
141 # Port-specific options
142 # -----------------------------------------------------------------------------
143 include(Options${PORT})
144
145 # -----------------------------------------------------------------------------
146 # Enable API unit tests and create a target for the test runner
147 # -----------------------------------------------------------------------------
148 if (ENABLE_API_TESTS)
149     enable_testing()
150 endif ()
151
152 # -----------------------------------------------------------------------------
153 # Install JavaScript shell
154 # -----------------------------------------------------------------------------
155 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
156
157 # -----------------------------------------------------------------------------
158 # Define packaging
159 # -----------------------------------------------------------------------------
160 include(WebKitPackaging)
161
162 # -----------------------------------------------------------------------------
163 # Add module directories
164 # -----------------------------------------------------------------------------
165 add_subdirectory(Source)
166
167 # -----------------------------------------------------------------------------
168 # Add tools
169 # -----------------------------------------------------------------------------
170 if (ENABLE_TOOLS)
171     add_subdirectory(Tools)
172 endif ()