build-system: allow adaptive building without WebKit

This should avoid build failures on platforms where we don't know if
QtWebKit will be available or not.

The options for printing and user manual are awkward to work with. This
all needs to be cleaned up at some point. Right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-07-06 13:11:38 -07:00
parent 21de82144a
commit 4bac5dbb66
2 changed files with 21 additions and 12 deletions

View file

@ -145,9 +145,6 @@ include(pkgconfig_helper)
# module file. # module file.
include(HandleFindGit2) include(HandleFindGit2)
include(HandleFindLibDiveComputer) include(HandleFindLibDiveComputer)
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
include(HandleUserManual)
endif()
include(HandleFtdiSupport) include(HandleFtdiSupport)
include(HandleVersionGeneration) include(HandleVersionGeneration)
include(RunOnBuildDir) include(RunOnBuildDir)
@ -249,14 +246,32 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
endif() endif()
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets) list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
remove_definitions(-DSUBSURFACE_MOBILE) remove_definitions(-DSUBSURFACE_MOBILE)
if(NO_USERMANUAL)
message(STATUS "building without built-in user manual support")
add_definitions(-DNO_USERMANUAL)
else()
set(REQUEST_WEBKIT ON)
endif()
if(NO_PRINTING) if(NO_PRINTING)
message(STATUS "building without printing support") message(STATUS "building without printing support")
add_definitions(-DNO_PRINTING) add_definitions(-DNO_PRINTING)
else() else()
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport) set(REQUEST_WEBKIT ON)
endif()
if(REQUEST_WEBKIT)
# Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way # Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way
find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5WebKitWidgets QUIET)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt5::WebKitWidgets) if(Qt5WebKitWidgets_FOUND STREQUAL "1")
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport WebKitWidgets)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt5::WebKitWidgets)
message(STATUS "building with QtWebKit")
else()
message(STATUS "didn't find QtWebKit, building without user manual and printing support")
add_definitions(-DNO_PRINTING)
add_definitions(-DNO_USERMANUAL)
set(NO_PRINTING ON)
set(NO_USERMANUAL ON)
endif()
endif() endif()
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")

View file

@ -1,6 +0,0 @@
if(NO_USERMANUAL)
message(STATUS "building without usermanual")
add_definitions(-DNO_USERMANUAL)
else()
list(APPEND QT_EXTRA_COMPONENTS WebKitWidgets)
endif()