Title: [270690] trunk
Revision
270690
Author
[email protected]
Date
2020-12-11 11:15:43 -0800 (Fri, 11 Dec 2020)

Log Message

[CMake] Determine correct visibility for linked frameworks
https://bugs.webkit.org/show_bug.cgi?id=210366

Reviewed by Michael Catanzaro.

.:

WebKit has some frameworks that are compiled statically into a larger shared library. For
example Apple compiles bmalloc and WTF into _javascript_Core. This means the _javascript_Core
framework also exposes the symbols for those two libraries and that targets depending
on WTF or bmalloc should link to _javascript_Core and never to WTF or bmalloc directly.

The CMake code allows each port to decide the type of library for a WEBKIT_FRAMEWORK.
This means there are many different combinations that it needs to support. To ensure that
everything links properly some bookkeeping is required.

WEBKIT_FRAMEWORK now uses ${target}_FRAMEWORKS to determine how to link the frameworks
it depends on. First the macro determines if the framework is a SHARED library or is linked
into a shared library, and if so it is linked as PUBLIC. If the framework itself is not a
SHARED library, then it links other STATIC/OBJECT framework as PUBLIC. If the framework
itself is SHARED then any framework that is a STATIC/OBJECT library is linked as PRIVATE
to stop propagation. The linked framework's header directories are added to the
WebKit::${framework} target to allow the framework to present as that framework. A global
property is set to inform consumers that they should link to this different framework
to get the requested framework.

This ensures that all ports can ship with hidden visibility turned on which is a precursor
to a port turning on link time optimization (LTO).

* Source/cmake/WebKitMacros.cmake:

Source/_javascript_Core:

Set _javascript_Core_FRAMEWORKS to determine correct linkage for the library. Remove
explicit setting of STATICALLY_LINKED_WITH_${framework} and $<TARGET_OBJECTS:${framework}>
by ports.

Move the add_subdirectory of shell to the end of the CMakeLists.txt so its after the
WEBKIT_FRAMEWORK call. This ensures that the frameworks linked into _javascript_Core are
known when creating the executables in that directory.

* CMakeLists.txt:
* PlatformGTK.cmake:
* PlatformJSCOnly.cmake:
* PlatformMac.cmake:
* PlatformPlayStation.cmake:
* shell/CMakeLists.txt:

Source/WebCore:

Set WebCore_FRAMEWORKS and WebCoreTestSupport_FRAMEWORKS to determine correct linkage
for the libraries. Remove explicit setting of STATICALLY_LINKED_WITH_PAL.

For the GTK port _javascript_Core is compiled as a SHARED library with WTF and bmalloc
compiled into it. WEBKIT_FRAMEWORK now correctly prevents WTF and bmalloc being linked
into targets that also link _javascript_Core. However GTK port can't be compiled with
hidden visibility turned on currently to properly export symbols so the libraries are
added back to the list for WebCore to keep the old, albiet wrong, behavior.

* CMakeLists.txt:
* PlatformGTK.cmake:

Source/WebCore/PAL:

Set PAL_FRAMEWORKS to determine correct linkage for the library.

* pal/CMakeLists.txt:

Source/WebDriver:

Conditionally add bmalloc to the list of WebDriver_FRAMEWORKS.

* CMakeLists.txt:

Source/WebKit:

Set WebKit_FRAMEWORKS to determine correct linkage for the library. Remove
explicit setting of STATICALLY_LINKED_WITH_${framework} and $<TARGET_OBJECTS:${framework}>
by ports.

* CMakeLists.txt:
* PlatformFTW.cmake:
* PlatformPlayStation.cmake:
* PlatformWPE.cmake:
* PlatformWin.cmake:

Source/WebKitLegacy:

Remove explicit setting of STATICALLY_LINKED_WITH_${framework}.

* PlatformFTW.cmake:
* PlatformWin.cmake:

Source/WTF:

Set WTF_FRAMEWORKS to determine correct linkage for the library. Remove
explicit setting of STATICALLY_LINKED_WITH_${framework} by ports.

* wtf/CMakeLists.txt:
* wtf/PlatformPlayStation.cmake:

Tools:

Remove explicit setting of STATICALLY_LINKED_WITH_${framework}.

* TestWebKitAPI/PlatformWin.cmake:

Modified Paths

Diff

Modified: trunk/ChangeLog (270689 => 270690)


--- trunk/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,34 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        WebKit has some frameworks that are compiled statically into a larger shared library. For
+        example Apple compiles bmalloc and WTF into _javascript_Core. This means the _javascript_Core
+        framework also exposes the symbols for those two libraries and that targets depending
+        on WTF or bmalloc should link to _javascript_Core and never to WTF or bmalloc directly.
+
+        The CMake code allows each port to decide the type of library for a WEBKIT_FRAMEWORK.
+        This means there are many different combinations that it needs to support. To ensure that
+        everything links properly some bookkeeping is required.
+
+        WEBKIT_FRAMEWORK now uses ${target}_FRAMEWORKS to determine how to link the frameworks
+        it depends on. First the macro determines if the framework is a SHARED library or is linked
+        into a shared library, and if so it is linked as PUBLIC. If the framework itself is not a
+        SHARED library, then it links other STATIC/OBJECT framework as PUBLIC. If the framework
+        itself is SHARED then any framework that is a STATIC/OBJECT library is linked as PRIVATE
+        to stop propagation. The linked framework's header directories are added to the
+        WebKit::${framework} target to allow the framework to present as that framework. A global
+        property is set to inform consumers that they should link to this different framework
+        to get the requested framework.
+
+        This ensures that all ports can ship with hidden visibility turned on which is a precursor
+        to a port turning on link time optimization (LTO).
+
+        * Source/cmake/WebKitMacros.cmake:
+
 2020-12-10  Don Olmstead  <[email protected]>
 
         [CMake] Determine when to use $<TARGET_OBJECTS> for executables

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (270689 => 270690)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -127,9 +127,12 @@
     wasm/js/WebAssemblyTablePrototype.cpp
 )
 
-set(_javascript_Core_LIBRARIES
-    WebKit::WTF
+set(_javascript_Core_FRAMEWORKS
+    WTF
 )
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND _javascript_Core_FRAMEWORKS bmalloc)
+endif ()
 
 if (USE_CAPSTONE)
     list(APPEND _javascript_Core_LIBRARIES capstone)
@@ -323,7 +326,7 @@
 set(LLIntSettingsExtractor_PRIVATE_INCLUDE_DIRECTORIES
     $<TARGET_PROPERTY:_javascript_Core,INCLUDE_DIRECTORIES>
 )
-set(LLIntSettingsExtractor_FRAMEWORKS WTF)
+set(LLIntSettingsExtractor_FRAMEWORKS ${_javascript_Core_FRAMEWORKS})
 set(LLIntSettingsExtractor_DEPENDENCIES _javascript_Core_CopyHeaders)
 WEBKIT_EXECUTABLE(LLIntSettingsExtractor)
 
@@ -336,7 +339,7 @@
 set(LLIntOffsetsExtractor_PRIVATE_INCLUDE_DIRECTORIES
     $<TARGET_PROPERTY:_javascript_Core,INCLUDE_DIRECTORIES>
 )
-set(LLIntOffsetsExtractor_FRAMEWORKS WTF)
+set(LLIntOffsetsExtractor_FRAMEWORKS ${_javascript_Core_FRAMEWORKS})
 set(LLIntOffsetsExtractor_DEPENDENCIES _javascript_Core_CopyHeaders)
 WEBKIT_EXECUTABLE(LLIntOffsetsExtractor)
 
@@ -1386,9 +1389,6 @@
     add_dependencies(_javascript_Core_CopyPrivateHeaders _javascript_Core)
 endif ()
 
-
-add_subdirectory(shell)
-
 target_include_directories(LowLevelInterpreterLib
     PRIVATE "$<TARGET_PROPERTY:_javascript_Core,INCLUDE_DIRECTORIES>")
 add_dependencies(LowLevelInterpreterLib Bytecodes JSCBuiltins)
@@ -1452,3 +1452,5 @@
         COMMAND ${PERL_EXECUTABLE} ${WEBKIT_LIBRARIES_DIR}/tools/scripts/version-stamp.pl ${_javascript_Core_DERIVED_SOURCES_DIR} $<TARGET_FILE:_javascript_Core>
         VERBATIM)
 endif ()
+
+add_subdirectory(shell)

Modified: trunk/Source/_javascript_Core/ChangeLog (270689 => 270690)


--- trunk/Source/_javascript_Core/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,25 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Set _javascript_Core_FRAMEWORKS to determine correct linkage for the library. Remove
+        explicit setting of STATICALLY_LINKED_WITH_${framework} and $<TARGET_OBJECTS:${framework}>
+        by ports.
+
+        Move the add_subdirectory of shell to the end of the CMakeLists.txt so its after the
+        WEBKIT_FRAMEWORK call. This ensures that the frameworks linked into _javascript_Core are
+        known when creating the executables in that directory.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+        * PlatformJSCOnly.cmake:
+        * PlatformMac.cmake:
+        * PlatformPlayStation.cmake:
+        * shell/CMakeLists.txt:
+
 2020-12-11  Dmitry Bezhetskov  <[email protected]>
 
         [WASM-References] Add table.init

Modified: trunk/Source/_javascript_Core/PlatformGTK.cmake (270689 => 270690)


--- trunk/Source/_javascript_Core/PlatformGTK.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/PlatformGTK.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -30,7 +30,6 @@
     )
 endif ()
 
-add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
 add_definitions(-DJSC_COMPILATION)
 
 list(APPEND _javascript_Core_LIBRARIES

Modified: trunk/Source/_javascript_Core/PlatformJSCOnly.cmake (270689 => 270690)


--- trunk/Source/_javascript_Core/PlatformJSCOnly.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/PlatformJSCOnly.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,5 +1,3 @@
-add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
-
 if (ENABLE_REMOTE_INSPECTOR)
     if (USE_GLIB)
         include(inspector/remote/GLib.cmake)

Modified: trunk/Source/_javascript_Core/PlatformMac.cmake (270689 => 270690)


--- trunk/Source/_javascript_Core/PlatformMac.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/PlatformMac.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,4 +1,4 @@
-add_definitions(-DSTATICALLY_LINKED_WITH_WTF -D__STDC_WANT_LIB_EXT1__)
+add_definitions(-D__STDC_WANT_LIB_EXT1__)
 
 find_library(SECURITY_LIBRARY Security)
 list(APPEND _javascript_Core_LIBRARIES

Modified: trunk/Source/_javascript_Core/PlatformPlayStation.cmake (270689 => 270690)


--- trunk/Source/_javascript_Core/PlatformPlayStation.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/PlatformPlayStation.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -15,16 +15,3 @@
 
 # This overrides the default x64 value of 1GB for the memory pool size
 add_definitions(-DFIXED_EXECUTABLE_MEMORY_POOL_SIZE_IN_MB=64)
-
-# Both bmalloc and WTF are built as object libraries. The WebKit:: interface
-# targets are used. A limitation of that is the object files are not propagated
-# so they are added here.
-list(APPEND _javascript_Core_PRIVATE_LIBRARIES
-    $<TARGET_OBJECTS:WTF>
-    $<TARGET_OBJECTS:bmalloc>
-)
-
-list(APPEND _javascript_Core_PRIVATE_DEFINITIONS
-    STATICALLY_LINKED_WITH_WTF
-    STATICALLY_LINKED_WITH_bmalloc
-)

Modified: trunk/Source/_javascript_Core/shell/CMakeLists.txt (270689 => 270690)


--- trunk/Source/_javascript_Core/shell/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/_javascript_Core/shell/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,10 +1,12 @@
-if ("${_javascript_Core_LIBRARY_TYPE}" MATCHES "STATIC")
-    set(jsc_PRIVATE_DEFINITIONS STATICALLY_LINKED_WITH_JavaScriptCore)
-endif ()
-
 set(jsc_SOURCES ../jsc.cpp)
 set(jsc_LIBRARIES ${CMAKE_DL_LIBS})
-set(jsc_FRAMEWORKS _javascript_Core)
+set(jsc_FRAMEWORKS
+    _javascript_Core
+    WTF
+)
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND jsc_FRAMEWORKS bmalloc)
+endif ()
 
 set(jsc_PRIVATE_INCLUDE_DIRECTORIES
     $<TARGET_PROPERTY:_javascript_Core,INCLUDE_DIRECTORIES>

Modified: trunk/Source/WTF/ChangeLog (270689 => 270690)


--- trunk/Source/WTF/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WTF/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,16 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Set WTF_FRAMEWORKS to determine correct linkage for the library. Remove
+        explicit setting of STATICALLY_LINKED_WITH_${framework} by ports.
+
+        * wtf/CMakeLists.txt:
+        * wtf/PlatformPlayStation.cmake:
+
 2020-12-11  Chris Lord  <[email protected]>
 
         [GTK][WPE] Async overflow scrolling is disabled by default due to brokenness

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (270689 => 270690)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -522,18 +522,15 @@
 
 set(WTF_LIBRARIES
     ${CMAKE_DL_LIBS}
+    ICU::data
+    ICU::i18n
+    ICU::uc
 )
 
 if (NOT USE_SYSTEM_MALLOC)
-    list(APPEND WTF_LIBRARIES WebKit::bmalloc)
+    set(WTF_FRAMEWORKS bmalloc)
 endif ()
 
-list(APPEND WTF_LIBRARIES
-    ICU::data
-    ICU::i18n
-    ICU::uc
-)
-
 set(WTF_INTERFACE_LIBRARIES WTF)
 set(WTF_INTERFACE_INCLUDE_DIRECTORIES ${WTF_FRAMEWORK_HEADERS_DIR})
 set(WTF_INTERFACE_DEPENDENCIES WTF_CopyHeaders)

Modified: trunk/Source/WTF/wtf/PlatformPlayStation.cmake (270689 => 270690)


--- trunk/Source/WTF/wtf/PlatformPlayStation.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WTF/wtf/PlatformPlayStation.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -26,6 +26,3 @@
     FILES
         ${ICU_LIBRARIES}
 )
-
-# bmalloc is compiled as an OBJECT library so it is statically linked
-list(APPEND WTF_PRIVATE_DEFINITIONS STATICALLY_LINKED_WITH_bmalloc)

Modified: trunk/Source/WebCore/CMakeLists.txt (270689 => 270690)


--- trunk/Source/WebCore/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -10,10 +10,6 @@
 
 add_subdirectory(PAL/pal)
 
-if (PAL_LIBRARY_TYPE MATCHES STATIC)
-    add_definitions(-DSTATICALLY_LINKED_WITH_PAL=1)
-endif ()
-
 list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES
     "Sources.txt"
 )
@@ -1446,19 +1442,22 @@
 set(WebCore_LIBRARIES
     LibXml2::LibXml2
     SQLite::SQLite3
-    WebKit::_javascript_Core
-    WebKit::PAL
     ZLIB::ZLIB
 )
+set(WebCore_FRAMEWORKS
+    _javascript_Core
+    PAL
+    WTF
+)
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND WebCore_FRAMEWORKS bmalloc)
+endif ()
 
 if (ENABLE_XSLT)
     list(APPEND WebCore_LIBRARIES LibXslt::LibXslt)
 endif ()
 
-set(WebCoreTestSupport_LIBRARIES
-    WebKit::_javascript_Core
-    WebKit::PAL
-)
+set(WebCoreTestSupport_FRAMEWORKS ${WebCore_FRAMEWORKS})
 set(WebCoreTestSupport_DEPENDENCIES WebCoreTestSupportBindings)
 
 if (ENABLE_LEGACY_ENCRYPTED_MEDIA)

Modified: trunk/Source/WebCore/ChangeLog (270689 => 270690)


--- trunk/Source/WebCore/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebCore/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,22 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Set WebCore_FRAMEWORKS and WebCoreTestSupport_FRAMEWORKS to determine correct linkage
+        for the libraries. Remove explicit setting of STATICALLY_LINKED_WITH_PAL.
+
+        For the GTK port _javascript_Core is compiled as a SHARED library with WTF and bmalloc
+        compiled into it. WEBKIT_FRAMEWORK now correctly prevents WTF and bmalloc being linked
+        into targets that also link _javascript_Core. However GTK port can't be compiled with
+        hidden visibility turned on currently to properly export symbols so the libraries are
+        added back to the list for WebCore to keep the old, albiet wrong, behavior.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+
 2020-12-11  Chris Lord  <[email protected]>
 
         [GTK][WPE] Async overflow scrolling is disabled by default due to brokenness

Modified: trunk/Source/WebCore/PAL/ChangeLog (270689 => 270690)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,14 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Set PAL_FRAMEWORKS to determine correct linkage for the library.
+
+        * pal/CMakeLists.txt:
+
 2020-12-10  Andy Estes  <[email protected]>
 
         [Mac] Create a format reader plug-in for WebM

Modified: trunk/Source/WebCore/PAL/pal/CMakeLists.txt (270689 => 270690)


--- trunk/Source/WebCore/PAL/pal/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebCore/PAL/pal/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -38,13 +38,9 @@
     "${PAL_DIR}/pal/text"
 )
 
-# PAL only uses WebKit::WTF but we need to determine where that is
-# If WTF is statically linked into a shared _javascript_Core then that should be
-# linked otherwise it can be linked directly
-if (NOT ${WTF_LIBRARY_TYPE} STREQUAL "SHARED" AND ${_javascript_Core_LIBRARY_TYPE} STREQUAL "SHARED")
-    set(PAL_LIBRARIES WebKit::_javascript_Core)
-else ()
-    set(PAL_LIBRARIES WebKit::WTF)
+set(PAL_FRAMEWORKS WTF)
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND PAL_FRAMEWORKS bmalloc)
 endif ()
 
 set(PAL_INTERFACE_LIBRARIES PAL)

Modified: trunk/Source/WebCore/PlatformGTK.cmake (270689 => 270690)


--- trunk/Source/WebCore/PlatformGTK.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -8,6 +8,13 @@
 
 set(WebCore_OUTPUT_NAME WebCoreGTK)
 
+# FIXME: https://bugs.webkit.org/show_bug.cgi?id=181916
+# Remove these lines when turning on hidden visibility
+list(APPEND WebCore_PRIVATE_LIBRARIES WebKit::WTF)
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND WebCore_PRIVATE_LIBRARIES WebKit::bmalloc)
+endif ()
+
 list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES
     "SourcesGTK.txt"
 

Modified: trunk/Source/WebDriver/CMakeLists.txt (270689 => 270690)


--- trunk/Source/WebDriver/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebDriver/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -20,7 +20,11 @@
 set(WebDriver_FRAMEWORKS
     WTF
 )
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND WebDriver_FRAMEWORKS bmalloc)
+endif ()
 
+
 set(WebDriver_SCRIPTS
     ${WEBKIT_DIR}/UIProcess/Automation/atoms/ElementAttribute.js
     ${WEBKIT_DIR}/UIProcess/Automation/atoms/ElementDisplayed.js

Modified: trunk/Source/WebDriver/ChangeLog (270689 => 270690)


--- trunk/Source/WebDriver/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebDriver/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,14 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Conditionally add bmalloc to the list of WebDriver_FRAMEWORKS.
+
+        * CMakeLists.txt:
+
 2020-12-10  Don Olmstead  <[email protected]>
 
         [CMake] Determine when to use $<TARGET_OBJECTS> for executables

Modified: trunk/Source/WebKit/CMakeLists.txt (270689 => 270690)


--- trunk/Source/WebKit/CMakeLists.txt	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/CMakeLists.txt	2020-12-11 19:15:43 UTC (rev 270690)
@@ -2,10 +2,6 @@
 
 set_property(DIRECTORY . PROPERTY FOLDER "WebKit")
 
-if (PAL_LIBRARY_TYPE MATCHES STATIC)
-    add_definitions(-DSTATICALLY_LINKED_WITH_PAL=1)
-endif ()
-
 set(WebKit_PRIVATE_INCLUDE_DIRECTORIES
     "${CMAKE_BINARY_DIR}"
 )
@@ -280,25 +276,21 @@
     WebProcess/WebStorage/StorageAreaMap
 )
 
-# FIXME: https://bugs.webkit.org/show_bug.cgi?id=210366
-set(WebKit_LIBRARIES WebKit::WebCore)
-
-set(WebProcess_LIBRARIES
-    WebKit
+set(WebKit_FRAMEWORKS
+    _javascript_Core
+    PAL
+    WTF
+    WebCore
 )
+if (NOT USE_SYSTEM_MALLOC)
+    list(APPEND WebKit_FRAMEWORKS bmalloc)
+endif ()
 
-set(NetworkProcess_LIBRARIES
-    WebKit
-)
+set(WebProcess_LIBRARIES WebKit)
+set(NetworkProcess_LIBRARIES WebKit)
+set(GPUProcess_LIBRARIES WebKit)
+set(PluginProcess_LIBRARIES WebKit)
 
-set(GPUProcess_LIBRARIES
-    WebKit
-)
-
-set(PluginProcess_LIBRARIES
-    WebKit
-)
-
 if (ENABLE_ENCRYPTED_MEDIA AND ENABLE_OPENCDM)
   list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
       ${OPENCDM_INCLUDE_DIRS}

Modified: trunk/Source/WebKit/ChangeLog (270689 => 270690)


--- trunk/Source/WebKit/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,20 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Set WebKit_FRAMEWORKS to determine correct linkage for the library. Remove
+        explicit setting of STATICALLY_LINKED_WITH_${framework} and $<TARGET_OBJECTS:${framework}>
+        by ports.
+
+        * CMakeLists.txt:
+        * PlatformFTW.cmake:
+        * PlatformPlayStation.cmake:
+        * PlatformWPE.cmake:
+        * PlatformWin.cmake:
+
 2020-12-11  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r270654.

Modified: trunk/Source/WebKit/PlatformFTW.cmake (270689 => 270690)


--- trunk/Source/WebKit/PlatformFTW.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/PlatformFTW.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -197,8 +197,3 @@
 
     UIProcess/API/C/win/WKView.h
 )
-
-list(APPEND WebKit_PRIVATE_DEFINITIONS
-    STATICALLY_LINKED_WITH_PAL
-    STATICALLY_LINKED_WITH_WebCore
-)

Modified: trunk/Source/WebKit/PlatformPlayStation.cmake (270689 => 270690)


--- trunk/Source/WebKit/PlatformPlayStation.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/PlatformPlayStation.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -164,12 +164,3 @@
     UIProcess/API/C/playstation/WKPagePrivatePlayStation.h
     UIProcess/API/C/playstation/WKView.h
 )
-
-# Both PAL and WebCore are built as object libraries. The WebKit:: interface
-# targets are used. A limitation of that is the object files are not propagated
-# so they are added here.
-list(APPEND WebKit_PRIVATE_LIBRARIES
-    $<TARGET_OBJECTS:PAL>
-    $<TARGET_OBJECTS:WebCore>
-    WebKitRequirements::ProcessLauncher
-)

Modified: trunk/Source/WebKit/PlatformWPE.cmake (270689 => 270690)


--- trunk/Source/WebKit/PlatformWPE.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/PlatformWPE.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -398,6 +398,8 @@
     set(qtwpe_LIBRARIES
         Qt5::Core Qt5::Quick
         WebKit
+        ${GLIB_GOBJECT_LIBRARIES}
+        ${GLIB_LIBRARIES}
         ${LIBEPOXY_LIBRARIES}
         ${WPEBACKEND_FDO_LIBRARIES}
     )

Modified: trunk/Source/WebKit/PlatformWin.cmake (270689 => 270690)


--- trunk/Source/WebKit/PlatformWin.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKit/PlatformWin.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -173,7 +173,6 @@
     )
 
     list(APPEND WebKit_PRIVATE_LIBRARIES
-        $<TARGET_OBJECTS:WebCore>
         MediaFoundation
         OpenSSL::SSL
         mfuuid.lib
@@ -211,8 +210,3 @@
         UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.h
     )
 endif ()
-
-list(APPEND WebKit_PRIVATE_DEFINITIONS
-    STATICALLY_LINKED_WITH_PAL
-    STATICALLY_LINKED_WITH_WebCore
-)

Modified: trunk/Source/WebKitLegacy/ChangeLog (270689 => 270690)


--- trunk/Source/WebKitLegacy/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKitLegacy/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,15 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Remove explicit setting of STATICALLY_LINKED_WITH_${framework}.
+
+        * PlatformFTW.cmake:
+        * PlatformWin.cmake:
+
 2020-12-03  Adam Roben  <[email protected]>
 
         Adopt FALLBACK_PLATFORM

Modified: trunk/Source/WebKitLegacy/PlatformFTW.cmake (270689 => 270690)


--- trunk/Source/WebKitLegacy/PlatformFTW.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKitLegacy/PlatformFTW.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -473,8 +473,3 @@
 set(WebKitLegacy_OUTPUT_NAME
     WebKit${DEBUG_SUFFIX}
 )
-
-list(APPEND WebKitLegacy_PRIVATE_DEFINITIONS
-    STATICALLY_LINKED_WITH_PAL
-    STATICALLY_LINKED_WITH_WebCore
-)

Modified: trunk/Source/WebKitLegacy/PlatformWin.cmake (270689 => 270690)


--- trunk/Source/WebKitLegacy/PlatformWin.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/WebKitLegacy/PlatformWin.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -522,8 +522,3 @@
 set(WebKitLegacy_OUTPUT_NAME
     WebKit${DEBUG_SUFFIX}
 )
-
-list(APPEND WebKitLegacy_PRIVATE_DEFINITIONS
-    STATICALLY_LINKED_WITH_PAL
-    STATICALLY_LINKED_WITH_WebCore
-)

Modified: trunk/Source/cmake/WebKitMacros.cmake (270689 => 270690)


--- trunk/Source/cmake/WebKitMacros.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Source/cmake/WebKitMacros.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -193,19 +193,104 @@
     endif ()
 endmacro()
 
+function(_WEBKIT_LINK_FRAMEWORK_INTO target_name framework _public_frameworks_var _private_frameworks_var)
+    set_property(GLOBAL PROPERTY ${framework}_LINKED_INTO ${target_name})
+
+    get_property(_framework_public_frameworks GLOBAL PROPERTY ${framework}_FRAMEWORKS)
+    foreach (dependency IN LISTS ${_framework_public_frameworks})
+        set(${_public_frameworks_var} "${${_public_frameworks_var}};${dependency}" PARENT_SCOPE)
+    endforeach ()
+
+    get_property(_framework_private_frameworks GLOBAL PROPERTY ${framework}_PRIVATE_FRAMEWORKS)
+    foreach (dependency IN LISTS _framework_private_frameworks)
+        set(${_private_frameworks_var} "${${_private_frameworks_var}};${dependency}" PARENT_SCOPE)
+        _WEBKIT_LINK_FRAMEWORK_INTO(${target_name} ${dependency} ${_public_frameworks_var} ${_private_frameworks_var})
+    endforeach ()
+endfunction()
+
+macro(_WEBKIT_FRAMEWORK_LINK_FRAMEWORK _target_name)
+    # Set the public libraries before modifying them when determining visibility.
+    set_property(GLOBAL PROPERTY ${_target_name}_PUBLIC_LIBRARIES ${${_target_name}_LIBRARIES})
+
+    set(_public_frameworks)
+    set(_private_frameworks)
+
+    foreach (framework IN LISTS ${_target_name}_FRAMEWORKS)
+        get_property(_linked_into GLOBAL PROPERTY ${framework}_LINKED_INTO)
+        if (_linked_into)
+            list(APPEND _public_frameworks ${_linked_into})
+        elseif (${framework}_LIBRARY_TYPE STREQUAL "SHARED")
+            list(APPEND _public_frameworks ${framework})
+        else ()
+            list(APPEND _private_frameworks ${framework})
+        endif ()
+    endforeach ()
+
+    # Recurse into the dependent frameworks
+    if (_private_frameworks)
+        list(REMOVE_DUPLICATES _private_frameworks)
+    endif ()
+    if (${_target_name}_LIBRARY_TYPE STREQUAL "SHARED")
+        set_property(GLOBAL PROPERTY ${_target_name}_LINKED_INTO ${_target_name})
+        foreach (framework IN LISTS _private_frameworks)
+            _WEBKIT_LINK_FRAMEWORK_INTO(${_target_name} ${framework} _public_frameworks _private_frameworks)
+        endforeach ()
+    endif ()
+
+    # Add to the ${target_name}_LIBRARIES
+    if (_public_frameworks)
+        list(REMOVE_DUPLICATES _public_frameworks)
+    endif ()
+    foreach (framework IN LISTS _public_frameworks)
+        list(APPEND ${_target_name}_LIBRARIES WebKit::${framework})
+    endforeach ()
+
+    # Add to the ${target_name}_PRIVATE_LIBRARIES
+    if (_private_frameworks)
+        list(REMOVE_DUPLICATES _private_frameworks)
+    endif ()
+    foreach (framework IN LISTS _private_frameworks)
+        if (${_target_name}_LIBRARY_TYPE STREQUAL "SHARED")
+            get_property(_linked_libraries GLOBAL PROPERTY ${framework}_PUBLIC_LIBRARIES)
+            list(APPEND ${_target_name}_INTERFACE_LIBRARIES
+                ${_linked_libraries}
+            )
+            list(APPEND ${_target_name}_INTERFACE_INCLUDE_DIRECTORIES
+                ${${framework}_FRAMEWORK_HEADERS_DIR}
+                ${${framework}_PRIVATE_FRAMEWORK_HEADERS_DIR}
+            )
+            list(APPEND ${_target_name}_PRIVATE_LIBRARIES WebKit::${framework})
+            if (${framework}_LIBRARY_TYPE STREQUAL "OBJECT")
+                list(APPEND ${_target_name}_PRIVATE_LIBRARIES $<TARGET_OBJECTS:${framework}>)
+            endif ()
+        else ()
+            list(APPEND ${_target_name}_LIBRARIES WebKit::${framework})
+        endif ()
+    endforeach ()
+
+    set_property(GLOBAL PROPERTY ${_target_name}_FRAMEWORKS ${_public_frameworks})
+    set_property(GLOBAL PROPERTY ${_target_name}_PRIVATE_FRAMEWORKS ${_private_frameworks})
+endmacro()
+
 macro(_WEBKIT_EXECUTABLE_LINK_FRAMEWORK _target)
     foreach (framework IN LISTS ${_target}_FRAMEWORKS)
-        list(APPEND ${_target}_PRIVATE_LIBRARIES WebKit::${framework})
+        get_property(_linked_into GLOBAL PROPERTY ${framework}_LINKED_INTO)
 
-        # The WebKit:: alias targets do not propagate OBJECT libraries so the
-        # underyling library's objects are explicitly added to link properly
-        if (TARGET ${framework} AND ${framework}_LIBRARY_TYPE STREQUAL "OBJECT")
-            list(APPEND ${_target}_PRIVATE_LIBRARIES $<TARGET_OBJECTS:${framework}>)
+        # See if the executable is linking a framework that the specified framework is already linked into
+        if ((NOT _linked_into) OR (${framework} STREQUAL ${_linked_into}) OR (NOT ${_linked_into} IN_LIST opt_LINK))
+            list(APPEND ${_target}_PRIVATE_LIBRARIES WebKit::${framework})
+
+            # The WebKit:: alias targets do not propagate OBJECT libraries so the
+            # underyling library's objects are explicitly added to link properly
+            if (TARGET ${framework} AND ${framework}_LIBRARY_TYPE STREQUAL "OBJECT")
+                list(APPEND ${_target}_PRIVATE_LIBRARIES $<TARGET_OBJECTS:${framework}>)
+            endif ()
         endif ()
     endforeach ()
 endmacro()
 
 macro(WEBKIT_FRAMEWORK _target)
+    _WEBKIT_FRAMEWORK_LINK_FRAMEWORK(${_target})
     _WEBKIT_TARGET(${_target} ${_target})
     _WEBKIT_TARGET_ANALYZE(${_target})
 
@@ -234,6 +319,9 @@
     target_link_libraries(${_target}_PostBuild INTERFACE ${${_target}_INTERFACE_LIBRARIES})
     target_include_directories(${_target}_PostBuild INTERFACE ${${_target}_INTERFACE_INCLUDE_DIRECTORIES})
     add_dependencies(${_target}_PostBuild ${${_target}_INTERFACE_DEPENDENCIES})
+    if (NOT ${_target}_LIBRARY_TYPE STREQUAL "SHARED")
+        target_compile_definitions(${_target}_PostBuild INTERFACE "STATICALLY_LINKED_WITH_${_target}")
+    endif ()
     add_library(WebKit::${_target} ALIAS ${_target}_PostBuild)
 endmacro()
 

Modified: trunk/Tools/ChangeLog (270689 => 270690)


--- trunk/Tools/ChangeLog	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Tools/ChangeLog	2020-12-11 19:15:43 UTC (rev 270690)
@@ -1,3 +1,14 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [CMake] Determine correct visibility for linked frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=210366
+
+        Reviewed by Michael Catanzaro.
+
+        Remove explicit setting of STATICALLY_LINKED_WITH_${framework}.
+
+        * TestWebKitAPI/PlatformWin.cmake:
+
 2020-12-11  Dmitry Bezhetskov  <[email protected]>
 
         [WASM-References] Add table.init

Modified: trunk/Tools/TestWebKitAPI/PlatformWin.cmake (270689 => 270690)


--- trunk/Tools/TestWebKitAPI/PlatformWin.cmake	2020-12-11 19:04:22 UTC (rev 270689)
+++ trunk/Tools/TestWebKitAPI/PlatformWin.cmake	2020-12-11 19:15:43 UTC (rev 270690)
@@ -32,10 +32,6 @@
 
     win/TestWebCoreStubs.cpp
 )
-list(APPEND TestWebCore_DEFINITIONS
-    STATICALLY_LINKED_WITH_PAL=1
-    STATICALLY_LINKED_WITH_WebCore=1
-)
 
 list(APPEND TestWebCore_LIBRARIES
     Crypt32
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to