Skip to content

Commit

Permalink
Further cleanup of naming conventions and organization
Browse files Browse the repository at this point in the history
* Rename all variables to use keepassxc instead of keepassx
* Move some definitions to their proper locations in CMakeLists.txt
  • Loading branch information
droidmonkey authored and louib committed Dec 22, 2022
1 parent e5308d6 commit 48715c6
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 92 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
128 changes: 45 additions & 83 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -195,20 +195,20 @@ 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
gui/osutils/macutils/AppKitImpl.mm
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)
Expand All @@ -221,47 +221,36 @@ 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)
list(APPEND gui_SOURCES winhello/WindowsHello.cpp)
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)
Expand All @@ -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()
Expand All @@ -317,24 +290,17 @@ 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()

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
Expand All @@ -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()

Expand All @@ -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)

Expand Down
13 changes: 13 additions & 0 deletions src/autotype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion src/autotype/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/autotype/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/autotype/xcb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/core/Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KEEPASSX_GLOBAL_H
#define KEEPASSX_GLOBAL_H
#ifndef KEEPASSXC_GLOBAL_H
#define KEEPASSXC_GLOBAL_H

#include <QString>

#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
Expand Down Expand Up @@ -67,4 +67,4 @@ template <typename T> constexpr typename AddConst<T>::Type& asConst(T& t) noexce
// prevent rvalue arguments:
template <typename T> void asConst(const T&&) = delete;

#endif // KEEPASSX_GLOBAL_H
#endif // KEEPASSXC_GLOBAL_H
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48715c6

Please sign in to comment.