[Release] Webkit2-efl-123997_0.11.49
[framework/web/webkit-efl.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 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
11
12 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
13 # Dear upversioners, please don't merge 'Layout test' lines below.
14 # -----------------------------------------------------------------------------
15 # Layout test
16 # -----------------------------------------------------------------------------
17 IF (ENABLE_TIZEN_WEBKIT2_EFL_WTR)
18     ADD_DEFINITIONS(-DENABLE_TIZEN_WEBKIT2_EFL_WTR=1)
19 ENDIF () # ENABLE_TIZEN_WEBKIT2_EFL_WTR
20 # endif
21
22 # -----------------------------------------------------------------------------
23 # Default library type
24 # -----------------------------------------------------------------------------
25 SET(ENABLE_WEBCORE ON)
26
27 IF (NOT ENABLE_WEBKIT AND NOT ENABLE_WEBKIT2)
28     SET(ENABLE_WEBKIT ON)
29 ENDIF ()
30
31 SET(ENABLE_TOOLS ON)
32
33 SET(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
34 SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
35 SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
36 SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
37 SET(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
38 SET(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
39
40 SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
41
42 SET(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
43 SET(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
44 SET(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
45 SET(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
46 SET(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
47
48 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
49
50 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
51 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
52 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
53
54 INCLUDE(WebKitMacros)
55 INCLUDE(WebKitFS)
56 INCLUDE(WebKitHelpers)
57 INCLUDE(WebKitFeatures)
58
59 # -----------------------------------------------------------------------------
60 # Determine which port will be built
61 # -----------------------------------------------------------------------------
62 SET(ALL_PORTS Efl WinCE BlackBerry)
63 SET(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
64
65 LIST(FIND ALL_PORTS ${PORT} RET)
66 IF (${RET} EQUAL -1)
67     MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
68 ENDIF ()
69
70 STRING(TOLOWER ${PORT} WEBKIT_PORT_DIR)
71 # -----------------------------------------------------------------------------
72 # Find common packages (used by all ports)
73 # -----------------------------------------------------------------------------
74 FIND_PACKAGE(BISON REQUIRED)
75 FIND_PACKAGE(FLEX REQUIRED)
76 FIND_PACKAGE(Gperf REQUIRED)
77 FIND_PACKAGE(Perl REQUIRED)
78 FIND_PACKAGE(PythonInterp REQUIRED)
79 FIND_PACKAGE(Ruby)
80
81 # -----------------------------------------------------------------------------
82 # Determine the target processor
83 # -----------------------------------------------------------------------------
84 STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
85 IF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
86     SET(WTF_CPU_ARM 1)
87 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
88     SET(WTF_CPU_MIPS 1)
89 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
90     SET(WTF_CPU_X86_64 1)
91 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
92     SET(WTF_CPU_X86 1)
93 ELSE ()
94     MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
95 ENDIF ()
96
97 # -----------------------------------------------------------------------------
98 # Determine the operating system
99 # -----------------------------------------------------------------------------
100 IF (UNIX)
101     IF (APPLE)
102         SET(WTF_OS_MAC_OS_X 1)
103     ELSE ()
104         SET(WTF_OS_UNIX 1)
105     ENDIF ()
106 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
107     SET(WTF_OS_WINDOWS 1)
108 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "QNX")
109     SET(WTF_OS_QNX 1)
110     SET(WTF_OS_UNIX 1)
111 ELSE ()
112     MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
113 ENDIF ()
114
115 # -----------------------------------------------------------------------------
116 # Default target names (can be overrriden in Options${PORT}.cmake file)
117 # -----------------------------------------------------------------------------
118 SET(JSC_EXECUTABLE_NAME JSC)
119 SET(WTF_LIBRARY_NAME WTF)
120 SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
121 SET(WebCore_LIBRARY_NAME WebCore)
122 SET(WebKit_LIBRARY_NAME WebKit)
123 SET(WebKit2_LIBRARY_NAME WebKit2)
124 SET(WebKit2StaticForDebug_LIBRARY_NAME WebKit2StaticForDebug)
125 SET(WebCoreTestSupport_LIBRARY_NAME WebCoreTestSupport)
126
127 # -----------------------------------------------------------------------------
128 # Default library types
129 # -----------------------------------------------------------------------------
130 OPTION(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
131
132 IF (SHARED_CORE)
133     SET(JavaScriptCore_LIBRARY_TYPE SHARED)
134     SET(WebCore_LIBRARY_TYPE SHARED)
135 ELSE ()
136     SET(JavaScriptCore_LIBRARY_TYPE STATIC)
137     SET(WebCore_LIBRARY_TYPE STATIC)
138 ENDIF ()
139
140 SET(WebKit_LIBRARY_TYPE SHARED)
141 SET(WebKit2_LIBRARY_TYPE SHARED)
142 SET(WebKit2StaticForDebug_LIBRARY_TYPE STATIC)
143 SET(WebCoreTestSupport_LIBRARY_TYPE STATIC)
144
145 # -----------------------------------------------------------------------------
146 # Port-specific options
147 # -----------------------------------------------------------------------------
148 INCLUDE(OptionsCommon)
149 #INCLUDE(Options${PORT}) Use OptionsTizen.cmake
150 INCLUDE(OptionsTizen)
151
152 # -----------------------------------------------------------------------------
153 # Enable API unit tests and create a target for the test runner
154 # -----------------------------------------------------------------------------
155 IF (ENABLE_API_TESTS)
156     ENABLE_TESTING()
157 ENDIF ()
158
159 # -----------------------------------------------------------------------------
160 # Install JavaScript shell
161 # -----------------------------------------------------------------------------
162 OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
163
164 # -----------------------------------------------------------------------------
165 # Define packaging
166 # -----------------------------------------------------------------------------
167 INCLUDE(WebKitPackaging)
168
169 # -----------------------------------------------------------------------------
170 # Add module directories
171 # -----------------------------------------------------------------------------
172 ADD_SUBDIRECTORY(Source)
173
174 # -----------------------------------------------------------------------------
175 # Add tools
176 # -----------------------------------------------------------------------------
177 IF (ENABLE_TOOLS)
178     ADD_SUBDIRECTORY(Tools)
179 ENDIF ()
180