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