[CMake] Remove unnecessary include paths in TestWebKitAPI cmake files
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
1 set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2 set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI")
3
4 include_directories(${CMAKE_BINARY_DIR}
5     ${TESTWEBKITAPI_DIR}
6     ${CMAKE_SOURCE_DIR}/Source
7     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
8     ${DERIVED_SOURCES_WEBCORE_DIR}
9     ${JAVASCRIPTCORE_DIR}
10     ${JAVASCRIPTCORE_DIR}/API
11     ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
12     ${THIRDPARTY_DIR}/gtest/include
13     ${WEBCORE_DIR}/css
14     ${WEBCORE_DIR}/dom
15     ${WEBCORE_DIR}/editing
16     ${WEBCORE_DIR}/loader/cache
17     ${WEBCORE_DIR}/platform
18     ${WEBCORE_DIR}/platform/animation
19     ${WEBCORE_DIR}/platform/graphics
20     ${WEBCORE_DIR}/platform/text
21     ${WEBCORE_DIR}/platform/network
22     ${WEBCORE_DIR}/platform/network/soup
23     ${WEBCORE_DIR}/rendering/style
24     ${WEBKIT2_DIR}/Platform/IPC
25     ${WEBKIT2_DIR}/Shared
26     ${WEBKIT2_DIR}/Shared/API
27     ${WEBKIT2_DIR}/Shared/API/c
28     ${WEBKIT2_DIR}/Shared/Plugins
29     ${WEBKIT2_DIR}/UIProcess
30     ${WEBKIT2_DIR}/UIProcess/API
31     ${WEBKIT2_DIR}/WebProcess/InjectedBundle
32     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
33     ${WTF_DIR}
34 )
35
36 set(test_wtf_LIBRARIES
37     WTF
38     gtest
39 )
40
41 set(test_webcore_LIBRARIES
42     gtest
43     WTF
44     WebCore
45 )
46
47 set(test_webkit2_api_LIBRARIES
48     TestWebKitAPIBase
49     WTF
50     JavaScriptCore
51     WebKit2
52     gtest
53 )
54
55 set(TestWebKitAPI_LIBRARIES
56     WTF
57     WebKit2
58 )
59
60 set(TestJavaScriptCore_LIBRARIES
61     gtest
62     JavaScriptCore
63 )
64
65 set(TestWTF_SOURCES
66     ${TESTWEBKITAPI_DIR}/Counters.cpp
67     ${TESTWEBKITAPI_DIR}/TestsController.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WTF/DateMath.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
73     ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
74     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
75     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
76     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
77     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
78     ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
79     ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
80     ${TESTWEBKITAPI_DIR}/Tests/WTF/MediaTime.cpp
81     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
82     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
83     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
84     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
85     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
86     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
87     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
88     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
89     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
90     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
91     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
92     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
93     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
94     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
95     ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkQueue.cpp
96 )
97
98 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
99
100 add_library(TestWebKitAPIInjectedBundle SHARED
101     ${bundle_harness_SOURCES}
102     ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
103     ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
104     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp
107     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
108     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
109     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
110     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
111     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
112     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
113     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
114     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
115     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
116     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
117     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
118     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
119     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
120     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
121     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
122     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
123     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
124     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
125     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
126     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
127 )
128
129 target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
130 add_dependencies(TestWebKitAPIInjectedBundle ${ForwardingHeadersForTestWebKitAPI_NAME})
131
132 get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
133
134 add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DGTEST_HAS_RTTI=0
135     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
136     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
137 )
138
139 # FIXME: This works around compatibility problems in the old version of the third-pary
140 # googletest source code checkout. It should be removed once we upgrade to a newer version.
141 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
142     add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
143 endif ()
144
145 add_executable(TestWTF
146     ${test_main_SOURCES}
147     ${TestWTF_SOURCES}
148 )
149
150 target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
151 add_dependencies(TestWTF ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
152 add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF/TestWTF)
153 set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
154     set_target_properties(TestWTF PROPERTIES
155         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF
156     )
157
158
159 add_executable(TestJavaScriptCore
160     ${test_main_SOURCES}
161     ${TESTWEBKITAPI_DIR}/TestsController.cpp
162 )
163
164 target_link_libraries(TestJavaScriptCore ${TestJavaScriptCore_LIBRARIES})
165 add_dependencies(TestJavaScriptCore ${ForwardingHeadersForTestWebKitAPI_NAME})
166
167 add_test(TestJavaScriptCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJavaScriptCore)
168 set_tests_properties(TestJavaScriptCore PROPERTIES TIMEOUT 60)
169 set_target_properties(TestJavaScriptCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
170 add_dependencies(TestJavaScriptCore JavaScriptCore ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
171
172 foreach (testName ${test_webcore_BINARIES})
173     add_executable(${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
174     add_test(${testName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/${testName})
175     set_tests_properties(${testName} PROPERTIES TIMEOUT 60)
176     target_link_libraries(${testName} ${test_webcore_LIBRARIES})
177     set_target_properties(${testName} PROPERTIES
178         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore
179     )
180 endforeach ()
181
182 add_library(TestWebKitAPIBase
183     ${test_main_SOURCES}
184     ${webkit2_api_harness_SOURCES}
185     ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
186     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
187     ${TESTWEBKITAPI_DIR}/TestsController.cpp
188 )
189
190 add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
191
192 foreach (testName ${test_webkit2_api_BINARIES})
193     get_filename_component(testBaseName ${testName} NAME)
194     add_executable(${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
195     add_test(${testBaseName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/${testBaseName})
196     set_tests_properties(${testBaseName} PROPERTIES TIMEOUT 60)
197     target_link_libraries(${testBaseName} ${test_webkit2_api_LIBRARIES})
198     set_target_properties(${testBaseName} PROPERTIES
199         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
200     )
201 endforeach ()
202
203 # We don't run tests that are expected to fail. We could use the WILL_FAIL
204 # property, but it reports failure when the test crashes or timeouts and would
205 # make the bot red.
206 foreach (testName ${test_webkit2_api_fail_BINARIES})
207     add_executable(${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
208     target_link_libraries(${testName} ${test_webkit2_api_LIBRARIES})
209     set_target_properties(${testName} PROPERTIES
210         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/failure
211     )
212 endforeach ()