Fix CMake build.
[WebKit-https.git] / Source / WebKit / PlatformMac.cmake
1 find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices)
2 find_library(QUARTZ_LIBRARY Quartz)
3 add_definitions(-iframework ${QUARTZ_LIBRARY}/Frameworks)
4 add_definitions(-iframework ${APPLICATIONSERVICES_LIBRARY}/Versions/Current/Frameworks)
5 link_directories(../../WebKitLibraries)
6
7 list(APPEND WebKit_INCLUDE_DIRECTORIES
8     "${DERIVED_SOURCES_DIR}"
9     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
10     "${DERIVED_SOURCES_WEBCORE_DIR}"
11     "${DERIVED_SOURCES_WEBKITLEGACY_DIR}"
12     "${JAVASCRIPTCORE_DIR}"
13     "${JAVASCRIPTCORE_DIR}/dfg"
14     "${WEBCORE_DIR}/accessibility/mac"
15     "${WEBCORE_DIR}/bindings/objc"
16     "${WEBCORE_DIR}/bridge"
17     "${WEBCORE_DIR}/bridge/jsc"
18     "${WEBCORE_DIR}/bridge/objc"
19     "${WEBCORE_DIR}/ForwardingHeaders/inspector"
20     "${WEBCORE_DIR}/html/track"
21     "${WEBCORE_DIR}/loader/archive/cf"
22     "${WEBCORE_DIR}/loader/cf"
23     "${WEBCORE_DIR}/loader/mac"
24     "${WEBCORE_DIR}/page/cocoa"
25     "${WEBCORE_DIR}/page/mac"
26     "${WEBCORE_DIR}/platform/cf"
27     "${WEBCORE_DIR}/platform/cocoa"
28     "${WEBCORE_DIR}/platform/graphics/avfoundation"
29     "${WEBCORE_DIR}/platform/graphics/avfoundation/cf"
30     "${WEBCORE_DIR}/platform/graphics/avfoundation/objc"
31     "${WEBCORE_DIR}/platform/graphics/ca"
32     "${WEBCORE_DIR}/platform/graphics/ca/mac"
33     "${WEBCORE_DIR}/platform/graphics/cocoa"
34     "${WEBCORE_DIR}/platform/graphics/cg"
35     "${WEBCORE_DIR}/platform/graphics/opentype"
36     "${WEBCORE_DIR}/platform/graphics/mac"
37     "${WEBCORE_DIR}/platform/mac"
38     "${WEBCORE_DIR}/platform/network/cocoa"
39     "${WEBCORE_DIR}/platform/network/cf"
40     "${WEBCORE_DIR}/platform/network/mac"
41     "${WEBCORE_DIR}/platform/text/cf"
42     "${WEBCORE_DIR}/platform/text/mac"
43     "${WEBCORE_DIR}/plugins/mac"
44     "${WEBCORE_DIR}/rendering/shapes"
45     "${WTF_DIR}"
46     ../../WebKitLibraries
47 )
48
49 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
50     mac
51     mac/Carbon
52     mac/DefaultDelegates
53     mac/DOM
54     mac/History
55     mac/icu
56     mac/Misc
57     mac/Panels
58     mac/Plugins
59     mac/Plugins/Hosted
60     mac/Storage
61     mac/WebCoreSupport
62     mac/WebInspector
63     mac/WebView
64 )
65
66 list(APPEND WebKit_SOURCES
67     cf/WebCoreSupport/WebInspectorClientCF.cpp
68
69     mac/Carbon/CarbonUtils.m
70     mac/Carbon/CarbonWindowAdapter.mm
71     mac/Carbon/CarbonWindowContentView.m
72     mac/Carbon/CarbonWindowFrame.m
73     mac/Carbon/HIViewAdapter.m
74     mac/Carbon/HIWebView.mm
75
76     mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm
77     mac/DefaultDelegates/WebDefaultEditingDelegate.m
78     mac/DefaultDelegates/WebDefaultPolicyDelegate.m
79     mac/DefaultDelegates/WebDefaultUIDelegate.m
80
81     mac/History/BinaryPropertyList.cpp
82     mac/History/HistoryPropertyList.mm
83     mac/History/WebBackForwardList.mm
84     mac/History/WebHistory.mm
85     mac/History/WebHistoryItem.mm
86     mac/History/WebURLsWithTitles.m
87
88     mac/Misc/OldWebAssertions.c
89     mac/Misc/WebCache.mm
90     mac/Misc/WebCoreStatistics.mm
91     mac/Misc/WebDownload.mm
92     mac/Misc/WebElementDictionary.mm
93     mac/Misc/WebIconDatabase.mm
94     mac/Misc/WebKitErrors.m
95     mac/Misc/WebKitLogging.m
96     mac/Misc/WebKitNSStringExtras.mm
97     mac/Misc/WebKitStatistics.m
98     mac/Misc/WebKitVersionChecks.m
99     mac/Misc/WebLocalizableStrings.mm
100     mac/Misc/WebLocalizableStringsInternal.mm
101     mac/Misc/WebNSControlExtras.m
102     mac/Misc/WebNSDataExtras.m
103     mac/Misc/WebNSDictionaryExtras.m
104     mac/Misc/WebNSEventExtras.m
105     mac/Misc/WebNSFileManagerExtras.mm
106     mac/Misc/WebNSImageExtras.m
107     mac/Misc/WebNSObjectExtras.mm
108     mac/Misc/WebNSPasteboardExtras.mm
109     mac/Misc/WebNSPrintOperationExtras.m
110     mac/Misc/WebNSURLExtras.mm
111     mac/Misc/WebNSURLRequestExtras.m
112     mac/Misc/WebNSUserDefaultsExtras.mm
113     mac/Misc/WebNSViewExtras.m
114     mac/Misc/WebNSWindowExtras.m
115     mac/Misc/WebSharingServicePickerController.mm
116     mac/Misc/WebStringTruncator.mm
117     mac/Misc/WebUserContentURLPattern.mm
118
119     mac/Panels/WebAuthenticationPanel.m
120     mac/Panels/WebPanelAuthenticationHandler.m
121
122     mac/Plugins/WebBaseNetscapePluginView.mm
123     mac/Plugins/WebBasePluginPackage.mm
124     mac/Plugins/WebNetscapeContainerCheckContextInfo.mm
125     mac/Plugins/WebNetscapeContainerCheckPrivate.mm
126     mac/Plugins/WebNetscapePluginEventHandler.mm
127     mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm
128     mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm
129     mac/Plugins/WebNetscapePluginPackage.mm
130     mac/Plugins/WebNetscapePluginStream.mm
131     mac/Plugins/WebNetscapePluginView.mm
132     mac/Plugins/WebPluginContainerCheck.mm
133     mac/Plugins/WebPluginController.mm
134     mac/Plugins/WebPluginDatabase.mm
135     mac/Plugins/WebPluginPackage.mm
136     mac/Plugins/WebPluginRequest.m
137     mac/Plugins/npapi.mm
138
139     mac/Plugins/Hosted/HostedNetscapePluginStream.mm
140     mac/Plugins/Hosted/NetscapePluginHostManager.mm
141     mac/Plugins/Hosted/NetscapePluginHostProxy.mm
142     mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
143     mac/Plugins/Hosted/ProxyInstance.mm
144     mac/Plugins/Hosted/ProxyRuntimeObject.mm
145     mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
146     mac/Plugins/Hosted/WebKitPluginAgent.defs
147     mac/Plugins/Hosted/WebKitPluginAgentReply.defs
148     mac/Plugins/Hosted/WebKitPluginClient.defs
149     mac/Plugins/Hosted/WebKitPluginHost.defs
150     mac/Plugins/Hosted/WebKitPluginHostTypes.defs
151     mac/Plugins/Hosted/WebTextInputWindowController.m
152
153     mac/Storage/WebDatabaseManager.mm
154     mac/Storage/WebDatabaseManagerClient.mm
155     mac/Storage/WebDatabaseProvider.mm
156     mac/Storage/WebDatabaseQuotaManager.mm
157     mac/Storage/WebStorageManager.mm
158     mac/Storage/WebStorageTrackerClient.mm
159
160     mac/WebCoreSupport/CorrectionPanel.mm
161     mac/WebCoreSupport/PopupMenuMac.mm
162     mac/WebCoreSupport/SearchPopupMenuMac.mm
163     mac/WebCoreSupport/WebAlternativeTextClient.mm
164     mac/WebCoreSupport/WebApplicationCache.mm
165     mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm
166     mac/WebCoreSupport/WebChromeClient.mm
167     mac/WebCoreSupport/WebContextMenuClient.mm
168     mac/WebCoreSupport/WebDeviceOrientationClient.mm
169     mac/WebCoreSupport/WebDragClient.mm
170     mac/WebCoreSupport/WebEditorClient.mm
171     mac/WebCoreSupport/WebFrameLoaderClient.mm
172     mac/WebCoreSupport/WebFrameNetworkingContext.mm
173     mac/WebCoreSupport/WebGeolocationClient.mm
174     mac/WebCoreSupport/WebIconDatabaseClient.mm
175     mac/WebCoreSupport/WebInspectorClient.mm
176     mac/WebCoreSupport/WebJavaScriptTextInputPanel.m
177     mac/WebCoreSupport/WebKeyGenerator.mm
178     mac/WebCoreSupport/WebKitFullScreenListener.mm
179     mac/WebCoreSupport/WebNotificationClient.mm
180     mac/WebCoreSupport/WebOpenPanelResultListener.mm
181     mac/WebCoreSupport/WebPlatformStrategies.mm
182     mac/WebCoreSupport/WebProgressTrackerClient.mm
183     mac/WebCoreSupport/WebSecurityOrigin.mm
184     mac/WebCoreSupport/WebSelectionServiceController.mm
185     mac/WebCoreSupport/WebSystemInterface.mm
186     mac/WebCoreSupport/WebUserMediaClient.mm
187     mac/WebCoreSupport/WebVisitedLinkStore.mm
188
189     mac/WebInspector/WebInspector.mm
190     mac/WebInspector/WebInspectorFrontend.mm
191     mac/WebInspector/WebNodeHighlight.mm
192     mac/WebInspector/WebNodeHighlightView.mm
193     mac/WebInspector/WebNodeHighlighter.mm
194
195     mac/WebView/WebArchive.mm
196     mac/WebView/WebClipView.mm
197     mac/WebView/WebDashboardRegion.mm
198     mac/WebView/WebDataSource.mm
199     mac/WebView/WebDelegateImplementationCaching.mm
200     mac/WebView/WebDeviceOrientation.mm
201     mac/WebView/WebDeviceOrientationProviderMock.mm
202     mac/WebView/WebDocumentLoaderMac.mm
203     mac/WebView/WebDynamicScrollBarsView.mm
204     mac/WebView/WebFormDelegate.m
205     mac/WebView/WebFrame.mm
206     mac/WebView/WebFrameView.mm
207     mac/WebView/WebFullScreenController.mm
208     mac/WebView/WebGeolocationPosition.mm
209     mac/WebView/WebHTMLRepresentation.mm
210     mac/WebView/WebHTMLView.mm
211     mac/WebView/WebImmediateActionController.mm
212     mac/WebView/WebIndicateLayer.mm
213     mac/WebView/WebJSPDFDoc.mm
214     mac/WebView/WebNavigationData.mm
215     mac/WebView/WebNotification.mm
216     mac/WebView/WebPDFDocumentExtras.mm
217     mac/WebView/WebPDFRepresentation.mm
218     mac/WebView/WebPDFView.mm
219     mac/WebView/WebPolicyDelegate.mm
220     mac/WebView/WebPreferences.mm
221     mac/WebView/WebResource.mm
222     mac/WebView/WebScriptDebugDelegate.mm
223     mac/WebView/WebScriptDebugger.mm
224     mac/WebView/WebScriptWorld.mm
225     mac/WebView/WebTextCompletionController.mm
226     mac/WebView/WebTextIterator.mm
227     mac/WebView/WebView.mm
228     mac/WebView/WebViewData.mm
229 )
230
231 set(WebKit_LIBRARY_TYPE SHARED)
232
233 set(WebKitLegacy_FORWARDING_HEADERS_DIRECTORIES
234     mac/DOM
235     mac/DefaultDelegates
236     mac/History
237     mac/Misc
238     mac/Panels
239     mac/Plugins
240     mac/WebCoreSupport
241     mac/WebInspector
242     mac/WebView
243 )
244
245 set(WebKitLegacy_FORWARDING_HEADERS_FILES
246     mac/DOM/WebDOMOperations.h
247
248     mac/History/WebHistory.h
249     mac/History/WebHistoryItem.h
250
251     mac/Misc/WebNSURLExtras.h
252
253     mac/Panels/WebPanelAuthenticationHandler.h
254
255     mac/Plugins/WebBasePluginPackage.h
256
257     mac/WebCoreSupport/WebKeyGenerator.h
258
259     mac/WebInspector/WebInspector.h
260
261     mac/WebView/WebFrame.h
262     mac/WebView/WebView.h
263
264     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMRange.h
265
266     ${WEBCORE_DIR}/bindings/objc/DOMCore.h
267     ${WEBCORE_DIR}/bindings/objc/DOMExtensions.h
268
269     ${WEBCORE_DIR}/plugins/npfunctions.h
270 )
271
272 add_definitions("-include WebKitPrefix.h")
273
274 set(C99_FILES
275     ${WEBKIT_DIR}/mac/Carbon/CarbonUtils.m
276     ${WEBKIT_DIR}/mac/Carbon/CarbonWindowContentView.m
277     ${WEBKIT_DIR}/mac/Carbon/CarbonWindowFrame.m
278     ${WEBKIT_DIR}/mac/Carbon/HIViewAdapter.m
279
280     mac/DefaultDelegates/WebDefaultEditingDelegate.m
281     mac/DefaultDelegates/WebDefaultPolicyDelegate.m
282     mac/DefaultDelegates/WebDefaultUIDelegate.m
283
284     mac/Misc/OldWebAssertions.c
285
286     mac/Misc/WebKitErrors.m
287     mac/Misc/WebKitLogging.m
288     mac/Misc/WebKitStatistics.m
289     mac/Misc/WebKitSystemBits.m
290     mac/Misc/WebKitVersionChecks.m
291     mac/Misc/WebNSArrayExtras.m
292     mac/Misc/WebNSControlExtras.m
293     mac/Misc/WebNSDataExtras.m
294     mac/Misc/WebNSDictionaryExtras.m
295     mac/Misc/WebNSEventExtras.m
296     mac/Misc/WebNSImageExtras.m
297     mac/Misc/WebNSPrintOperationExtras.m
298     mac/Misc/WebNSURLRequestExtras.m
299     mac/Misc/WebNSViewExtras.m
300     mac/Misc/WebNSWindowExtras.m
301
302     mac/Panels/WebAuthenticationPanel.m
303     mac/Panels/WebPanelAuthenticationHandler.m
304
305     mac/Plugins/WebPluginRequest.m
306     mac/Plugins/WebPluginsPrivate.m
307
308     mac/Plugins/Hosted/WebTextInputWindowController.m
309
310     mac/WebCoreSupport/WebJavaScriptTextInputPanel.m
311
312     mac/WebView/WebFormDelegate.m
313 )
314
315 foreach (_file ${WebKit_SOURCES})
316     list(FIND C99_FILES ${_file} _c99_index)
317     if (${_c99_index} EQUAL -1)
318         set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS "-ObjC++ -std=c++14")
319     else ()
320         set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS -std=c99)
321     endif ()
322 endforeach ()
323
324 file(COPY
325     mac/Plugins/Hosted/WebKitPluginAgent.defs
326     mac/Plugins/Hosted/WebKitPluginAgentReply.defs
327     mac/Plugins/Hosted/WebKitPluginClient.defs
328     mac/Plugins/Hosted/WebKitPluginHost.defs
329     mac/Plugins/Hosted/WebKitPluginHostTypes.defs
330     mac/Plugins/Hosted/WebKitPluginHostTypes.h
331 DESTINATION ${DERIVED_SOURCES_WEBKITLEGACY_DIR})
332
333 add_custom_command(
334     OUTPUT
335         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginAgentReplyServer.c
336         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginAgentReplyUser.c
337         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginAgentServer.c
338         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginAgentUser.c
339         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginHostServer.c
340         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginHostUser.c
341     MAIN_DEPENDENCY mac/Plugins/Hosted/WebKitPluginAgent.defs
342     WORKING_DIRECTORY ${DERIVED_SOURCES_WEBKITLEGACY_DIR}
343     COMMAND mig -I.. WebKitPluginAgent.defs WebKitPluginAgentReply.defs WebKitPluginHost.defs
344     VERBATIM)
345 add_custom_command(
346     OUTPUT
347         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginClientServer.c
348         ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginClientUser.c
349     MAIN_DEPENDENCY mac/Plugins/Hosted/WebKitPluginAgent.defs
350     WORKING_DIRECTORY ${DERIVED_SOURCES_WEBKITLEGACY_DIR}
351     COMMAND mig -I.. -sheader WebKitPluginClientServer.h WebKitPluginClient.defs
352     VERBATIM)
353 list(APPEND WebKit_SOURCES
354     ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginAgentUser.c
355     ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginClientServer.c
356     ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/WebKitPluginHostUser.c
357 )
358
359 WEBKIT_CREATE_FORWARDING_HEADERS(WebKitLegacy DIRECTORIES ${WebKitLegacy_FORWARDING_HEADERS_DIRECTORIES} FILES ${WebKitLegacy_FORWARDING_HEADERS_FILES})
360 WEBKIT_CREATE_FORWARDING_HEADERS(WebKit DIRECTORIES ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKitLegacy)
361
362 # FIXME: Forwarding headers should be copies of actual headers.
363 file(GLOB ObjCHeaders ${WEBCORE_DIR}/bindings/objc/*.h)
364 foreach (_file ${ObjCHeaders})
365     get_filename_component(_name ${_file} NAME)
366     if (NOT EXISTS ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKitLegacy/${_name})
367         file(WRITE ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKitLegacy/${_name} "#import <WebCore/${_name}>")
368     endif ()
369 endforeach ()
370 file(GLOB ObjCHeaders ${WEBCORE_DIR}/plugins/*.h)
371 foreach (_file ${ObjCHeaders})
372     get_filename_component(_name ${_file} NAME)
373     if (NOT EXISTS ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKitLegacy/${_name})
374         file(WRITE ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKitLegacy/${_name} "#import <WebCore/${_name}>")
375     endif ()
376 endforeach ()
377
378 set(WebKit_OUTPUT_NAME WebKitLegacy)
379
380 set(WebKitLegacy_WebCore_FORWARDING_HEADERS
381     DOMElement.h
382     DOMHTMLFormElement.h
383     DOMHTMLInputElement.h
384     DOMWheelEvent.h
385 )
386
387 # FIXME: These shouldn't be necessary, but it doesn't compile without them.
388 foreach (_file ${WebKitLegacy_WebCore_FORWARDING_HEADERS})
389     if (NOT EXISTS ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/${_file})
390         file(WRITE ${DERIVED_SOURCES_WEBKITLEGACY_DIR}/${_file} "#import <WebCore/${_file}>")
391     endif ()
392 endforeach ()
393
394 set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}")