CMake: Improve webview checks
Try to match behavior of configure. Fix building webview sample with STC disabled.
This commit is contained in:
@@ -223,23 +223,39 @@ if(wxUSE_GUI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(wxUSE_WEBVIEW AND WXGTK)
|
||||
find_package(LibSoup)
|
||||
if(WXGTK2)
|
||||
find_package(Webkit 1.0)
|
||||
elseif(WXGTK3)
|
||||
find_package(Webkit 3.0)
|
||||
find_package(Webkit2)
|
||||
if(NOT WEBKIT2_FOUND)
|
||||
wx_option_force_value(wxUSE_WEBVIEW_WEBKIT2 OFF)
|
||||
if(wxUSE_WEBVIEW)
|
||||
if(WXGTK)
|
||||
if(wxUSE_WEBVIEW_WEBKIT)
|
||||
find_package(LibSoup)
|
||||
if(WXGTK2)
|
||||
find_package(Webkit 1.0)
|
||||
elseif(WXGTK3)
|
||||
find_package(Webkit2)
|
||||
if(NOT WEBKIT2_FOUND)
|
||||
find_package(Webkit 3.0)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(wxUSE_WEBVIEW_WEBKIT OFF)
|
||||
set(wxUSE_WEBVIEW_WEBKIT2 OFF)
|
||||
if(WEBKIT_FOUND AND LIBSOUP_FOUND)
|
||||
set(wxUSE_WEBVIEW_WEBKIT ON)
|
||||
elseif(WEBKIT2_FOUND AND LIBSOUP_FOUND)
|
||||
set(wxUSE_WEBVIEW_WEBKIT2 ON)
|
||||
else()
|
||||
message(WARNING "webkit not found or enabled, wxWebview won't be available")
|
||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||
endif()
|
||||
elseif(WXMSW)
|
||||
if(NOT wxUSE_WEBVIEW_IE)
|
||||
message(WARNING "WebviewIE not found or enabled, wxWebview won't be available")
|
||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(NOT wxUSE_WEBVIEW_WEBKIT)
|
||||
message(WARNING "webkit not found or enabled, wxWebview won't be available")
|
||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WEBKIT_FOUND)
|
||||
wx_option_force_value(wxUSE_WEBVIEW_WEBKIT OFF)
|
||||
endif()
|
||||
if((NOT WEBKIT_FOUND AND NOT WEBKIT2_FOUND) OR NOT LIBSOUP_FOUND)
|
||||
message(WARNING "webkit not found, wxWebview won't be available")
|
||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -25,7 +25,7 @@ endif()
|
||||
|
||||
wx_add_library(webview ${WEBVIEW_FILES})
|
||||
|
||||
if(wxUSE_WEBVIEW_WEBKIT2)
|
||||
if(WXGTK AND 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}/${WX_WEB_EXTENSIONS_DIRECTORY}"
|
||||
@@ -53,7 +53,7 @@ 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)
|
||||
if(WXGTK 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)
|
||||
|
@@ -357,7 +357,6 @@ wx_option(wxUSE_DRAGIMAGE "use wxDragImage")
|
||||
wx_option(wxUSE_UIACTIONSIMULATOR "use wxUIActionSimulator (experimental)")
|
||||
wx_option(wxUSE_DC_TRANSFORM_MATRIX "use wxDC::SetTransformMatrix and related")
|
||||
wx_option(wxUSE_WEBVIEW_WEBKIT "use wxWebView WebKit backend")
|
||||
wx_option(wxUSE_WEBVIEW_WEBKIT2 "use wxWebView WebKit2 backend")
|
||||
if(WIN32 OR APPLE)
|
||||
set(wxUSE_PRIVATE_FONTS_DEFAULT ON)
|
||||
else()
|
||||
|
@@ -152,7 +152,10 @@ wx_add_sample(typetest typetest.cpp typetest.h)
|
||||
wx_add_sample(uiaction DEPENDS wxUSE_UIACTIONSIMULATOR)
|
||||
wx_add_sample(validate validate.cpp validate.h DEPENDS wxUSE_VALIDATORS)
|
||||
wx_add_sample(vscroll vstest.cpp)
|
||||
wx_add_sample(webview LIBRARIES webview stc NAME webviewsample DEPENDS wxUSE_WEBVIEW)
|
||||
wx_add_sample(webview LIBRARIES webview NAME webviewsample DEPENDS wxUSE_WEBVIEW)
|
||||
if(TARGET webviewsample AND wxUSE_STC)
|
||||
wx_exe_link_libraries(webviewsample stc)
|
||||
endif()
|
||||
# widgets Sample
|
||||
set(SAMPLE_WIDGETS_SRC
|
||||
activityindicator.cpp
|
||||
|
Reference in New Issue
Block a user