Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmlu <smlu@s5.net>2021-09-07 05:26:00 +0300
committerJonathan White <support@dmapps.us>2021-09-20 00:16:45 +0300
commit0c6587b5b7325556aa41eadc2322908e95f14003 (patch)
tree51f15098c3d4b138cff989d469cd28d6fc4fae5a /src
parent24a23ce66eb07d7ee46dade36b23b295c13b6c1f (diff)
Add support for Microsoft Visual Studio buildchain
* Use C++17 when using MSVC compiler * Remove unneeded header files and macros * Removed unnecessary Yubikey cmake file * Enhance release tool * Updated INSTALL.md
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt80
-rw-r--r--src/autotype/windows/AutoTypeWindows.h4
-rw-r--r--src/browser/BrowserHost.cpp4
-rw-r--r--src/cli/CMakeLists.txt10
-rw-r--r--src/cli/TextStream.cpp2
-rw-r--r--src/gui/osutils/winutils/WinUtils.h7
-rwxr-xr-xsrc/proxy/CMakeLists.txt2
-rw-r--r--src/proxy/NativeMessagingProxy.cpp8
-rw-r--r--src/qrcode/CMakeLists.txt4
-rw-r--r--src/zxcvbn/zxcvbn.c6
10 files changed, 76 insertions, 51 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f8f8bacc8..5f3940767 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -207,7 +207,7 @@ if(UNIX AND NOT APPLE)
gui/osutils/nixutils/NixUtils.cpp
gui/osutils/nixutils/X11Funcs.cpp)
endif()
-if(MINGW)
+if(WIN32)
set(keepassx_SOURCES
${keepassx_SOURCES}
gui/osutils/winutils/ScreenLockListenerWin.cpp
@@ -275,7 +275,7 @@ set(autotype_SOURCES
autotype/ShortcutWidget.cpp
autotype/WindowSelectComboBox.cpp)
-if(MINGW)
+if(WIN32)
set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
endif()
@@ -348,11 +348,11 @@ if(UNIX AND NOT APPLE)
target_link_libraries(keepassx_core Qt5::DBus Qt5::X11Extras X11)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
endif()
-if(MINGW)
+if(WIN32)
target_link_libraries(keepassx_core Wtsapi32.lib Ws2_32.lib)
endif()
-if(MINGW)
+if(WIN32)
include(GenerateProductVersion)
generate_product_version(
WIN32_ProductVersionFiles
@@ -407,7 +407,7 @@ install(TARGETS ${PROGNAME}
BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
-if(MINGW)
+if(WIN32)
if(${CMAKE_SIZEOF_VOID_P} EQUAL "8")
set(OUTPUT_FILE_POSTFIX "Win64")
else()
@@ -462,38 +462,54 @@ if(MINGW)
set(CPACK_WIX_EXTENSIONS "WixUtilExtension.dll")
include(CPack)
- install(CODE "set(gp_tool \"objdump\")" COMPONENT Runtime)
+ if(NOT VCPKG_INSTALLED_DIR)
+ install(CODE "set(gp_tool \"objdump\")" COMPONENT Runtime)
- # Deploy all 3rd party library dependencies first
- install(CODE "include(BundleUtilities)
- fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${PROGNAME}.exe\" \"\" \"\")"
- COMPONENT Runtime)
+ # Deploy all 3rd party library dependencies first
+ install(CODE "include(BundleUtilities)
+ fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${PROGNAME}.exe\" \"\" \"\")"
+ COMPONENT Runtime)
- # Use windeployqt.exe to setup Qt dependencies
- if(Qt5Core_VERSION VERSION_LESS "5.14.1")
- set(WINDEPLOYQT_MODE "--release")
- if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
- set(WINDEPLOYQT_MODE "--debug")
- endif()
- endif()
-
- install(CODE "execute_process(COMMAND ${WINDEPLOYQT_EXE} ${PROGNAME}.exe ${WINDEPLOYQT_MODE} WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX} OUTPUT_QUIET)"
- COMPONENT Runtime)
-
- # install CA cert chains
- install(FILES ${Qt5_PREFIX}/ssl/certs/ca-bundle.crt DESTINATION "ssl/certs")
- # install OpenSSL library
- if(WITH_XC_NETWORKING)
- find_file(OPENSSL_DLL NAMES libssl-1_1.dll libssl-1_1-x64.dll)
- if (NOT OPENSSL_DLL)
- message(FATAL_ERROR "Cannot find libssl dll, ensure openssl is properly installed.")
+ # Use windeployqt.exe to setup Qt dependencies
+ if(Qt5Core_VERSION VERSION_LESS "5.14.1")
+ set(WINDEPLOYQT_MODE "--release")
+ if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
+ set(WINDEPLOYQT_MODE "--debug")
+ endif()
endif()
- find_file(CRYPTO_DLL NAMES libcrypto-1_1.dll libcrypto-1_1-x64.dll)
- if (NOT CRYPTO_DLL)
- message(FATAL_ERROR "Cannot find libcrypto dll, ensure openssl is properly installed.")
+ install(CODE "execute_process(COMMAND ${WINDEPLOYQT_EXE} ${PROGNAME}.exe ${WINDEPLOYQT_MODE} WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX} OUTPUT_QUIET)"
+ COMPONENT Runtime)
+
+ # install OpenSSL library
+ if(WITH_XC_NETWORKING)
+ find_file(OPENSSL_DLL
+ NAMES libssl-1_1.dll libssl-1_1-x64.dll
+ HINTS "${OPENSSL_ROOT_DIR}/bin"
+ )
+ if (NOT OPENSSL_DLL)
+ message(FATAL_ERROR "Cannot find libssl dll, ensure openssl is properly installed.")
+ endif()
+
+ find_file(CRYPTO_DLL
+ NAMES libcrypto-1_1.dll libcrypto-1_1-x64.dll
+ HINTS "${OPENSSL_ROOT_DIR}/bin"
+ )
+ if (NOT CRYPTO_DLL)
+ message(FATAL_ERROR "Cannot find libcrypto dll, ensure openssl is properly installed.")
+ endif()
+
+ install(FILES ${OPENSSL_DLL} ${CRYPTO_DLL} DESTINATION ".")
endif()
+ endif()
- install(FILES ${OPENSSL_DLL} ${CRYPTO_DLL} DESTINATION ".")
+ # install CA cert chains
+ find_file(SSL_CA_BUNDLE ca-bundle.crt PATHS "${Qt5_PREFIX}/ssl/certs")
+ if(SSL_CA_BUNDLE)
+ install(FILES ${SSL_CA_BUNDLE} DESTINATION "ssl/certs")
+ else()
+ file(DOWNLOAD "https://curl.se/ca/cacert.pem" "${CMAKE_BINARY_DIR}/ca-bundle.crt" TLS_VERIFY ON)
+ install(FILES "${CMAKE_BINARY_DIR}/ca-bundle.crt" DESTINATION "ssl/certs")
endif()
+
endif()
diff --git a/src/autotype/windows/AutoTypeWindows.h b/src/autotype/windows/AutoTypeWindows.h
index 883677b57..7b3d577d0 100644
--- a/src/autotype/windows/AutoTypeWindows.h
+++ b/src/autotype/windows/AutoTypeWindows.h
@@ -20,6 +20,10 @@
#define KEEPASSX_AUTOTYPEWINDOWS_H
#include <QtPlugin>
+
+#undef NOMINMAX
+#define NOMINMAX
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "autotype/AutoTypeAction.h"
diff --git a/src/browser/BrowserHost.cpp b/src/browser/BrowserHost.cpp
index b58f0f5fb..6ddf7e061 100644
--- a/src/browser/BrowserHost.cpp
+++ b/src/browser/BrowserHost.cpp
@@ -24,8 +24,8 @@
#ifdef Q_OS_WIN
#include <fcntl.h>
-#include <winsock2.h>
-
+#undef NOMINMAX
+#define NOMINMAX
#include <windows.h>
#else
#include <sys/socket.h>
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 4e6defd14..0b348d3c9 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -47,7 +47,7 @@ find_package(Readline)
if (READLINE_FOUND)
target_compile_definitions(cli PUBLIC USE_READLINE)
- target_link_libraries(cli readline)
+ target_link_libraries(cli ${Readline_LIBRARY})
endif()
add_executable(keepassxc-cli keepassxc-cli.cpp)
@@ -60,10 +60,10 @@ install(TARGETS keepassxc-cli
BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION ${CLI_INSTALL_DIR} COMPONENT Runtime)
-if(MINGW)
- install(CODE "include(BundleUtilities)
- fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/keepassxc-cli.exe\" \"\" \"\")"
- COMPONENT Runtime)
+if(WIN32)
+# install(CODE "include(BundleUtilities)
+# fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/keepassxc-cli.exe\" \"\" \"\")"
+# COMPONENT Runtime)
endif()
if(APPLE AND WITH_APP_BUNDLE)
diff --git a/src/cli/TextStream.cpp b/src/cli/TextStream.cpp
index 5757f90e9..e2e6e15f4 100644
--- a/src/cli/TextStream.cpp
+++ b/src/cli/TextStream.cpp
@@ -73,7 +73,7 @@ void TextStream::detectCodec()
auto env = QProcessEnvironment::systemEnvironment();
#ifdef Q_OS_WIN
- WINBOOL success = false;
+ bool success = false;
#ifdef CP_UTF8
success = SetConsoleOutputCP(CP_UTF8);
#endif
diff --git a/src/gui/osutils/winutils/WinUtils.h b/src/gui/osutils/winutils/WinUtils.h
index a4522e08b..ca595dea2 100644
--- a/src/gui/osutils/winutils/WinUtils.h
+++ b/src/gui/osutils/winutils/WinUtils.h
@@ -25,7 +25,12 @@
#include <QScopedPointer>
#include <QSharedPointer>
-#include <windef.h>
+#undef NOMINMAX
+#define NOMINMAX
+#define WIN32_LEAN_AND_MEAN
+#define NOGDI
+#include <windows.h>
+#undef MessageBox
class WinUtils : public OSUtilsBase, QAbstractNativeEventFilter
{
diff --git a/src/proxy/CMakeLists.txt b/src/proxy/CMakeLists.txt
index d013b5307..589d7f7d8 100755
--- a/src/proxy/CMakeLists.txt
+++ b/src/proxy/CMakeLists.txt
@@ -39,7 +39,7 @@ if(WITH_XC_BROWSER)
COMMENT "Deploying keepassxc-proxy")
endif()
- if(MINGW)
+ if(WIN32)
target_link_libraries(keepassxc-proxy Wtsapi32.lib Ws2_32.lib)
endif()
endif()
diff --git a/src/proxy/NativeMessagingProxy.cpp b/src/proxy/NativeMessagingProxy.cpp
index 5cffc6c77..964383dc5 100644
--- a/src/proxy/NativeMessagingProxy.cpp
+++ b/src/proxy/NativeMessagingProxy.cpp
@@ -26,9 +26,8 @@
#ifdef Q_OS_WIN
#include <fcntl.h>
+#include <io.h>
#include <winsock2.h>
-
-#include <windows.h>
#else
#include <sys/socket.h>
#endif
@@ -49,9 +48,14 @@ NativeMessagingProxy::NativeMessagingProxy()
void NativeMessagingProxy::setupStandardInput()
{
#ifdef Q_OS_WIN
+#ifdef Q_CC_MSVC
+ _setmode(_fileno(stdin), _O_BINARY);
+ _setmode(_fileno(stdout), _O_BINARY);
+#else
setmode(fileno(stdin), _O_BINARY);
setmode(fileno(stdout), _O_BINARY);
#endif
+#endif
QtConcurrent::run([this] {
while (std::cin.good()) {
diff --git a/src/qrcode/CMakeLists.txt b/src/qrcode/CMakeLists.txt
index bce692d67..5d01d07b7 100644
--- a/src/qrcode/CMakeLists.txt
+++ b/src/qrcode/CMakeLists.txt
@@ -17,6 +17,8 @@ set(qrcode_SOURCES
QrCode.cpp
)
+find_package(QREncode REQUIRED)
+
add_library(qrcode STATIC ${qrcode_SOURCES})
-target_link_libraries(qrcode Qt5::Core Qt5::Widgets Qt5::Svg ${QRENCODE_LIBRARY})
target_include_directories(qrcode PRIVATE ${QRENCODE_INCLUDE_DIR})
+target_link_libraries(qrcode PUBLIC Qt5::Core Qt5::Widgets Qt5::Svg ${QRENCODE_LIBRARY})
diff --git a/src/zxcvbn/zxcvbn.c b/src/zxcvbn/zxcvbn.c
index 1d6a307c3..23792b4d6 100644
--- a/src/zxcvbn/zxcvbn.c
+++ b/src/zxcvbn/zxcvbn.c
@@ -44,12 +44,6 @@
#endif
#endif
-/* For pre-compiled headers under windows */
-#ifndef __MINGW32__
-#ifdef _WIN32
-#include "stdafx.h"
-#endif
-#endif
/* Minimum number of characters in a incrementing/decrementing sequence match */
#define MIN_SEQUENCE_LEN 3