Cmake: make Facebook support an actual option

This way we can selectively turn off Facebook support.

And turning off both Facebook support and support for the user manual
allows us to not rely on QWebKit which once again allows debugging
Subsurface with valgrind on Arch Linux.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-06 12:11:07 -07:00
parent 6ebeba3c7c
commit cf047466b5
2 changed files with 4 additions and 8 deletions

View file

@ -17,6 +17,7 @@ option(NO_PRINTING "disable the printing support" ON)
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF) option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
option(USE_LIBGIT23_API "allow building with libgit2 master" OFF) option(USE_LIBGIT23_API "allow building with libgit2 master" OFF)
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF) option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
option(FBSUPPORT "allow posting to Facebook" ON)
set(CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH}
@ -160,6 +161,7 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android") if(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(ANDROID_PKG AndroidExtras) set(ANDROID_PKG AndroidExtras)
set(ANDROID_LIB Qt5::AndroidExtras) set(ANDROID_LIB Qt5::AndroidExtras)
set(FBSUPPORT OFF)
endif() endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} Bluetooth) find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} Bluetooth)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} Qt5::Bluetooth) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} Qt5::Bluetooth)
@ -223,7 +225,6 @@ add_custom_target(
# set up the different target platforms # set up the different target platforms
set(PLATFORM_SRC unknown_platform.c) set(PLATFORM_SRC unknown_platform.c)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(FBSUPPORT 1)
set(SUBSURFACE_TARGET subsurface) set(SUBSURFACE_TARGET subsurface)
set(PLATFORM_SRC linux.c) set(PLATFORM_SRC linux.c)
# in some builds we appear to be missing libz for some strange reason... # in some builds we appear to be missing libz for some strange reason...
@ -236,7 +237,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(SUBSURFACE_TARGET subsurface) set(SUBSURFACE_TARGET subsurface)
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(FBSUPPORT 1)
set(SUBSURFACE_TARGET Subsurface) set(SUBSURFACE_TARGET Subsurface)
set(PLATFORM_SRC macos.c) set(PLATFORM_SRC macos.c)
find_library(APP_SERVICES_LIBRARY ApplicationServices) find_library(APP_SERVICES_LIBRARY ApplicationServices)
@ -254,7 +254,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE}) set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(FBSUPPORT 1)
set(SUBSURFACE_TARGET subsurface) set(SUBSURFACE_TARGET subsurface)
set(PLATFORM_SRC windows.c) set(PLATFORM_SRC windows.c)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32) set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)

View file

@ -12,11 +12,8 @@
#include "subsurfacewebservices.h" #include "subsurfacewebservices.h"
#if defined(FBSUPPORT) #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
#include "socialnetworks.h" #include "socialnetworks.h"
#endif
#ifndef Q_OS_ANDROID
#include <QWebView> #include <QWebView>
#endif #endif
@ -79,7 +76,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
void PreferencesDialog::facebookLoggedIn() void PreferencesDialog::facebookLoggedIn()
{ {
#ifndef Q_OS_ANDROID #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
// remove the login view and add the disconnect button // remove the login view and add the disconnect button
ui.fbLayout->removeItem(ui.fbLayout->itemAt(1)); ui.fbLayout->removeItem(ui.fbLayout->itemAt(1));
ui.fbLayout->insertWidget(1, ui.fbConnected, 0); ui.fbLayout->insertWidget(1, ui.fbConnected, 0);