From 48715c6bdaee457460983c7483cb30c329d582ed Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Fri, 25 Nov 2022 15:15:03 -0500 Subject: [PATCH] Further cleanup of naming conventions and organization * Rename all variables to use keepassxc instead of keepassx * Move some definitions to their proper locations in CMakeLists.txt --- CMakeLists.txt | 11 +++ src/CMakeLists.txt | 128 ++++++++++------------------ src/autotype/CMakeLists.txt | 13 +++ src/autotype/test/CMakeLists.txt | 2 +- src/autotype/windows/CMakeLists.txt | 2 +- src/autotype/xcb/CMakeLists.txt | 2 +- src/cli/CMakeLists.txt | 2 +- src/core/Global.h | 8 +- tests/CMakeLists.txt | 2 +- 9 files changed, 78 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06eba07a28..0e47dc3832 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,17 @@ if(UNIX AND NOT APPLE AND NOT WITH_XC_X11) set(WITH_XC_AUTOTYPE OFF) endif() +add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing") +add_feature_info(Networking WITH_XC_NETWORKING "Compile KeePassXC with network access code (e.g. for downloading website icons)") +add_feature_info(KeePassXC-Browser WITH_XC_BROWSER "Browser integration with KeePassXC-Browser") +add_feature_info(SSHAgent WITH_XC_SSHAGENT "SSH agent integration compatible with KeeAgent") +add_feature_info(KeeShare WITH_XC_KEESHARE "Sharing integration with KeeShare") +add_feature_info(YubiKey WITH_XC_YUBIKEY "YubiKey HMAC-SHA1 challenge-response") +add_feature_info(UpdateCheck WITH_XC_UPDATECHECK "Automatic update checking") +if(UNIX AND NOT APPLE) + add_feature_info(FdoSecrets WITH_XC_FDOSECRETS "Implement freedesktop.org Secret Storage Spec server side API.") +endif() + set(KEEPASSXC_VERSION_MAJOR "2") set(KEEPASSXC_VERSION_MINOR "8") set(KEEPASSXC_VERSION_PATCH "0") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cd2cddcdb..085a2db063 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,7 @@ if(NOT ZXCVBN_LIBRARIES) set(ZXCVBN_LIBRARIES zxcvbn) endif(NOT ZXCVBN_LIBRARIES) -set(keepassx_SOURCES +set(core_SOURCES core/Alloc.cpp core/AutoTypeAssociations.cpp core/Base32.cpp @@ -195,11 +195,12 @@ set(gui_SOURCES gui/wizard/NewDatabaseWizardPage.cpp gui/wizard/NewDatabaseWizardPageMetaData.cpp gui/wizard/NewDatabaseWizardPageEncryption.cpp - gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp) + gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp + ../share/icons/icons.qrc + ../share/wizard/wizard.qrc) if(APPLE) - set(gui_SOURCES - ${gui_SOURCES} + list(APPEND gui_SOURCES gui/osutils/macutils/MacPasteboard.cpp gui/osutils/macutils/MacUtils.cpp gui/osutils/macutils/ScreenLockListenerMac.cpp @@ -207,8 +208,7 @@ if(APPLE) gui/osutils/macutils/AppKit.h) endif() if(UNIX AND NOT APPLE) - set(gui_SOURCES - ${gui_SOURCES} + list(APPEND gui_SOURCES gui/osutils/nixutils/ScreenLockListenerDBus.cpp gui/osutils/nixutils/NixUtils.cpp) if(WITH_XC_X11) @@ -221,8 +221,7 @@ if(UNIX AND NOT APPLE) MainWindow) endif() if(WIN32) - set(gui_SOURCES - ${gui_SOURCES} + list(APPEND gui_SOURCES gui/osutils/winutils/ScreenLockListenerWin.cpp gui/osutils/winutils/WinUtils.cpp) if (MSVC) @@ -230,38 +229,28 @@ if(WIN32) endif() endif() -set(gui_SOURCES ${gui_SOURCES} - ../share/icons/icons.qrc - ../share/wizard/wizard.qrc) - -set(keepassx_SOURCES_MAINEXE main.cpp) - -add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing") -add_feature_info(Networking WITH_XC_NETWORKING "Compile KeePassXC with network access code (e.g. for downloading website icons)") -add_feature_info(KeePassXC-Browser WITH_XC_BROWSER "Browser integration with KeePassXC-Browser") -add_feature_info(SSHAgent WITH_XC_SSHAGENT "SSH agent integration compatible with KeeAgent") -add_feature_info(KeeShare WITH_XC_KEESHARE "Sharing integration with KeeShare") -add_feature_info(YubiKey WITH_XC_YUBIKEY "YubiKey HMAC-SHA1 challenge-response") -add_feature_info(UpdateCheck WITH_XC_UPDATECHECK "Automatic update checking") -if(UNIX AND NOT APPLE) - add_feature_info(FdoSecrets WITH_XC_FDOSECRETS "Implement freedesktop.org Secret Storage Spec server side API.") -endif() - add_subdirectory(browser) add_subdirectory(proxy) if(WITH_XC_BROWSER) set(keepassxcbrowser_LIB keepassxcbrowser) - set(gui_SOURCES ${gui_SOURCES} gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp) - set(gui_SOURCES ${gui_SOURCES} gui/entry/EntryURLModel.cpp) - set(gui_SOURCES ${gui_SOURCES} gui/reports/ReportsWidgetBrowserStatistics.cpp) - set(gui_SOURCES ${gui_SOURCES} gui/reports/ReportsPageBrowserStatistics.cpp) + list(APPEND gui_SOURCES + gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp + gui/entry/EntryURLModel.cpp + gui/reports/ReportsWidgetBrowserStatistics.cpp + gui/reports/ReportsPageBrowserStatistics.cpp) endif() -add_subdirectory(autotype) +add_subdirectory(thirdparty) + add_subdirectory(cli) add_subdirectory(qrcode) set(qrcode_LIB qrcode) +add_subdirectory(autotype) +if(WITH_XC_AUTOTYPE) + set(autotype_LIB autotype) +endif() + add_subdirectory(keeshare) if(WITH_XC_KEESHARE) set(keeshare_LIB keeshare) @@ -277,31 +266,15 @@ if(WITH_XC_FDOSECRETS) set(fdosecrets_LIB fdosecrets) endif() -add_subdirectory(thirdparty) - -set(autotype_SOURCES - autotype/AutoType.cpp - autotype/AutoTypeAction.cpp - autotype/AutoTypeMatchModel.cpp - autotype/AutoTypeMatchView.cpp - autotype/AutoTypeSelectDialog.cpp - autotype/PickcharsDialog.cpp - autotype/ShortcutWidget.cpp - autotype/WindowSelectComboBox.cpp) - -if(WIN32) - set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc) -endif() - if(WITH_XC_YUBIKEY) - list(APPEND keepassx_SOURCES + list(APPEND core_SOURCES keys/drivers/YubiKey.h keys/drivers/YubiKey.cpp keys/drivers/YubiKeyInterface.cpp keys/drivers/YubiKeyInterfaceUSB.cpp keys/drivers/YubiKeyInterfacePCSC.cpp) else() - list(APPEND keepassx_SOURCES + list(APPEND core_SOURCES keys/drivers/YubiKey.h keys/drivers/YubiKeyStub.cpp) endif() @@ -317,7 +290,7 @@ if(WITH_XC_NETWORKING) endif() if(APPLE) - list(APPEND keepassx_SOURCES touchid/TouchID.mm) + list(APPEND core_SOURCES touchid/TouchID.mm) # TODO: Remove -Wno-error once deprecation warnings have been resolved. set_source_files_properties(touchid/TouchID.mm PROPERTY COMPILE_FLAGS "-Wno-old-style-cast") endif() @@ -325,16 +298,9 @@ endif() configure_file(config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h) configure_file(git-info.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/git-info.h) -add_library(autotype STATIC ${autotype_SOURCES}) -target_link_libraries(autotype Qt5::Core Qt5::Widgets) - -add_library(keepassx_core STATIC ${keepassx_SOURCES}) - -set(gui_SOURCES - ${gui_SOURCES} - ${keepassx_SOURCES}) - -set(keepassx_core_LIBRARIES +add_library(keepassxc_core STATIC ${core_SOURCES}) +set_target_properties(keepassxc_core PROPERTIES COMPILE_DEFINITIONS KEEPASSXC_BUILDING_CORE) +target_link_libraries(keepassxc_core ${qrcode_LIB} Qt5::Core Qt5::Concurrent @@ -345,46 +311,37 @@ set(keepassx_core_LIBRARIES ${ARGON2_LIBRARIES} ${thirdparty_LIBRARIES}) -add_library(keepassx_gui STATIC ${gui_SOURCES}) -target_link_libraries(keepassx_gui - ${keepassx_core_LIBRARIES} +add_library(keepassxc_gui STATIC ${gui_SOURCES}) +target_link_libraries(keepassxc_gui + keepassxc_core Qt5::Network Qt5::Widgets - autotype + ${autotype_LIB} ${keepassxcbrowser_LIB} ${fdosecrets_LIB} - ) - -set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) -target_link_libraries(keepassx_core ${keepassx_core_LIBRARIES}) - -if(WITH_XC_SSHAGENT) - target_link_libraries(keepassx_gui sshagent) -endif() -if(WITH_XC_KEESHARE) - target_link_libraries(keepassx_gui keeshare) -endif() + ${sshagent_LIB} + ${keeshare_LIB}) if(APPLE) - target_link_libraries(keepassx_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication") + target_link_libraries(keepassxc_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication") if(Qt5MacExtras_FOUND) - target_link_libraries(keepassx_gui Qt5::MacExtras) + target_link_libraries(keepassxc_gui Qt5::MacExtras) endif() endif() if(HAIKU) - target_link_libraries(keepassx_gui network) + target_link_libraries(keepassxc_gui network) endif() if(UNIX AND NOT APPLE) - target_link_libraries(keepassx_gui Qt5::DBus) + target_link_libraries(keepassxc_gui Qt5::DBus) if(WITH_XC_X11) - target_link_libraries(keepassx_gui Qt5::X11Extras X11) + target_link_libraries(keepassxc_gui Qt5::X11Extras X11) endif() include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) endif() if(WIN32) - target_link_libraries(keepassx_gui Wtsapi32.lib Ws2_32.lib) + target_link_libraries(keepassxc_gui Wtsapi32.lib Ws2_32.lib) if (MSVC) - target_link_libraries(keepassx_gui WindowsApp.lib) + target_link_libraries(keepassxc_gui WindowsApp.lib) endif() endif() @@ -400,8 +357,13 @@ if(WIN32) ) endif() -add_executable(${PROGNAME} WIN32 ${keepassx_SOURCES_MAINEXE} ${WIN32_ProductVersionFiles}) -target_link_libraries(${PROGNAME} keepassx_gui) +set(mainexe_SOURCES main.cpp) +if(WIN32) + list(APPEND mainexe_SOURCES ${CMAKE_SOURCE_DIR}/share/windows/icon.rc) +endif() + +add_executable(${PROGNAME} WIN32 ${mainexe_SOURCES} ${WIN32_ProductVersionFiles}) +target_link_libraries(${PROGNAME} keepassxc_gui) set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON) diff --git a/src/autotype/CMakeLists.txt b/src/autotype/CMakeLists.txt index 79bb503722..a3a0f22d98 100644 --- a/src/autotype/CMakeLists.txt +++ b/src/autotype/CMakeLists.txt @@ -18,4 +18,17 @@ if(WITH_XC_AUTOTYPE) if(WITH_TESTS) add_subdirectory(test) endif() + + set(autotype_SOURCES + AutoType.cpp + AutoTypeAction.cpp + AutoTypeMatchModel.cpp + AutoTypeMatchView.cpp + AutoTypeSelectDialog.cpp + PickcharsDialog.cpp + ShortcutWidget.cpp + WindowSelectComboBox.cpp) + + add_library(autotype STATIC ${autotype_SOURCES}) + target_link_libraries(autotype Qt5::Core Qt5::Widgets) endif() diff --git a/src/autotype/test/CMakeLists.txt b/src/autotype/test/CMakeLists.txt index d395936e03..e27f2b1d98 100644 --- a/src/autotype/test/CMakeLists.txt +++ b/src/autotype/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(autotype_test_SOURCES AutoTypeTest.cpp) add_library(keepassxc-autotype-test MODULE ${autotype_test_SOURCES}) -target_link_libraries(keepassxc-autotype-test keepassx_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) +target_link_libraries(keepassxc-autotype-test keepassxc_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) diff --git a/src/autotype/windows/CMakeLists.txt b/src/autotype/windows/CMakeLists.txt index 8ebfd13322..5b9cbecff9 100644 --- a/src/autotype/windows/CMakeLists.txt +++ b/src/autotype/windows/CMakeLists.txt @@ -1,7 +1,7 @@ set(autotype_win_SOURCES AutoTypeWindows.cpp) add_library(keepassxc-autotype-windows MODULE ${autotype_win_SOURCES}) -target_link_libraries(keepassxc-autotype-windows keepassx_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) +target_link_libraries(keepassxc-autotype-windows keepassxc_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) install(TARGETS keepassxc-autotype-windows BUNDLE DESTINATION . COMPONENT Runtime LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime) diff --git a/src/autotype/xcb/CMakeLists.txt b/src/autotype/xcb/CMakeLists.txt index dbb5470c55..f14017f63a 100644 --- a/src/autotype/xcb/CMakeLists.txt +++ b/src/autotype/xcb/CMakeLists.txt @@ -3,7 +3,7 @@ include_directories(SYSTEM ${X11_X11_INCLUDE_PATH}) set(autotype_XCB_SOURCES AutoTypeXCB.cpp) add_library(keepassxc-autotype-xcb MODULE ${autotype_XCB_SOURCES}) -target_link_libraries(keepassxc-autotype-xcb keepassx_gui Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) +target_link_libraries(keepassxc-autotype-xcb keepassxc_gui Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) install(TARGETS keepassxc-autotype-xcb BUNDLE DESTINATION . COMPONENT Runtime LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime) diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index a3852c800f..8bd97dfb71 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -58,7 +58,7 @@ add_executable(keepassxc-cli keepassxc-cli.cpp) target_link_libraries(keepassxc-cli ${GPGERROR_LIBRARIES} cli - keepassx_core) + keepassxc_core) install(TARGETS keepassxc-cli BUNDLE DESTINATION . COMPONENT Runtime diff --git a/src/core/Global.h b/src/core/Global.h index e9a4db7397..ec311929a9 100644 --- a/src/core/Global.h +++ b/src/core/Global.h @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -#ifndef KEEPASSX_GLOBAL_H -#define KEEPASSX_GLOBAL_H +#ifndef KEEPASSXC_GLOBAL_H +#define KEEPASSXC_GLOBAL_H #include #if defined(Q_OS_WIN) -#if defined(KEEPASSX_BUILDING_CORE) +#if defined(KEEPASSXC_BUILDING_CORE) #define KEEPASSXC_EXPORT Q_DECL_IMPORT #else #define KEEPASSXC_EXPORT Q_DECL_EXPORT @@ -67,4 +67,4 @@ template constexpr typename AddConst::Type& asConst(T& t) noexce // prevent rvalue arguments: template void asConst(const T&&) = delete; -#endif // KEEPASSX_GLOBAL_H +#endif // KEEPASSXC_GLOBAL_H diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fafe2c62ed..26e132cd7b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -90,7 +90,7 @@ macro(add_unit_test) endif() endmacro(add_unit_test) -set(TEST_LIBRARIES keepassx_gui Qt5::Test) +set(TEST_LIBRARIES keepassxc_gui Qt5::Test) set(testsupport_SOURCES modeltest.cpp