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