Option to select extension compile-time. Fix #50 #123

This commit is contained in:
thez3ro 2016-12-04 19:57:24 +01:00
parent 791a749c2f
commit 65992ba6ae
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
7 changed files with 82 additions and 34 deletions

View File

@ -34,6 +34,10 @@ option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF)
option(WITH_COVERAGE "Use to build with coverage tests. (GCC ONLY)." OFF)
option(WITH_XC_AUTOTYPE "Include Autotype." OFF)
option(WITH_XC_HTTP "Include KeePassHTTP." OFF)
option(WITH_XC_YUBIKEY "Include Yubikey support." OFF)
set(KEEPASSXC_VERSION "2.1.0")
set(KEEPASSXC_VERSION_NUM "2.1.0")
@ -221,5 +225,10 @@ if(WITH_TESTS)
endif(WITH_TESTS)
if(PRINT_SUMMARY)
# This will print ENABLED, REQUIRED and DISABLED
feature_summary(WHAT ALL)
else()
# This will only print ENABLED and DISABLED feature
print_enabled_features()
print_disabled_features()
endif()

View File

@ -118,14 +118,6 @@ set(keepassx_SOURCES
gui/group/EditGroupWidget.cpp
gui/group/GroupModel.cpp
gui/group/GroupView.cpp
http/AccessControlDialog.cpp
http/EntryConfig.cpp
http/HttpPasswordGeneratorWidget.cpp
http/HttpSettings.cpp
http/OptionDialog.cpp
http/Protocol.cpp
http/Server.cpp
http/Service.cpp
keys/CompositeKey.cpp
keys/CompositeKey_p.h
keys/FileKey.cpp
@ -161,11 +153,30 @@ set(keepassx_FORMS
gui/entry/EditEntryWidgetHistory.ui
gui/entry/EditEntryWidgetMain.ui
gui/group/EditGroupWidgetMain.ui
http/AccessControlDialog.ui
http/HttpPasswordGeneratorWidget.ui
http/OptionDialog.ui
)
add_feature_info(KeePassHTTP WITH_XC_HTTP "KeePassHTTP support for ChromeIPass and PassIFox")
if(WITH_XC_HTTP)
set(keepasshttp_SOURCES
http/AccessControlDialog.cpp
http/EntryConfig.cpp
http/HttpPasswordGeneratorWidget.cpp
http/HttpSettings.cpp
http/OptionDialog.cpp
http/Protocol.cpp
http/Server.cpp
http/Service.cpp
)
set(keepasshttp_FORMS
http/AccessControlDialog.ui
http/HttpPasswordGeneratorWidget.ui
http/OptionDialog.ui
)
set(keepasshttp_LIB keepasshttp)
qt5_wrap_ui(keepasshttp_SOURCES ${keepasshttp_FORMS})
endif()
if(MINGW)
set(keepassx_SOURCES_MAINEXE
${keepassx_SOURCES_MAINEXE}
@ -177,15 +188,20 @@ qt5_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
add_library(zxcvbn STATIC zxcvbn/zxcvbn.cpp)
target_link_libraries(zxcvbn)
if(WITH_XC_HTTP)
add_library(keepasshttp STATIC ${keepasshttp_SOURCES})
target_link_libraries(keepasshttp ${MHD_LIBRARIES} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
endif()
add_library(keepassx_core STATIC ${keepassx_SOURCES})
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
target_link_libraries(keepassx_core zxcvbn Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
target_link_libraries(keepassx_core zxcvbn ${keepasshttp_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
target_link_libraries(${PROGNAME}
keepassx_core
zxcvbn
${MHD_LIBRARIES}
${keepasshttp_LIB}
Qt5::Core
Qt5::Concurrent
Qt5::Widgets

View File

@ -1,21 +1,25 @@
if(UNIX AND NOT APPLE)
find_package(X11)
find_package(Qt5X11Extras 5.2)
if(PRINT_SUMMARY)
add_feature_info(libXi X11_Xi_FOUND "The X11 Xi Protocol library is required for auto-type")
add_feature_info(libXtst X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type")
add_feature_info(Qt5X11Extras Qt5X11Extras_FOUND "The Qt5X11Extras library is required for auto-type")
add_feature_info(Autotype WITH_XC_AUTOTYPE "Auto-type passwords in Input fields")
if(WITH_XC_AUTOTYPE)
if(UNIX AND NOT APPLE)
find_package(X11)
find_package(Qt5X11Extras 5.2)
if(PRINT_SUMMARY)
add_feature_info(libXi X11_Xi_FOUND "The X11 Xi Protocol library is required for auto-type")
add_feature_info(libXtst X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type")
add_feature_info(Qt5X11Extras Qt5X11Extras_FOUND "The Qt5X11Extras library is required for auto-type")
endif()
if(X11_FOUND AND X11_Xi_FOUND AND X11_XTest_FOUND AND Qt5X11Extras_FOUND)
add_subdirectory(xcb)
endif()
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
if(X11_FOUND AND X11_Xi_FOUND AND X11_XTest_FOUND AND Qt5X11Extras_FOUND)
add_subdirectory(xcb)
if(WITH_TESTS)
add_subdirectory(test)
endif()
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
if(WITH_TESTS)
add_subdirectory(test)
endif()

View File

@ -12,6 +12,10 @@
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
#cmakedefine WITH_XC_HTTP
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_YUBIKEY
#cmakedefine HAVE_PR_SET_DUMPABLE 1
#cmakedefine HAVE_RLIMIT_CORE 1
#cmakedefine HAVE_PT_DENY_ATTACH 1

View File

@ -22,6 +22,8 @@
#include <QShortcut>
#include <QTimer>
#include "config-keepassx.h"
#include "autotype/AutoType.h"
#include "core/Config.h"
#include "core/FilePath.h"
@ -35,12 +37,16 @@
#include "gui/MessageBox.h"
#include "gui/SearchWidget.h"
#ifdef WITH_XC_HTTP
#include "http/Service.h"
#include "http/HttpSettings.h"
#include "http/OptionDialog.h"
#endif
#include "gui/SettingsWidget.h"
#include "gui/PasswordGeneratorWidget.h"
#ifdef WITH_XC_HTTP
class HttpPlugin: public ISettingsPage
{
public:
@ -72,6 +78,7 @@ class HttpPlugin: public ISettingsPage
private:
Service *m_service;
};
#endif
const QString MainWindow::BaseWindowTitle = "KeePassXC";
@ -92,7 +99,9 @@ MainWindow::MainWindow()
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
restoreGeometry(config()->get("GUI/MainWindowGeometry").toByteArray());
#ifdef WITH_XC_HTTP
m_ui->settingsWidget->addSettingsPage(new HttpPlugin(m_ui->tabWidget));
#endif
setWindowIcon(filePath()->applicationIcon());
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();

View File

@ -85,13 +85,13 @@ endmacro(add_unit_test)
set(TEST_LIBRARIES
keepassx_core
${keepasshttp_LIB}
Qt5::Core
Qt5::Concurrent
Qt5::Widgets
Qt5::Test
${GCRYPT_LIBRARIES}
${ZLIB_LIBRARIES}
${MHD_LIBRARIES}
)
set(testsupport_SOURCES modeltest.cpp FailDevice.cpp)
@ -143,9 +143,11 @@ add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp
add_unit_test(NAME testwildcardmatcher SOURCES TestWildcardMatcher.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
if(WITH_XC_AUTOTYPE)
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
LIBS ${TEST_LIBRARIES})
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
endif()
add_unit_test(NAME testentry SOURCES TestEntry.cpp
LIBS ${TEST_LIBRARIES})

View File

@ -5,4 +5,8 @@
#define KEEPASSX_TEST_DATA_DIR "${KEEPASSX_TEST_DATA_DIR}"
#cmakedefine WITH_XC_HTTP
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_YUBIKEY
#endif // KEEPASSX_CONFIG_TESTS_H