[CMake] Properly test if compiler supports compiler flags
[WebKit-https.git] / Tools / WebKitTestRunner / CMakeLists.txt
1 set(WEBKIT_TESTRUNNER_DIR "${TOOLS_DIR}/WebKitTestRunner")
2 set(WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR "${TOOLS_DIR}/WebKitTestRunner/InjectedBundle")
3 set(WEBKIT_TESTRUNNER_SHARED_DIR "${TOOLS_DIR}/TestRunnerShared/")
4 set(WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR "${WEBKIT_TESTRUNNER_SHARED_DIR}/UIScriptContext")
5 set(WEBKIT_TESTRUNNER_BINDINGS_DIR "${WEBKIT_TESTRUNNER_SHARED_DIR}/Bindings")
6
7 file(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/InjectedBundle)
8 file(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/UIScriptContext)
9
10 set(WebKitTestRunner_SOURCES
11     ${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp
12     ${WEBKIT_TESTRUNNER_DIR}/GeolocationProviderMock.cpp
13     ${WEBKIT_TESTRUNNER_DIR}/Options.cpp
14     ${WEBKIT_TESTRUNNER_DIR}/PixelDumpSupport.cpp
15     ${WEBKIT_TESTRUNNER_DIR}/TestController.cpp
16     ${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp
17     ${WEBKIT_TESTRUNNER_DIR}/TestOptions.cpp
18     ${WEBKIT_TESTRUNNER_DIR}/WebNotificationProvider.cpp
19     ${WEBKIT_TESTRUNNER_DIR}/WorkQueueManager.cpp
20     ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/UIScriptContext.cpp
21     ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/UIScriptController.cpp
22     ${WEBKIT_TESTRUNNER_BINDINGS_DIR}/JSWrapper.cpp
23 )
24
25 set(WebKitTestRunner_LIBRARIES
26     JavaScriptCore
27     WebCoreTestSupport
28     WebKit2
29 )
30
31 set(WebKitTestRunner_INCLUDE_DIRECTORIES
32     ${WEBKIT_TESTRUNNER_DIR}
33     ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle
34     ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle/Bindings
35     ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle/atk
36     ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}
37     ${WEBKIT_TESTRUNNER_BINDINGS_DIR}
38     ${WEBCORE_DIR}/testing/js
39     ${WEBKIT2_DIR}/Platform/IPC
40     ${WEBKIT2_DIR}/Shared
41     ${WEBKIT2_DIR}/Shared/API/c
42     ${WEBKIT2_DIR}/Shared/Plugins
43     ${WEBKIT2_DIR}/UIProcess
44     ${WEBKIT2_DIR}/UIProcess/API/C/soup
45     ${WEBKIT2_DIR}/WebProcess/InjectedBundle
46     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
47     ${DERIVED_SOURCES_DIR}/InjectedBundle
48     ${DERIVED_SOURCES_DIR}/UIScriptContext
49     ${CMAKE_SOURCE_DIR}/Source
50 )
51
52 set(WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES
53     ${LIBSOUP_INCLUDE_DIRS}
54     ${ICU_INCLUDE_DIRS}
55 )
56
57 set(WebKitTestRunnerInjectedBundle_SOURCES
58     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityController.cpp
59     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityTextMarker.cpp
60     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityTextMarkerRange.cpp
61     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityUIElement.cpp
62     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/EventSendingController.cpp
63     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/GCController.cpp
64     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundle.cpp
65     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundleMain.cpp
66     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundlePage.cpp
67     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/TestRunner.cpp
68     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/TextInputController.cpp
69
70     ${WEBKIT_TESTRUNNER_BINDINGS_DIR}/JSWrapper.cpp
71 )
72
73 set(WebKitTestRunnerInjectedBundle_IDL_FILES
74     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/AccessibilityController.idl"
75     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/AccessibilityTextMarker.idl"
76     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/AccessibilityTextMarkerRange.idl"
77     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/AccessibilityUIElement.idl"
78     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/EventSendingController.idl"
79     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/GCController.idl"
80     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/TestRunner.idl"
81     "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/TextInputController.idl"
82 )
83
84 set(WebKitTestRunner_IDL_FILES
85     "${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/Bindings/UIScriptController.idl"
86 )
87
88 GENERATE_BINDINGS(WebKitTestRunnerInjectedBundleBindings
89     OUTPUT_SOURCE WebKitTestRunnerInjectedBundle_SOURCES
90     INPUT_FILES ${WebKitTestRunnerInjectedBundle_IDL_FILES}
91     BASE_DIR ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
92     IDL_INCLUDES ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
93     FEATURES ${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}
94     DESTINATION ${DERIVED_SOURCES_DIR}/InjectedBundle
95     GENERATOR TestRunner)
96
97 GENERATE_BINDINGS(WebKitTestRunnerBindings
98     OUTPUT_SOURCE WebKitTestRunner_SOURCES
99     INPUT_FILES ${WebKitTestRunner_IDL_FILES}
100     BASE_DIR ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
101     IDL_INCLUDES ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
102     FEATURES ${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}
103     DESTINATION ${DERIVED_SOURCES_DIR}/UIScriptContext
104     GENERATOR TestRunner)
105
106 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
107
108 include_directories(${WebKitTestRunner_INCLUDE_DIRECTORIES})
109 include_directories(SYSTEM ${WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES})
110
111 add_library(TestRunnerInjectedBundle SHARED ${WebKitTestRunnerInjectedBundle_SOURCES})
112 target_link_libraries(TestRunnerInjectedBundle ${WebKitTestRunner_LIBRARIES})
113 add_dependencies(TestRunnerInjectedBundle WebKitTestRunnerInjectedBundleBindings)
114
115 add_executable(WebKitTestRunner ${WebKitTestRunner_SOURCES})
116 target_link_libraries(WebKitTestRunner ${WebKitTestRunner_LIBRARIES})
117 add_dependencies(WebKitTestRunner WebKitTestRunnerBindings)
118
119 if (COMPILER_IS_GCC_OR_CLANG)
120     WEBKIT_ADD_TARGET_CXX_FLAGS(TestRunnerInjectedBundle -Wno-unused-parameter)
121     WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitTestRunner -Wno-unused-parameter)
122 endif ()
123
124 if (NOT APPLE)
125     add_dependencies(WebKit2 ${ForwardingHeadersForWebKitTestRunner_NAME})
126 endif ()