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