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 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
13 # Dear upversioners, please don't merge 'Layout test' lines below.
14 # -----------------------------------------------------------------------------
16 # -----------------------------------------------------------------------------
17 IF (ENABLE_TIZEN_WEBKIT2_EFL_WTR)
18 ADD_DEFINITIONS(-DENABLE_TIZEN_WEBKIT2_EFL_WTR=1)
19 ENDIF () # ENABLE_TIZEN_WEBKIT2_EFL_WTR
22 # -----------------------------------------------------------------------------
23 # Default library type
24 # -----------------------------------------------------------------------------
25 SET(ENABLE_WEBCORE ON)
27 IF (NOT ENABLE_WEBKIT AND NOT ENABLE_WEBKIT2)
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")
40 SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
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")
48 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
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)
56 INCLUDE(WebKitHelpers)
57 INCLUDE(WebKitFeatures)
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})")
65 LIST(FIND ALL_PORTS ${PORT} RET)
67 MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
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)
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")
87 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
89 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
91 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
94 MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
97 # -----------------------------------------------------------------------------
98 # Determine the operating system
99 # -----------------------------------------------------------------------------
102 SET(WTF_OS_MAC_OS_X 1)
106 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
107 SET(WTF_OS_WINDOWS 1)
108 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "QNX")
112 MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
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)
127 # -----------------------------------------------------------------------------
128 # Default library types
129 # -----------------------------------------------------------------------------
130 OPTION(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
133 SET(JavaScriptCore_LIBRARY_TYPE SHARED)
134 SET(WebCore_LIBRARY_TYPE SHARED)
136 SET(JavaScriptCore_LIBRARY_TYPE STATIC)
137 SET(WebCore_LIBRARY_TYPE STATIC)
140 SET(WebKit_LIBRARY_TYPE SHARED)
141 SET(WebKit2_LIBRARY_TYPE SHARED)
142 SET(WebKit2StaticForDebug_LIBRARY_TYPE STATIC)
143 SET(WebCoreTestSupport_LIBRARY_TYPE STATIC)
145 # -----------------------------------------------------------------------------
146 # Port-specific options
147 # -----------------------------------------------------------------------------
148 INCLUDE(OptionsCommon)
149 #INCLUDE(Options${PORT}) Use OptionsTizen.cmake
150 INCLUDE(OptionsTizen)
152 # -----------------------------------------------------------------------------
153 # Enable API unit tests and create a target for the test runner
154 # -----------------------------------------------------------------------------
155 IF (ENABLE_API_TESTS)
159 # -----------------------------------------------------------------------------
160 # Install JavaScript shell
161 # -----------------------------------------------------------------------------
162 OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
164 # -----------------------------------------------------------------------------
166 # -----------------------------------------------------------------------------
167 INCLUDE(WebKitPackaging)
169 # -----------------------------------------------------------------------------
170 # Add module directories
171 # -----------------------------------------------------------------------------
172 ADD_SUBDIRECTORY(Source)
174 # -----------------------------------------------------------------------------
176 # -----------------------------------------------------------------------------
178 ADD_SUBDIRECTORY(Tools)