Skip to content

Commit

Permalink
Fix packaged / no-gtk-integration builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Apr 13, 2021
1 parent 70d10e6 commit 672ec0b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,19 @@ elseif (LINUX)
if (NOT DESKTOP_APP_DISABLE_GTK_INTEGRATION)
find_package(PkgConfig REQUIRED)

pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
target_include_directories(lib_webview PUBLIC ${GTK3_INCLUDE_DIRS})

pkg_check_modules(WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-4.0)
target_include_directories(lib_webview PUBLIC ${WEBKIT_INCLUDE_DIRS})
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
target_link_libraries(lib_webview PUBLIC PkgConfig::GTK3)

pkg_check_modules(WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-4.0)
target_link_libraries(lib_webview PUBLIC PkgConfig::WEBKIT)
else()
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
target_include_directories(lib_webview PUBLIC ${GTK3_INCLUDE_DIRS})

pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
target_include_directories(lib_webview PUBLIC ${WEBKIT_INCLUDE_DIRS})
endif()
else()
remove_target_sources(lib_webview ${src_loc}
webview/platform/linux/webview_linux_webkit_gtk.cpp
Expand Down
8 changes: 8 additions & 0 deletions webview/platform/linux/webview_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@
namespace Webview {

Available Availability() {
#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION
return WebKit2Gtk::Availability();
#else // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
return false;
#endif // DESKTOP_APP_DISABLE_GTK_INTEGRATION
}

bool SupportsEmbedAfterCreate() {
return true;
}

std::unique_ptr<Interface> CreateInstance(Config config) {
#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION
return WebKit2Gtk::CreateInstance(std::move(config));
#else // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
return nullptr;
#endif // DESKTOP_APP_DISABLE_GTK_INTEGRATION
}

} // namespace Webview

0 comments on commit 672ec0b

Please sign in to comment.