[GTK][WPE] TestWTF and TestJSC fail to compile due to missing forwarding headers
[WebKit-https.git] / Tools / TestWebKitAPI / PlatformGTK.cmake
1 set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI")
2 set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF "${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF")
3
4 # This is necessary because it is possible to build TestWebKitAPI with WebKit
5 # disabled and this triggers the inclusion of the WebKit headers.
6 add_definitions(-DBUILDING_WEBKIT2__)
7
8 add_custom_target(TestWebKitAPI-forwarding-headers
9     COMMAND ${PERL_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-forwarding-headers.pl --include-path ${TESTWEBKITAPI_DIR} --output ${FORWARDING_HEADERS_DIR} --platform gtk --platform soup
10     DEPENDS WebKit-forwarding-headers
11 )
12
13 set(ForwardingHeadersForTestWebKitAPI_NAME TestWebKitAPI-forwarding-headers PALForwardingHeaders)
14
15 include_directories(
16     ${FORWARDING_HEADERS_DIR}
17     ${FORWARDING_HEADERS_DIR}/JavaScriptCore
18     ${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib
19     ${DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR}
20     ${WEBKIT_DIR}/UIProcess/API/C/soup
21     ${WEBKIT_DIR}/UIProcess/API/C/gtk
22     ${WEBKIT_DIR}/UIProcess/API/gtk
23 )
24
25 include_directories(SYSTEM
26     ${GDK3_INCLUDE_DIRS}
27     ${GLIB_INCLUDE_DIRS}
28     ${GTK3_INCLUDE_DIRS}
29     ${LIBSOUP_INCLUDE_DIRS}
30 )
31
32 set(test_main_SOURCES
33     ${TESTWEBKITAPI_DIR}/gtk/main.cpp
34 )
35
36 set(bundle_harness_SOURCES
37     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
38     ${TESTWEBKITAPI_DIR}/gtk/InjectedBundleControllerGtk.cpp
39     ${TESTWEBKITAPI_DIR}/gtk/PlatformUtilitiesGtk.cpp
40 )
41
42 set(webkit_api_harness_SOURCES
43     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
44     ${TESTWEBKITAPI_DIR}/gtk/PlatformUtilitiesGtk.cpp
45     ${TESTWEBKITAPI_DIR}/gtk/PlatformWebViewGtk.cpp
46 )
47
48 list(APPEND test_wtf_LIBRARIES
49     ${GDK3_LIBRARIES}
50     ${GTK3_LIBRARIES}
51 )
52
53 list(APPEND test_webkit_api_LIBRARIES
54     ${GDK3_LIBRARIES}
55     ${GTK3_LIBRARIES}
56 )
57
58 list(APPEND test_webcore_LIBRARIES
59     WebCorePlatformGTK
60     ${GDK3_LIBRARIES}
61     ${GTK3_LIBRARIES}
62 )
63 ADD_WHOLE_ARCHIVE_TO_LIBRARIES(test_webcore_LIBRARIES)
64
65 list(APPEND TestWebKitAPI_LIBRARIES
66     ${GDK3_LIBRARIES}
67     ${GTK3_LIBRARIES}
68 )
69
70 list(APPEND TestJavaScriptCore_LIBRARIES
71     ${GDK3_LIBRARIES}
72     ${GTK3_LIBRARIES}
73 )
74
75 list(APPEND test_webkit_api_SOURCES
76     ${TESTWEBKITAPI_DIR}/Tests/WebKit/gtk/InputMethodFilter.cpp
77 )
78
79 add_executable(TestWebKit ${test_webkit_api_SOURCES})
80
81 target_link_libraries(TestWebKit ${test_webkit_api_LIBRARIES})
82 add_test(TestWebKit ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit/TestWebKit)
83 set_tests_properties(TestWebKit PROPERTIES TIMEOUT 60)
84 set_target_properties(TestWebKit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit)
85
86 add_executable(TestWebCore
87     ${test_main_SOURCES}
88     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
89     ${TESTWEBKITAPI_DIR}/TestsController.cpp
90     ${TESTWEBKITAPI_DIR}/Tests/WebCore/CSSParser.cpp
91     ${TESTWEBKITAPI_DIR}/Tests/WebCore/ComplexTextController.cpp
92     ${TESTWEBKITAPI_DIR}/Tests/WebCore/DNS.cpp
93     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp
94     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileSystem.cpp
95     ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp
96     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
97     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
98     ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
99     ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
100     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
101     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
102     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
103     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URL.cpp
104     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URLParser.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WebCore/UserAgentQuirks.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SampleMap.cpp
107 )
108
109 target_link_libraries(TestWebCore ${test_webcore_LIBRARIES})
110 add_dependencies(TestWebCore ${ForwardingHeadersForTestWebKitAPI_NAME})
111
112 add_test(TestWebCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/TestWebCore)
113 set_tests_properties(TestWebCore PROPERTIES TIMEOUT 60)
114 set_target_properties(TestWebCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore)
115
116 list(APPEND TestWTF_SOURCES
117     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
118     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
119     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
120 )
121
122 add_definitions(-DWEBKIT_SRC_DIR="${CMAKE_SOURCE_DIR}")
123 add_executable(TestJSC ${TESTWEBKITAPI_DIR}/Tests/JavaScriptCore/glib/TestJSC.cpp)
124 target_link_libraries(TestJSC
125     ${GLIB_LIBRARIES}
126     JavaScriptCore
127 )
128 add_dependencies(TestJSC ${ForwardingHeadersForTestWebKitAPI_NAME})
129 add_test(TestJSC ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJSC)
130 set_tests_properties(TestJSC PROPERTIES TIMEOUT 60)
131 set_target_properties(TestJSC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
132
133 if (COMPILER_IS_GCC_OR_CLANG)
134     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit -Wno-sign-compare
135                                            -Wno-undef
136                                            -Wno-unused-parameter)
137
138     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
139                                             -Wno-undef
140                                             -Wno-unused-parameter)
141
142     WEBKIT_ADD_TARGET_CXX_FLAGS(TestJSC -Wno-sign-compare
143                                         -Wno-undef
144                                         -Wno-unused-parameter)
145 endif ()