WebContextMenuClient::fixMenuReceivedFromOldSafari is no longer needed on Windows
[WebKit-https.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}/cmake")
11
12 SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/JavaScriptCore")
13 SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/WebCore")
14 SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/WebKit")
15 SET(WEBKITTOOLS_DIR "${CMAKE_SOURCE_DIR}/WebKitTools")
16 SET(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
17
18 INCLUDE(WebKitMacros)
19 INCLUDE(WebKitGenerators)
20 INCLUDE(WebKitHelpers)
21 INCLUDE(WebKitFeatures)
22
23 # -----------------------------------------------------------------------------
24 # Determine which port will be built
25 # -----------------------------------------------------------------------------
26 SET(ALL_PORTS Efl)
27 OPTION(PORT "choose which WebKit port to build (one of ${ALL_PORTS})" "NOPORT")
28
29 # -----------------------------------------------------------------------------
30 # Find common packages (used by all ports)
31 # -----------------------------------------------------------------------------
32 FIND_PACKAGE(BISON REQUIRED)
33 FIND_PACKAGE(FLEX REQUIRED)
34 FIND_PACKAGE(Gperf REQUIRED)
35 FIND_PACKAGE(Perl REQUIRED)
36 FIND_PACKAGE(PythonInterp REQUIRED)
37
38 # -----------------------------------------------------------------------------
39 # Determine the target processor
40 # -----------------------------------------------------------------------------
41 IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
42     SET(WTF_CPU_ARM 1)
43 ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)")
44     SET(WTF_CPU_X86_64 1)
45 ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
46     SET(WTF_CPU_X86 1)
47 ELSE ()
48     MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
49 ENDIF ()
50
51 # -----------------------------------------------------------------------------
52 # Determine the operating system
53 # -----------------------------------------------------------------------------
54 IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
55     SET(WTF_OS_UNIX 1)
56
57     IF (APPLE)
58         SET(WTF_OS_MAC_OS_X 1)
59     ENDIF ()
60 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
61     SET(WTF_OS_WINDOWS 1)
62 ELSE ()
63     MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
64 ENDIF ()
65
66 # -----------------------------------------------------------------------------
67 # Default target names (can be overrriden in Options${PORT}.cmake file)
68 # -----------------------------------------------------------------------------
69 SET(JSC_EXECUTABLE_NAME JSC)
70 SET(WTF_LIBRARY_NAME WTF)
71 SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
72 SET(WebCore_LIBRARY_NAME WebCore)
73 SET(WebKit_LIBRARY_NAME WebKit)
74
75 # -----------------------------------------------------------------------------
76 # Default library types
77 # -----------------------------------------------------------------------------
78 OPTION(SHARED_CORE "build WTF, JavaScriptCore and WebCore as shared libraries")
79
80 IF (SHARED_CORE)
81     SET(WTF_LIBRARY_TYPE SHARED)
82     SET(JavaScriptCore_LIBRARY_TYPE SHARED)
83     SET(WebCore_LIBRARY_TYPE SHARED)
84 ELSE ()
85     SET(WTF_LIBRARY_TYPE STATIC)
86     SET(JavaScriptCore_LIBRARY_TYPE STATIC)
87     SET(WebCore_LIBRARY_TYPE STATIC)
88 ENDIF ()
89
90 SET(WebKit_LIBRARY_TYPE SHARED)
91
92 # -----------------------------------------------------------------------------
93 # Port-specific options
94 # -----------------------------------------------------------------------------
95 INCLUDE(OptionsCommon)
96 INCLUDE(Options${PORT})
97
98 # -----------------------------------------------------------------------------
99 # Define packaging
100 # -----------------------------------------------------------------------------
101 INCLUDE(WebKitPackaging)
102
103 # -----------------------------------------------------------------------------
104 # Add module directories
105 # -----------------------------------------------------------------------------
106 ADD_SUBDIRECTORY(JavaScriptCore)
107 ADD_SUBDIRECTORY(WebCore)
108 ADD_SUBDIRECTORY(WebKit)
109
110 # -----------------------------------------------------------------------------
111 # Add test browser if exists
112 # -----------------------------------------------------------------------------
113 INCLUDE_IF_EXISTS(${WEBKITTOOLS_DIR}/CMakeLists${PORT}.txt)
114
115 # -----------------------------------------------------------------------------
116 # Set compiler flags for all targets
117 # -----------------------------------------------------------------------------
118 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WTF_LIBRARY_NAME})
119 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${JavaScriptCore_LIBRARY_NAME})
120 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebCore_LIBRARY_NAME})
121 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebKit_LIBRARY_NAME})
122
123 # -----------------------------------------------------------------------------
124 # Create the configuration file
125 # -----------------------------------------------------------------------------
126 CONFIGURE_FILE(cmakeconfig.h.cmake ${CMAKE_BINARY_DIR}/cmakeconfig.h @ONLY)
127
128 # -----------------------------------------------------------------------------
129 # Prints a summary of all enabled/disabled features
130 # -----------------------------------------------------------------------------
131 WEBKIT_PRINT_FEATURES()