[GTK][CMake] Warning about CMP0058
[WebKit-https.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2 project(WebKit)
3
4 # This should be removed once we require CMake 3.3.
5 if (POLICY CMP0058)
6     cmake_policy(SET CMP0058 NEW)
7 endif ()
8
9 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
10
11 if (NOT DEFINED ENABLE_WEBKIT)
12     set(ENABLE_WEBKIT ON)
13 endif ()
14
15 if (NOT DEFINED ENABLE_TOOLS AND EXISTS "${CMAKE_SOURCE_DIR}/Tools")
16     set(ENABLE_TOOLS ON)
17 endif ()
18
19 include(WebKitMacros)
20 include(WebKitFS)
21 include(WebKitHelpers)
22 include(WebKitFeatures)
23
24 # -----------------------------------------------------------------------------
25 # Determine which port will be built
26 # -----------------------------------------------------------------------------
27 set(ALL_PORTS Efl GTK AppleWin WinCairo Mac)
28 set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
29
30 list(FIND ALL_PORTS ${PORT} RET)
31 if (${RET} EQUAL -1)
32     message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
33 endif ()
34
35 string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
36
37 # -----------------------------------------------------------------------------
38 # Determine the target processor
39 # -----------------------------------------------------------------------------
40 # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined,
41 # since the later one just resolves to the host processor on Windows.
42 if (MSVC_CXX_ARCHITECTURE_ID)
43     string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
44 else ()
45     string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
46 endif ()
47 if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
48     set(WTF_CPU_ARM 1)
49 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
50     set(WTF_CPU_ARM64 1)
51 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
52     set(WTF_CPU_MIPS 1)
53 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "sh4")
54     set(WTF_CPU_SH4 1)
55 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
56     set(WTF_CPU_X86_64 1)
57 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
58     set(WTF_CPU_X86 1)
59 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")
60     set(WTF_CPU_PPC 1)
61 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
62     set(WTF_CPU_PPC64 1)
63 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
64     set(WTF_CPU_PPC64LE 1)
65 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "parisc*")
66     set(WTF_CPU_HPPA 1)
67 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390")
68     set(WTF_CPU_S390 1)
69 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
70     set(WTF_CPU_S390X 1)
71 else ()
72     message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
73 endif ()
74
75 # -----------------------------------------------------------------------------
76 # Determine the operating system
77 # -----------------------------------------------------------------------------
78 if (UNIX)
79     if (APPLE)
80         set(WTF_OS_MAC_OS_X 1)
81     else ()
82         set(WTF_OS_UNIX 1)
83     endif ()
84 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
85     set(WTF_OS_WINDOWS 1)
86 else ()
87     message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
88 endif ()
89
90 # -----------------------------------------------------------------------------
91 # Default library types
92 # -----------------------------------------------------------------------------
93 option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
94
95 if (SHARED_CORE)
96     set(JavaScriptCore_LIBRARY_TYPE SHARED)
97     set(WebCore_LIBRARY_TYPE SHARED)
98 else ()
99     set(JavaScriptCore_LIBRARY_TYPE SHARED)
100     set(WebCore_LIBRARY_TYPE STATIC)
101 endif ()
102
103 set(WebKit_LIBRARY_TYPE SHARED)
104 set(WebKit2_LIBRARY_TYPE SHARED)
105 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
106
107 # -----------------------------------------------------------------------------
108 # Install JavaScript shell
109 # -----------------------------------------------------------------------------
110 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
111
112 # -----------------------------------------------------------------------------
113 # Common options
114 #------------------------------------------------------------------------------
115 include(OptionsCommon)
116 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
117 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
118 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
119
120 # -----------------------------------------------------------------------------
121 # Port-specific options
122 # -----------------------------------------------------------------------------
123 include(Options${PORT})
124
125 # -----------------------------------------------------------------------------
126 # Enable API unit tests and create a target for the test runner
127 # -----------------------------------------------------------------------------
128 if (ENABLE_API_TESTS)
129     enable_testing()
130 endif ()
131
132 # -----------------------------------------------------------------------------
133 # Define packaging
134 # -----------------------------------------------------------------------------
135 include(WebKitPackaging)
136
137 # -----------------------------------------------------------------------------
138 # Add module directories
139 # -----------------------------------------------------------------------------
140 add_subdirectory(Source)
141
142 # -----------------------------------------------------------------------------
143 # Add tools
144 # -----------------------------------------------------------------------------
145 if (ENABLE_TOOLS)
146     add_subdirectory(Tools)
147 endif ()
148
149 # -----------------------------------------------------------------------------
150 # Print the features list last, for maximum visibility.
151 # -----------------------------------------------------------------------------
152 PRINT_WEBKIT_OPTIONS()
153
154 # -----------------------------------------------------------------------------
155 # Create the configuration header
156 # -----------------------------------------------------------------------------
157 CREATE_CONFIGURATION_HEADER()