|
| 1 | +# The Flutter tooling requires that developers have CMake 3.10 or later |
| 2 | +# installed. You should not increase this version, as doing so will cause |
| 3 | +# the plugin to fail to compile for some customers of the plugin. |
1 | 4 | cmake_minimum_required(VERSION 3.10)
|
| 5 | + |
| 6 | +# Project-level configuration. |
2 | 7 | set(PROJECT_NAME "desktop_webview_window")
|
3 | 8 | project(${PROJECT_NAME} LANGUAGES CXX)
|
4 | 9 |
|
5 | 10 | # This value is used when generating builds using this plugin, so it must
|
6 |
| -# not be changed |
| 11 | +# not be changed. |
7 | 12 | set(PLUGIN_NAME "desktop_webview_window_plugin")
|
8 | 13 |
|
| 14 | + |
| 15 | +# === WebKit and libsoup dependencies === |
9 | 16 | find_package(PkgConfig REQUIRED)
|
10 |
| -pkg_check_modules(WebKit IMPORTED_TARGET webkit2gtk-4.1) |
| 17 | + |
| 18 | +# Try webkit2gtk-4.1 first, then fallback to 4.0 |
| 19 | +pkg_check_modules(WebKit IMPORTED_TARGET webkit2gtk-4.1) |
11 | 20 | if (NOT WebKit_FOUND)
|
12 |
| - pkg_check_modules(WebKit REQUIRED IMPORTED_TARGET webkit2gtk-4.0) # for backward compatibility |
| 21 | + pkg_check_modules(WebKit REQUIRED IMPORTED_TARGET webkit2gtk-4.0) |
13 | 22 | endif ()
|
14 | 23 |
|
| 24 | +# Try libsoup-3.0, fallback to libsoup-2.4 |
15 | 25 | pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-3.0)
|
16 | 26 | if (NOT LibSoup_FOUND)
|
17 |
| - pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-2.4) |
18 |
| -endif() |
| 27 | + pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-2.4) |
| 28 | +endif () |
19 | 29 |
|
| 30 | +# Any new source files that you add to the plugin should be added here. |
| 31 | +list(APPEND PLUGIN_SOURCES |
| 32 | + "desktop_webview_window_plugin.cc" |
| 33 | + "webview_window.cc" |
| 34 | + "webview_window.h" |
| 35 | + "message_channel_plugin.h" |
| 36 | + "message_channel_plugin.cc" |
| 37 | +) |
20 | 38 |
|
| 39 | +# Define the plugin library target. Its name must not be changed (see comment |
| 40 | +# on PLUGIN_NAME above). |
21 | 41 | add_library(${PLUGIN_NAME} SHARED
|
22 |
| - "desktop_webview_window_plugin.cc" |
23 |
| - webview_window.cc |
24 |
| - webview_window.h |
25 |
| - message_channel_plugin.h |
26 |
| - message_channel_plugin.cc |
27 |
| - ) |
| 42 | + ${PLUGIN_SOURCES} |
| 43 | +) |
| 44 | + |
| 45 | +# Apply a standard set of build settings that are configured in the |
| 46 | +# application-level CMakeLists.txt. This can be removed for plugins that want |
| 47 | +# full control over build settings. |
28 | 48 | apply_standard_settings(${PLUGIN_NAME})
|
| 49 | + |
| 50 | +# Symbols are hidden by default to reduce the chance of accidental conflicts |
| 51 | +# between plugins. This should not be removed; any symbols that should be |
| 52 | +# exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. |
29 | 53 | set_target_properties(${PLUGIN_NAME} PROPERTIES
|
30 | 54 | CXX_VISIBILITY_PRESET hidden)
|
31 | 55 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
|
| 56 | + |
| 57 | +# Source include directories and library dependencies. Add any plugin-spec ific |
| 58 | +# dependencies here. |
32 | 59 | target_include_directories(${PLUGIN_NAME} INTERFACE
|
33 | 60 | "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
34 | 61 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
|
35 | 62 | target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
|
36 | 63 | target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::WebKit)
|
| 64 | +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::LibSoup) |
| 65 | + |
37 | 66 |
|
38 |
| -# List of absolute paths to libraries that should be bundled with the plugin |
| 67 | +# List of absolute paths to libraries that should be bundled with the plugin. |
| 68 | +# This list could contain prebuilt libraries, or libraries created by an |
| 69 | +# external build triggered from this build file. |
39 | 70 | set(desktop_webview_window_bundled_libraries
|
40 | 71 | ""
|
41 | 72 | PARENT_SCOPE
|
42 |
| - ) |
| 73 | +) |
0 commit comments