InjectedBundle parameters often need initialization function called before unarchiving
[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 list(APPEND TestWebKitAPI_DEPENDENCIES TestWebKitAPI-forwarding-headers)
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     ${GSTREAMER_INCLUDE_DIRS}
29     ${GSTREAMER_AUDIO_INCLUDE_DIRS}
30     ${GTK3_INCLUDE_DIRS}
31     ${LIBSOUP_INCLUDE_DIRS}
32 )
33
34 set(test_main_SOURCES
35     ${TESTWEBKITAPI_DIR}/gtk/main.cpp
36 )
37
38 set(bundle_harness_SOURCES
39     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
40     ${TESTWEBKITAPI_DIR}/gtk/InjectedBundleControllerGtk.cpp
41     ${TESTWEBKITAPI_DIR}/gtk/PlatformUtilitiesGtk.cpp
42 )
43
44 set(webkit_api_harness_SOURCES
45     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
46     ${TESTWEBKITAPI_DIR}/gtk/PlatformUtilitiesGtk.cpp
47     ${TESTWEBKITAPI_DIR}/gtk/PlatformWebViewGtk.cpp
48 )
49
50 list(APPEND test_wtf_LIBRARIES
51     ${GDK3_LIBRARIES}
52     ${GTK3_LIBRARIES}
53 )
54
55 list(APPEND test_webkit_api_LIBRARIES
56     ${GDK3_LIBRARIES}
57     ${GTK3_LIBRARIES}
58 )
59
60 list(APPEND test_webcore_LIBRARIES
61     WebCorePlatformGTK
62     ${GDK3_LIBRARIES}
63     ${GTK3_LIBRARIES}
64 )
65 ADD_WHOLE_ARCHIVE_TO_LIBRARIES(test_webcore_LIBRARIES)
66
67 list(APPEND TestWebKitAPI_LIBRARIES
68     ${GDK3_LIBRARIES}
69     ${GTK3_LIBRARIES}
70 )
71
72 list(APPEND TestJavaScriptCore_LIBRARIES
73     ${GDK3_LIBRARIES}
74     ${GTK3_LIBRARIES}
75 )
76
77 list(APPEND test_webkit_api_SOURCES
78     ${TESTWEBKITAPI_DIR}/Tests/WebKit/gtk/InputMethodFilter.cpp
79 )
80
81 add_executable(TestWebKit ${test_webkit_api_SOURCES})
82
83 target_link_libraries(TestWebKit ${test_webkit_api_LIBRARIES})
84 add_test(TestWebKit ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit/TestWebKit)
85 set_tests_properties(TestWebKit PROPERTIES TIMEOUT 60)
86 set_target_properties(TestWebKit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit)
87
88 add_executable(TestWebCore
89     ${test_main_SOURCES}
90     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
91     ${TESTWEBKITAPI_DIR}/TestsController.cpp
92     ${TESTWEBKITAPI_DIR}/Tests/WebCore/AbortableTaskQueue.cpp
93     ${TESTWEBKITAPI_DIR}/Tests/WebCore/CSSParser.cpp
94     ${TESTWEBKITAPI_DIR}/Tests/WebCore/ComplexTextController.cpp
95     ${TESTWEBKITAPI_DIR}/Tests/WebCore/DNS.cpp
96     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp
97     ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GstMappedBuffer.cpp
98     ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GStreamerTest.cpp
99     ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp
100     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
101     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
102     ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
103     ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
104     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SampleMap.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
107     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
108     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URLParserTextEncoding.cpp
109     ${TESTWEBKITAPI_DIR}/Tests/WebCore/UserAgentQuirks.cpp
110 )
111
112 target_link_libraries(TestWebCore ${test_webcore_LIBRARIES})
113 add_dependencies(TestWebCore ${TestWebKitAPI_DEPENDENCIES})
114
115 add_test(TestWebCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/TestWebCore)
116 set_tests_properties(TestWebCore PROPERTIES TIMEOUT 60)
117 set_target_properties(TestWebCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore)
118
119 list(APPEND TestWTF_SOURCES
120     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
121     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
122     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
123 )
124
125 add_definitions(-DWEBKIT_SRC_DIR="${CMAKE_SOURCE_DIR}")
126 add_executable(TestJSC ${TESTWEBKITAPI_DIR}/Tests/JavaScriptCore/glib/TestJSC.cpp)
127 target_link_libraries(TestJSC
128     ${GLIB_LIBRARIES}
129     JavaScriptCore
130 )
131 add_dependencies(TestJSC ${TestWebKitAPI_DEPENDENCIES})
132 add_test(TestJSC ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJSC)
133 set_tests_properties(TestJSC PROPERTIES TIMEOUT 60)
134 set_target_properties(TestJSC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
135
136 if (COMPILER_IS_GCC_OR_CLANG)
137     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit -Wno-sign-compare
138                                            -Wno-undef
139                                            -Wno-unused-parameter)
140
141     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
142                                             -Wno-undef
143                                             -Wno-unused-parameter)
144
145     WEBKIT_ADD_TARGET_CXX_FLAGS(TestJSC -Wno-sign-compare
146                                         -Wno-undef
147                                         -Wno-unused-parameter)
148 endif ()