diff --git a/CMakeLists.txt b/CMakeLists.txt index 265fd577..8f5a246e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,119 +1,147 @@ # CMake version required. This must be the very first line, because it sets default policies affecting everything else cmake_minimum_required(VERSION 3.1) # Project name and version project(Falkon VERSION 2.1.99) # Find ECM, with nice error handling in case of failure include(FeatureSummary) find_package(ECM 5.27.0 CONFIG) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/frameworks/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Many includes from ECM, to get all the nice cmake functions and settings include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMAddAppIcon) include(ECMQtDeclareLoggingCategory) # Output dirs (like ECM 5.38 does) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Version (TODO: move to a generated header once qmake support is dropped, to avoid full recompilations when changing this add_definitions(-DFALKON_VERSION=\"${PROJECT_VERSION}\") # Defines that are always set add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER) # Configurable options (TODO: move all defines to a generated header) option(NO_SYSTEM_DATAPATH "TODO" OFF) if (NO_SYSTEM_DATAPATH) add_definitions(-DNO_SYSTEM_DATAPATH) endif() option(KDE_INTEGRATION "TODO" OFF) if (KDE_INTEGRATION) set(KF5_MIN_VERSION "5.27.0") find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Wallet) add_definitions(-DKDE_INTEGRATION) endif() option(GNOME_INTEGRATION "TODO" OFF) if (GNOME_INTEGRATION) find_package(PkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(GNOME_KEYRING gnome-keyring-1) endif() add_definitions(-DGNOME_INTEGRATION) endif() option(NO_X11 "TODO" OFF) if (NO_X11) add_definitions(-DNO_X11) endif() option(PORTABLE_BUILD "TODO" OFF) if (PORTABLE_BUILD) add_definitions(-DPORTABLE_BUILD) endif() option(NONBLOCK_JS_DIALOGS "TODO" OFF) if (NONBLOCK_JS_DIALOGS) add_definitions(-DNONBLOCK_JS_DIALOGS) endif() option(USE_LIBPATH "TODO" "") # REMOVE? if (USE_LIBPATH) add_definitions(-DUSE_LIBPATH=\"${USE_LIBPATH}\") endif() option(DISABLE_DBUS "TODO" OFF) if (DISABLE_DBUS) add_definitions(-DDISABLE_DBUS) endif() option(DISABLE_UPDATES_CHECK "TODO" OFF) if (DISABLE_UPDATES_CHECK) add_definitions(-DDISABLE_UPDATES_CHECK) endif() # Note: the old qmake option DEBUG_BUILD is now -DCMAKE_BUILD_TYPE=Debug, and FALKON_PREFIX is now -DCMAKE_INSTALL_PREFIX # SHARE_FOLDER is now auto-detected, so is USE_LIBPATH. # Mandatory: Qt5 set(QT_MIN_VERSION "5.8.0") -find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel) +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel Test) if (NOT DISABLE_DBUS) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus) endif() if (UNIX AND NOT APPLE AND NOT NO_X11) find_package(X11) if (X11_FOUND) add_definitions(-DQZ_WS_X11) endif() find_package(XCB COMPONENTS XCB) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) endif() if (WIN32) add_definitions(-DW7API) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS WinExtras) # TODO set var for LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib ? endif() # Git revision if (EXISTS "${CMAKE_SOURCE_DIR}/.git") find_package(Git QUIET) if(GIT_FOUND) execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_REVISION ) string(REGEX REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}") add_definitions(-DGIT_REVISION=\"${GIT_REVISION}\") else() message(STATUS "Git revision could not be determined") endif() endif() -# Finally, go into the src subdir +# Include dirs used everywhere +include_directories( + ${CMAKE_SOURCE_DIR}/src/lib/3rdparty + ${CMAKE_SOURCE_DIR}/src/lib/adblock + ${CMAKE_SOURCE_DIR}/src/lib/app + ${CMAKE_SOURCE_DIR}/src/lib/autofill + ${CMAKE_SOURCE_DIR}/src/lib/bookmarks + ${CMAKE_SOURCE_DIR}/src/lib/cookies + ${CMAKE_SOURCE_DIR}/src/lib/downloads + ${CMAKE_SOURCE_DIR}/src/lib/history + ${CMAKE_SOURCE_DIR}/src/lib/navigation + ${CMAKE_SOURCE_DIR}/src/lib/network + ${CMAKE_SOURCE_DIR}/src/lib/notifications + ${CMAKE_SOURCE_DIR}/src/lib/opensearch + ${CMAKE_SOURCE_DIR}/src/lib/other + ${CMAKE_SOURCE_DIR}/src/lib/plugins + ${CMAKE_SOURCE_DIR}/src/lib/popupwindow + ${CMAKE_SOURCE_DIR}/src/lib/preferences + ${CMAKE_SOURCE_DIR}/src/lib/rss + ${CMAKE_SOURCE_DIR}/src/lib/session + ${CMAKE_SOURCE_DIR}/src/lib/sidebar + ${CMAKE_SOURCE_DIR}/src/lib/tabwidget + ${CMAKE_SOURCE_DIR}/src/lib/tools + ${CMAKE_SOURCE_DIR}/src/lib/webengine + ${CMAKE_SOURCE_DIR}/src/lib/webtab +) + +# Finally, go into the subdirs add_subdirectory(src) +add_subdirectory(tests/autotests) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index a505fda4..be8ba44a 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,59 +1,33 @@ -include_directories( - ${CMAKE_SOURCE_DIR}/src/lib/3rdparty - ${CMAKE_SOURCE_DIR}/src/lib/adblock - ${CMAKE_SOURCE_DIR}/src/lib/app - ${CMAKE_SOURCE_DIR}/src/lib/autofill - ${CMAKE_SOURCE_DIR}/src/lib/bookmarks - ${CMAKE_SOURCE_DIR}/src/lib/cookies - ${CMAKE_SOURCE_DIR}/src/lib/downloads - ${CMAKE_SOURCE_DIR}/src/lib/history - ${CMAKE_SOURCE_DIR}/src/lib/navigation - ${CMAKE_SOURCE_DIR}/src/lib/network - ${CMAKE_SOURCE_DIR}/src/lib/notifications - ${CMAKE_SOURCE_DIR}/src/lib/opensearch - ${CMAKE_SOURCE_DIR}/src/lib/other - ${CMAKE_SOURCE_DIR}/src/lib/plugins - ${CMAKE_SOURCE_DIR}/src/lib/popupwindow - ${CMAKE_SOURCE_DIR}/src/lib/preferences - ${CMAKE_SOURCE_DIR}/src/lib/rss - ${CMAKE_SOURCE_DIR}/src/lib/session - ${CMAKE_SOURCE_DIR}/src/lib/sidebar - ${CMAKE_SOURCE_DIR}/src/lib/tabwidget - ${CMAKE_SOURCE_DIR}/src/lib/tools - ${CMAKE_SOURCE_DIR}/src/lib/webengine - ${CMAKE_SOURCE_DIR}/src/lib/webtab -) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins") # QtWebEngine disable #add_subdirectory(AccessKeysNavigation) add_subdirectory(AutoScroll) add_subdirectory(FlashCookieManager) # GnomeKeyringPasswords only with GNOME_INTEGRATION and gnome-keyring pkg-config if (GNOME_INTEGRATION AND GNOME_KEYRING_FOUND) add_subdirectory(GnomeKeyringPasswords) endif() add_subdirectory(GreaseMonkey) add_subdirectory(ImageFinder) # KWalletPasswords only with KDE_INTEGRATION and KWallet framework if (KDE_INTEGRATION AND KF5Wallet_FOUND) add_subdirectory(KWalletPasswords) endif() add_subdirectory(MouseGestures) add_subdirectory(PIM) add_subdirectory(StatusBarIcons) add_subdirectory(TabManager) # TestPlugin only in debug build if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_subdirectory(TestPlugin) endif() # Not ported to cmake, for lack of a testcase: addSubdir($$(FALKON_PLUGINS_SRCDIR)) diff --git a/tests/autotests/CMakeLists.txt b/tests/autotests/CMakeLists.txt new file mode 100644 index 00000000..b5f4bfe4 --- /dev/null +++ b/tests/autotests/CMakeLists.txt @@ -0,0 +1,24 @@ +set(autotests_EXTRA_LIBS ) + +if (KDE_INTEGRATION AND KF5Wallet_FOUND) + add_definitions(-DHAVE_KDE_PASSWORDS_PLUGIN) + set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} ${CMAKE_BINARY_DIR}/bin/plugins/libKWalletPasswords.so) +endif() + +if (GNOME_INTEGRATION AND GNOME_KEYRING_FOUND) + add_definitions(-DHAVE_GNOME_PASSWORDS_PLUGIN) + set(autotests_EXTRA_LIBS ${autotests_EXTRA_LIBS} ${CMAKE_BINARY_DIR}/bin/plugins/libGnomeKeyringPasswords.so) +endif() + +set( autotests_SRCS + qztoolstest.cpp + main.cpp + cookiestest.cpp + adblocktest.cpp + updatertest.cpp + passwordbackendtest.cpp + ) + +add_executable(autotests ${autotests_SRCS}) +target_link_libraries(autotests FalkonPrivate Qt5::Test) +