[WPE] Do not hardcode WPEBackend-fdo library name for linking tests
[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     ${GSTREAMER_INCLUDE_DIRS}
27     ${GSTREAMER_AUDIO_INCLUDE_DIRS}
28     ${LIBSOUP_INCLUDE_DIRS}
29     ${WPE_INCLUDE_DIRS}
30     ${WPEBACKEND_FDO_INCLUDE_DIRS}
31 )
32
33 set(test_main_SOURCES
34     ${TESTWEBKITAPI_DIR}/generic/main.cpp
35 )
36
37 set(bundle_harness_SOURCES
38     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
39     ${TESTWEBKITAPI_DIR}/wpe/InjectedBundleControllerWPE.cpp
40     ${TESTWEBKITAPI_DIR}/wpe/PlatformUtilitiesWPE.cpp
41 )
42
43 set(webkit_api_harness_SOURCES
44     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
45     ${TESTWEBKITAPI_DIR}/wpe/PlatformUtilitiesWPE.cpp
46     ${TESTWEBKITAPI_DIR}/wpe/PlatformWebViewWPE.cpp
47 )
48
49 # TestWTF
50
51 list(APPEND TestWTF_SOURCES
52     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
53     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
54     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
55 )
56
57 # TestWebCore
58
59 add_executable(TestWebCore
60     ${test_main_SOURCES}
61     ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp
62     ${TESTWEBKITAPI_DIR}/TestsController.cpp
63     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp
64     ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GstMappedBuffer.cpp
65     ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GStreamerTest.cpp
66     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
67     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URLParserTextEncoding.cpp
73 )
74
75 target_link_libraries(TestWebCore ${test_webcore_LIBRARIES})
76 add_dependencies(TestWebCore ${TestWebKitAPI_DEPENDENCIES})
77
78 add_test(TestWebCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/TestWebCore)
79 set_tests_properties(TestWebCore PROPERTIES TIMEOUT 60)
80 set_target_properties(TestWebCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore)
81
82 # TestWebKit
83
84 list(APPEND test_webkit_api_LIBRARIES
85     WPEToolingBackends
86 )
87
88 add_executable(TestWebKit ${test_webkit_api_SOURCES})
89
90 target_link_libraries(TestWebKit ${test_webkit_api_LIBRARIES})
91 add_test(TestWebKit ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit/TestWebKit)
92 set_tests_properties(TestWebKit PROPERTIES TIMEOUT 60)
93 set_target_properties(TestWebKit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit)
94
95 # TestWebKitAPIBase
96 list(APPEND TestWebKitAPIBase_LIBRARIES ${WPEBACKEND_FDO_LIBRARIES})
97 list(APPEND TestWebKitAPI_LIBRARIES ${WPEBACKEND_FDO_LIBRARIES})
98 list(APPEND TestWebKitAPIBase_SOURCES
99     ${TOOLS_DIR}/wpe/backends/ViewBackend.cpp
100     ${TOOLS_DIR}/wpe/backends/HeadlessViewBackend.cpp
101 )
102
103 # TestJSC
104
105 add_definitions(-DWEBKIT_SRC_DIR="${CMAKE_SOURCE_DIR}")
106 add_executable(TestJSC ${TESTWEBKITAPI_DIR}/Tests/JavaScriptCore/glib/TestJSC.cpp)
107 target_link_libraries(TestJSC
108     ${GLIB_LIBRARIES}
109     ${GLIB_GMODULE_LIBRARIES}
110     JavaScriptCore
111 )
112 add_test(TestJSC ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJSC)
113 add_dependencies(TestJSC ${TestWebKitAPI_DEPENDENCIES})
114 set_tests_properties(TestJSC PROPERTIES TIMEOUT 60)
115 set_target_properties(TestJSC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
116
117 # Add an intermediate target between TestJSC and JavaScriptCore to ensure derived headers are copied into the forwarding header directory.
118 add_custom_target(pre-TestJSC DEPENDS JavaScriptCore)
119 add_dependencies(TestJSC pre-TestJSC)
120
121 if (COMPILER_IS_GCC_OR_CLANG)
122     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
123                                             -Wno-undef
124                                             -Wno-unused-parameter)
125     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit -Wno-sign-compare
126                                            -Wno-undef
127                                            -Wno-unused-parameter)
128     WEBKIT_ADD_TARGET_CXX_FLAGS(TestJSC -Wno-sign-compare
129                                         -Wno-undef
130                                         -Wno-unused-parameter)
131 endif ()