3748c26d0ba6182ab092a9d91ec77758cd03e6aa
[WebKit-https.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2 PROJECT(WebKit)
3
4 SET(CMAKE_BUILD_TYPE Release)
5 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
6
7 SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/JavaScriptCore")
8 SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/WebCore")
9 SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/WebKit")
10 SET(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
11
12 INCLUDE(WebKitMacros)
13 INCLUDE(WebKitGenerators)
14 INCLUDE(WebKitHelpers)
15 INCLUDE(WebKitFeatures)
16
17 # -----------------------------------------------------------------------------
18 # Determine which port will be built
19 # -----------------------------------------------------------------------------
20 OPTION(PORT "choose which WebKit port to build" "NOPORT")
21
22 # -----------------------------------------------------------------------------
23 # Find common packages (used by all ports)
24 # -----------------------------------------------------------------------------
25 FIND_PACKAGE(BISON REQUIRED)
26 FIND_PACKAGE(FLEX REQUIRED)
27 FIND_PACKAGE(Perl REQUIRED)
28 FIND_PACKAGE(PythonInterp REQUIRED)
29
30 # -----------------------------------------------------------------------------
31 # Determine the target processor
32 # -----------------------------------------------------------------------------
33 IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
34     SET(WTF_CPU_ARM 1)
35 ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)")
36     SET(WTF_CPU_X86_64 1)
37 ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
38     SET(WTF_CPU_X86 1)
39 ELSE ()
40     MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
41 ENDIF ()
42
43 # -----------------------------------------------------------------------------
44 # Determine the operating system
45 # -----------------------------------------------------------------------------
46 IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
47     SET(WTF_OS_UNIX 1)
48
49     IF (APPLE)
50         SET(WTF_OS_MAC_OS_X 1)
51     ENDIF ()
52 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
53     SET(WTF_OS_WINDOWS 1)
54 ELSE ()
55     MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
56 ENDIF ()
57
58 # -----------------------------------------------------------------------------
59 # Default target names (can be overrriden in Options${PORT}.cmake file)
60 # -----------------------------------------------------------------------------
61 SET(JSC_EXECUTABLE_NAME JSC)
62 SET(WTF_LIBRARY_NAME WTF)
63 SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
64 SET(WebCore_LIBRARY_NAME WebCore)
65 SET(WebKit_LIBRARY_NAME WebKit)
66
67 # -----------------------------------------------------------------------------
68 # Default library types (can be overrriden in Options${PORT}.cmake file)
69 # -----------------------------------------------------------------------------
70 SET(WTF_LIBRARY_TYPE STATIC)
71 SET(JavaScriptCore_LIBRARY_TYPE STATIC)
72 SET(WebCore_LIBRARY_TYPE STATIC)
73 SET(WebKit_LIBRARY_TYPE SHARED)
74
75 # -----------------------------------------------------------------------------
76 # Port-specific options
77 # -----------------------------------------------------------------------------
78 INCLUDE(OptionsCommon)
79 INCLUDE(Options${PORT})
80
81 # -----------------------------------------------------------------------------
82 # Add module directories
83 # -----------------------------------------------------------------------------
84 ADD_SUBDIRECTORY(JavaScriptCore)
85 ADD_SUBDIRECTORY(WebCore)
86 ADD_SUBDIRECTORY(WebKit)
87
88 # -----------------------------------------------------------------------------
89 # Set compiler flags for all targets
90 # -----------------------------------------------------------------------------
91 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WTF_LIBRARY_NAME})
92 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${JavaScriptCore_LIBRARY_NAME})
93 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebCore_LIBRARY_NAME})
94 WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebKit_LIBRARY_NAME})
95
96 # -----------------------------------------------------------------------------
97 # Create the configuration file
98 # -----------------------------------------------------------------------------
99 CONFIGURE_FILE(cmakeconfig.h.cmake ${CMAKE_BINARY_DIR}/cmakeconfig.h @ONLY)
100
101 # -----------------------------------------------------------------------------
102 # Prints a summary of all enabled/disabled features
103 # -----------------------------------------------------------------------------
104 WEBKIT_PRINT_FEATURES()