diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 0f0adadf14..2724cc1b68 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2873,6 +2873,10 @@ set(WEBVIEW2_GTK_SRC src/gtk/webview_webkit2.cpp ) +set(WEBVIEW_WEBKIT2_EXTENSION_SRC + src/gtk/webview_webkit2_extension.cpp +) + set(XRC_SRC src/xrc/xh_activityindicator.cpp src/xrc/xh_animatctrl.cpp diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index c7055be359..8ec75c726d 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -26,8 +26,9 @@ endif() wx_add_library(webview ${WEBVIEW_FILES}) if(wxUSE_WEBVIEW_WEBKIT2) + set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") wx_lib_compile_definitions(webview PRIVATE - -DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/web-extensions" + -DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}" ) endif() @@ -50,3 +51,35 @@ elseif(WXGTK) endif() wx_finalize_lib(webview) + +# webkit extension plugin +# we can't use (all of the) macros and functions because this library should +# always be build as a shared libary, and not included in the monolithic build. +if(WXGTK AND LIBSOUP_FOUND AND wxUSE_WEBVIEW_WEBKIT2) + wx_append_sources(WEBKIT2_EXT_FILES WEBVIEW_WEBKIT2_EXTENSION) + add_library(webkit2_ext SHARED ${WEBKIT2_EXT_FILES}) + wx_set_target_properties(webkit2_ext false) + + # Change output name to match expected name in webview_webkit2.cpp: webkit2_ext* + if(wxUSE_UNICODE) + set(lib_unicode u) + endif() + set_target_properties(webkit2_ext PROPERTIES PREFIX "") + set_target_properties(webkit2_ext PROPERTIES + OUTPUT_NAME "webkit2_ext${lib_unicode}-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + OUTPUT_NAME_DEBUG "webkit2_ext${lib_unicode}d-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + ) + + target_include_directories(webkit2_ext PUBLIC + ${LIBSOUP_INCLUDE_DIRS} + ${WEBKIT2_INCLUDE_DIR} + ) + target_link_libraries(webkit2_ext PUBLIC + ${LIBSOUP_LIBRARIES} + ${WEBKIT2_LIBRARIES} + ) + + wx_install(TARGETS webkit2_ext LIBRARY DESTINATION ${WX_WEB_EXTENSIONS_DIRECTORY}) + + add_dependencies(webview webkit2_ext) +endif() diff --git a/build/files b/build/files index fa83ae8e71..7cb2c2234a 100644 --- a/build/files +++ b/build/files @@ -2815,6 +2815,9 @@ WEBVIEW_GTK_SRC = WEBVIEW2_GTK_SRC = src/gtk/webview_webkit2.cpp +WEBVIEW_WEBKIT2_EXTENSION_SRC = + src/gtk/webview_webkit2_extension.cpp + # wxXRC XRC_SRC = diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 81f9a9a667..656a10f778 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -407,13 +407,14 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context, GVariant *user_data = g_variant_new("(s)", address); // The first value is the location in which the extension is supposed to be - // normally installed, while the other two are used as fallbacks to allow + // normally installed, while the other three are used as fallbacks to allow // running the tests and sample using wxWebView before installing it. const char* const directories[] = { WX_WEB_EXTENSIONS_DIRECTORY, "..", "../..", + "lib", }; const char* dir = NULL;