1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
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)
10 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
12 # -----------------------------------------------------------------------------
13 # Default library type
14 # -----------------------------------------------------------------------------
15 IF (NOT ENABLE_WEBKIT AND NOT ENABLE_WEBKIT2)
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")
25 SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
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")
34 INCLUDE(WebKitHelpers)
35 INCLUDE(WebKitFeatures)
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})")
43 LIST(FIND ALL_PORTS ${PORT} RET)
45 MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
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)
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")
64 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
66 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
68 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
71 MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
74 # -----------------------------------------------------------------------------
75 # Determine the operating system
76 # -----------------------------------------------------------------------------
79 SET(WTF_OS_MAC_OS_X 1)
83 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
85 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "QNX")
89 MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
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)
102 # -----------------------------------------------------------------------------
103 # Default library types
104 # -----------------------------------------------------------------------------
105 OPTION(SHARED_CORE "build WTF, JavaScriptCore and WebCore as shared libraries")
108 SET(WTF_LIBRARY_TYPE SHARED)
109 SET(JavaScriptCore_LIBRARY_TYPE SHARED)
110 SET(WebCore_LIBRARY_TYPE SHARED)
112 SET(WTF_LIBRARY_TYPE STATIC)
113 SET(JavaScriptCore_LIBRARY_TYPE STATIC)
114 SET(WebCore_LIBRARY_TYPE STATIC)
117 SET(WebKit_LIBRARY_TYPE SHARED)
118 SET(WebKit2_LIBRARY_TYPE SHARED)
120 # -----------------------------------------------------------------------------
121 # Port-specific options
122 # -----------------------------------------------------------------------------
123 INCLUDE(OptionsCommon)
124 INCLUDE(Options${PORT})
126 # -----------------------------------------------------------------------------
127 # Install JavaScript shell
128 # -----------------------------------------------------------------------------
129 OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
131 # -----------------------------------------------------------------------------
133 # -----------------------------------------------------------------------------
134 INCLUDE(WebKitPackaging)
136 # -----------------------------------------------------------------------------
137 # Add module directories
138 # -----------------------------------------------------------------------------
139 ADD_SUBDIRECTORY(Source)
141 # -----------------------------------------------------------------------------
143 # -----------------------------------------------------------------------------
144 ADD_SUBDIRECTORY(Tools)
146 # -----------------------------------------------------------------------------
147 # Prints a summary of all enabled/disabled features
148 # -----------------------------------------------------------------------------
149 WEBKIT_PRINT_FEATURES()