[EFL][CMake] Integrate API unit tests with CTest
[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
11 # -----------------------------------------------------------------------------
12 # Enable CTest for the public API unit testing
13 # -----------------------------------------------------------------------------
14 ENABLE_TESTING()
15
16 # -----------------------------------------------------------------------------
17 # Default library type
18 # -----------------------------------------------------------------------------
19 SET(ENABLE_WEBCORE ON)
20
21 IF (NOT ENABLE_WEBKIT AND NOT ENABLE_WEBKIT2)
22     SET(ENABLE_WEBKIT ON)
23 ENDIF ()
24
25 SET(ENABLE_TOOLS ON)
26
27 SET(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
28 SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
29 SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
30 SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
31 SET(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
32 SET(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
33
34 SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
35
36 SET(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
37 SET(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
38 SET(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
39 SET(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
40 SET(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
41
42 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
43
44 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
45 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
46 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
47
48 INCLUDE(WebKitMacros)
49 INCLUDE(WebKitFS)
50 INCLUDE(WebKitHelpers)
51 INCLUDE(WebKitFeatures)
52
53 # -----------------------------------------------------------------------------
54 # Determine which port will be built
55 # -----------------------------------------------------------------------------
56 SET(ALL_PORTS Efl WinCE BlackBerry)
57 SET(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
58
59 LIST(FIND ALL_PORTS ${PORT} RET)
60 IF (${RET} EQUAL -1)
61     MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
62 ENDIF ()
63
64 STRING(TOLOWER ${PORT} WEBKIT_PORT_DIR)
65
66 # -----------------------------------------------------------------------------
67 # Find common packages (used by all ports)
68 # -----------------------------------------------------------------------------
69 FIND_PACKAGE(BISON REQUIRED)
70 FIND_PACKAGE(FLEX REQUIRED)
71 FIND_PACKAGE(Gperf REQUIRED)
72 FIND_PACKAGE(Perl REQUIRED)
73 FIND_PACKAGE(PythonInterp REQUIRED)
74
75 # -----------------------------------------------------------------------------
76 # Determine the target processor
77 # -----------------------------------------------------------------------------
78 STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
79 IF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
80     SET(WTF_CPU_ARM 1)
81 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
82     SET(WTF_CPU_MIPS 1)
83 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
84     SET(WTF_CPU_X86_64 1)
85 ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
86     SET(WTF_CPU_X86 1)
87 ELSE ()
88     MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
89 ENDIF ()
90
91 # -----------------------------------------------------------------------------
92 # Determine the operating system
93 # -----------------------------------------------------------------------------
94 IF (UNIX)
95     IF (APPLE)
96         SET(WTF_OS_MAC_OS_X 1)
97     ELSE ()
98         SET(WTF_OS_UNIX 1)
99     ENDIF ()
100 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
101     SET(WTF_OS_WINDOWS 1)
102 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "QNX")
103     SET(WTF_OS_QNX 1)
104     SET(WTF_OS_UNIX 1)
105 ELSE ()
106     MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
107 ENDIF ()
108
109 # -----------------------------------------------------------------------------
110 # Default target names (can be overrriden in Options${PORT}.cmake file)
111 # -----------------------------------------------------------------------------
112 SET(JSC_EXECUTABLE_NAME JSC)
113 SET(WTF_LIBRARY_NAME WTF)
114 SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
115 SET(WebCore_LIBRARY_NAME WebCore)
116 SET(WebKit_LIBRARY_NAME WebKit)
117 SET(WebKit2_LIBRARY_NAME WebKit2)
118 SET(WebCoreTestSupport_LIBRARY_NAME WebCoreTestSupport)
119
120 # -----------------------------------------------------------------------------
121 # Default library types
122 # -----------------------------------------------------------------------------
123 OPTION(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
124
125 IF (SHARED_CORE)
126     SET(JavaScriptCore_LIBRARY_TYPE SHARED)
127     SET(WebCore_LIBRARY_TYPE SHARED)
128 ELSE ()
129     SET(JavaScriptCore_LIBRARY_TYPE STATIC)
130     SET(WebCore_LIBRARY_TYPE STATIC)
131 ENDIF ()
132
133 SET(WebKit_LIBRARY_TYPE SHARED)
134 SET(WebKit2_LIBRARY_TYPE SHARED)
135 SET(WebCoreTestSupport_LIBRARY_TYPE STATIC)
136
137 # -----------------------------------------------------------------------------
138 # Port-specific options
139 # -----------------------------------------------------------------------------
140 INCLUDE(OptionsCommon)
141 INCLUDE(Options${PORT})
142
143 # -----------------------------------------------------------------------------
144 # Install JavaScript shell
145 # -----------------------------------------------------------------------------
146 OPTION(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
147
148 # -----------------------------------------------------------------------------
149 # Define packaging
150 # -----------------------------------------------------------------------------
151 INCLUDE(WebKitPackaging)
152
153 # -----------------------------------------------------------------------------
154 # Add module directories
155 # -----------------------------------------------------------------------------
156 ADD_SUBDIRECTORY(Source)
157
158 # -----------------------------------------------------------------------------
159 # Add tools
160 # -----------------------------------------------------------------------------
161 IF (ENABLE_TOOLS)
162     ADD_SUBDIRECTORY(Tools)
163 ENDIF ()
164