Add generic entrypoint and run loop in TestWebKitAPI
[WebKit-https.git] / Tools / TestWebKitAPI / PlatformWPE.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 WebKit2
5 # disabled and this triggers the inclusion of the WebKit2 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 wpe --platform soup
10     DEPENDS webkitwpe-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_JAVASCRIPCOREWPE_DIR}
20     ${TOOLS_DIR}/wpe/backends
21 )
22
23 include_directories(SYSTEM
24     ${CAIRO_INCLUDE_DIRS}
25     ${GLIB_INCLUDE_DIRS}
26     ${LIBSOUP_INCLUDE_DIRS}
27     ${WPE_INCLUDE_DIRS}
28     ${WPEBACKEND_FDO_INCLUDE_DIRS}
29 )
30
31 set(test_main_SOURCES
32     ${TESTWEBKITAPI_DIR}/generic/main.cpp
33 )
34
35 set(bundle_harness_SOURCES
36     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
37     ${TESTWEBKITAPI_DIR}/wpe/InjectedBundleControllerWPE.cpp
38     ${TESTWEBKITAPI_DIR}/wpe/PlatformUtilitiesWPE.cpp
39 )
40
41 set(webkit_api_harness_SOURCES
42     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
43     ${TESTWEBKITAPI_DIR}/wpe/PlatformUtilitiesWPE.cpp
44     ${TESTWEBKITAPI_DIR}/wpe/PlatformWebViewWPE.cpp
45 )
46
47 # TestWTF
48
49 list(APPEND TestWTF_SOURCES
50     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
51     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
52     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
53 )
54
55 # TestWebCore
56
57 add_executable(TestWebCore
58     ${test_main_SOURCES}
59     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
60     ${TESTWEBKITAPI_DIR}/TestsController.cpp
61     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
62     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
63     ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
64     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URL.cpp
65     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
66     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
67     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileSystem.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
70 )
71
72 target_link_libraries(TestWebCore ${test_webcore_LIBRARIES})
73 add_dependencies(TestWebCore ${TestWebKitAPI_DEPENDENCIES})
74
75 add_test(TestWebCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/TestWebCore)
76 set_tests_properties(TestWebCore PROPERTIES TIMEOUT 60)
77 set_target_properties(TestWebCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore)
78
79 # TestWebKit
80
81 list(APPEND test_webkit_api_LIBRARIES
82     WPEToolingBackends
83 )
84
85 add_executable(TestWebKit ${test_webkit_api_SOURCES})
86
87 target_link_libraries(TestWebKit ${test_webkit_api_LIBRARIES})
88 add_test(TestWebKit ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit/TestWebKit)
89 set_tests_properties(TestWebKit PROPERTIES TIMEOUT 60)
90 set_target_properties(TestWebKit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit)
91
92 # TestJSC
93
94 add_definitions(-DWEBKIT_SRC_DIR="${CMAKE_SOURCE_DIR}")
95 add_executable(TestJSC ${TESTWEBKITAPI_DIR}/Tests/JavaScriptCore/glib/TestJSC.cpp)
96 target_link_libraries(TestJSC
97     ${GLIB_LIBRARIES}
98     JavaScriptCore
99 )
100 add_test(TestJSC ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJSC)
101 add_dependencies(TestJSC ${TestWebKitAPI_DEPENDENCIES})
102 set_tests_properties(TestJSC PROPERTIES TIMEOUT 60)
103 set_target_properties(TestJSC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
104
105 if (COMPILER_IS_GCC_OR_CLANG)
106     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
107                                             -Wno-undef
108                                             -Wno-unused-parameter)
109     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit -Wno-sign-compare
110                                            -Wno-undef
111                                            -Wno-unused-parameter)
112     WEBKIT_ADD_TARGET_CXX_FLAGS(TestJSC -Wno-sign-compare
113                                         -Wno-undef
114                                         -Wno-unused-parameter)
115 endif ()