From f7adc3320d1961189758427a91a70a6ae57d054a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 30 Aug 2023 07:27:45 -0400 Subject: [PATCH] Meta: Replace Lagom's LibWebView setup with LibWebView's CMakeLists.txt This lets us add new sources to LibWebView in a single location. --- Meta/Lagom/CMakeLists.txt | 56 ++++---------------- Userland/Libraries/LibWebView/CMakeLists.txt | 31 ++++++++++- 2 files changed, 38 insertions(+), 49 deletions(-) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index e76f66901a..e75d346a90 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -420,56 +420,18 @@ if (BUILD_LAGOM) ) # These are needed for both LibWeb and LibProtocol. - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestClient.ipc RequestServer/RequestClientEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestServer.ipc RequestServer/RequestServerEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebSocket/WebSocketClient.ipc WebSocket/WebSocketClientEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebSocket/WebSocketServer.ipc WebSocket/WebSocketServerEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestClient.ipc Userland/Services/RequestServer/RequestClientEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestServer.ipc Userland/Services/RequestServer/RequestServerEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebSocket/WebSocketClient.ipc Userland/Services/WebSocket/WebSocketClientEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebSocket/WebSocketServer.ipc Userland/Services/WebSocket/WebSocketServerEndpoint.h) if (ENABLE_LAGOM_LIBWEB) - list(APPEND lagom_standard_libraries Web) + list(APPEND lagom_standard_libraries Web WebView) - # WebView - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/AccessibilityTreeModel.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/ConsoleClient.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/DOMTreeModel.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/RequestServerAdapter.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/SourceHighlighter.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/StylePropertiesModel.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/ViewImplementation.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/WebContentClient.cpp") - list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/WebSocketClientAdapter.cpp") - - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentServer.ipc WebContent/WebContentServerEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentClient.ipc WebContent/WebContentClientEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverClient.ipc WebContent/WebDriverClientEndpoint.h) - compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverServer.ipc WebContent/WebDriverServerEndpoint.h) - - embed_as_string_view( - "NativeStyleSheetSource" - "${SERENITY_PROJECT_ROOT}/Userland/Libraries/LibWebView/Native.css" - "LibWebView/NativeStyleSheetSource.cpp" - "native_stylesheet_source" - NAMESPACE "WebView" - ) - - list(APPEND LIBWEBVIEW_GENERATED_SOURCES LibWebView/NativeStyleSheetSource.cpp) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebContentClientEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebContentServerEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebDriverClientEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebDriverServerEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES RequestServer/RequestClientEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES RequestServer/RequestServerEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebSocket/WebSocketClientEndpoint.h) - list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebSocket/WebSocketServerEndpoint.h) - - lagom_lib(LibWebView webview - SOURCES ${LIBWEBVIEW_SOURCES} ${LIBWEBVIEW_GENERATED_SOURCES} - LIBS LibGfx LibGUI LibIPC LibJS LibWeb LibProtocol) - foreach(header ${LIBWEBVIEW_GENERATED_SOURCES}) - get_filename_component(subdirectory ${header} DIRECTORY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${header}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory}") - endforeach() - install(FILES "${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/ConnectionCache.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/RequestServer") + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentServer.ipc Userland/Services/WebContent/WebContentServerEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentClient.ipc Userland/Services/WebContent/WebContentClientEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverClient.ipc Userland/Services/WebContent/WebDriverClientEndpoint.h) + compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverServer.ipc Userland/Services/WebContent/WebDriverServerEndpoint.h) endif() if (NOT EMSCRIPTEN) diff --git a/Userland/Libraries/LibWebView/CMakeLists.txt b/Userland/Libraries/LibWebView/CMakeLists.txt index a06b92b748..84318b387a 100644 --- a/Userland/Libraries/LibWebView/CMakeLists.txt +++ b/Userland/Libraries/LibWebView/CMakeLists.txt @@ -3,7 +3,6 @@ set(SOURCES AriaPropertiesStateModel.cpp ConsoleClient.cpp DOMTreeModel.cpp - OutOfProcessWebView.cpp RequestServerAdapter.cpp SourceHighlighter.cpp StylePropertiesModel.cpp @@ -12,6 +11,10 @@ set(SOURCES WebSocketClientAdapter.cpp ) +if (SERENITYOS) + list(APPEND SOURCES OutOfProcessWebView.cpp) +endif() + embed_as_string_view( "NativeStyleSheetSource.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Native.css" @@ -25,8 +28,32 @@ set(GENERATED_SOURCES ../../Services/RequestServer/RequestServerEndpoint.h ../../Services/WebContent/WebContentClientEndpoint.h ../../Services/WebContent/WebContentServerEndpoint.h + ../../Services/WebContent/WebDriverClientEndpoint.h + ../../Services/WebContent/WebDriverServerEndpoint.h + ../../Services/WebSocket/WebSocketClientEndpoint.h + ../../Services/WebSocket/WebSocketServerEndpoint.h NativeStyleSheetSource.cpp ) serenity_lib(LibWebView webview) -target_link_libraries(LibWebView PRIVATE LibCore LibFileSystemAccessClient LibGfx LibGUI LibIPC LibProtocol LibJS LibWeb) +target_link_libraries(LibWebView PRIVATE LibCore LibGfx LibGUI LibIPC LibProtocol LibJS LibWeb) + +if (SERENITYOS) + target_link_libraries(LibWebView PRIVATE LibFileSystemAccessClient) +endif() + +if (NOT SERENITYOS) + foreach(header ${GENERATED_SOURCES}) + get_filename_component(extension ${header} EXT) + if (NOT "${extension}" STREQUAL ".h") + continue() + endif() + + get_filename_component(subdirectory ${header} DIRECTORY) + string(REGEX REPLACE "^\\.\\./\\.\\./" "" subdirectory "${subdirectory}") + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${header}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory}") + endforeach() + + install(FILES "${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/ConnectionCache.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/RequestServer") +endif()