-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Visual Studio build #5874
Conversation
Awesome! |
Fantastic. I hope that also makes it easier to use the newer Windows API features, which are not available in windows.h. |
My next plan is to explore windows CNG API and see if any of possible storage providers (SW, TPM, Windows Hello) can be used to store master key (as some of KeePass plugins do). An later, try to use CNG API to load master key in and decrypt DB without exposing master key in KeePassXC memory. Btw, I see 2 checks have failed should I try to fix them? |
Run |
60709cb
to
755bf54
Compare
Need to include instructions on how to use vcpkg to provide most of the dependencies. I am getting very serious about replacing libgcrypt, libsodium (to a lesser extent), and Argon2 with Botan. |
Thumbs up for this! Botan is great c++ cryptography library. And having less dependency to worry about is I guess plus from security stand point. My next issue was just about asking why any of the well known c++ cryptography library like Botan or CryptoPP wasn't used in this project :) |
I toyed with it this morning and am committing to Botan. It's about time and there is broad support in all package managers except Xenial, but a PPA can cover that case. |
This depends on #6209 merge |
I'll update this PR once #6209 is merged. |
Use a rebase |
I have not forgotten about this. I think we're ready to incorporate. |
One more blocker on this one, Yubikey libraries are not available in vcpkg. Going to be removing that dependency anyway since they are deprecated by Yubikey and I want to have a better API when access the keys. Plan is to move the relevant code directly into KPXC. |
#6654 is posted, once merged we can get visual studio merged. This PR will need a setup guide included to get vcpkg and everything else squared away. |
Once the #6654 is merged, I'll try to squeeze in the setup docs as soon as I'll be able to. Somebody else will also probably have to write the guidance for yubikey part (I still haven't got one). |
Yubikey will work without any special actions after the other pr is merged. I am currently trying to fix the install command, msvc is no playing nice with cmake bundle tools. |
Oh, that's great. Unfortunately, I'm a little bit busy at the moment, but please let me know if I can help you with anything. |
Same here, we'll get there |
8a747b6
to
9aade70
Compare
Whewww finally got everything working! The magic variable to install dependencies is Need to incorporate msvc into the release tool and then this can be merged. |
172e1c1
to
bf66fae
Compare
Fantastic! I'll try to find some time this weekend and test final version. |
bf66fae
to
96adbab
Compare
Release tool updated, we are good to go now!
|
96adbab
to
ce918c0
Compare
* Use C++17 when using MSVC compiler * Remove unneeded header files and macros * Removed unnecessary Yubikey cmake file * Enhance release tool * Updated INSTALL.md
ce918c0
to
e026cc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished up the last minor issues when building a release package. This is ready to merge.
Finally got the chance to fully test the final (already merged) version of this PR. |
I am removing quazip in a future PR that is why I left it alone. |
Oh, I wasn't aware of that. |
This PR adds CMake build support for Visual Studio 2017 and newer.
This build system doesn't require MSYS2 to be installed or used on Windows to successfully compile. All required dependency can be build using Visual Studio with exception tolibgcrypt
andlibgpg-error
for which a port for VS has to be used. For example, ShiftMediaProject port for libgcrypt and libgpg-error.All KeePassXC modules successfully compile, run and work using this build system on Windows (e.g.: browser, sshagent, autotype, networking, updatecheck, keeshare). Please note, sshagent future was tested in app but was not tested with actually
ssh-agent
. The only not tested module is yubikey. I don't posses a YubiKey at the moment so I decided to skip this module and a future modification might be needed in order for this module to compile and/or run on Windows using this build system.This build system also compiles with additional security compile flags /DYNAMICBASE, /guard:cf, /GS and linker flags /NXCOMPAT & /guard:cf when in release mode. This fixes issue #4582.
On the code side, a slight modification of existing CMake project and some of the
.cmake
modules had to be made to account for MSVC compiler and specific things related to building with VS compiler. The source code of KeeePassXC was not refactored much, only added or removed some of windows related macros here and there.The biggest modification done to the CMake projects that also effects other build systems was made toFindsodium.cmake
module and howlibsodium
is linked into the project. On Windows a macroSODIUM_STATIC
has to be defined to properly import symbols from static library but at the moment this macro is not defined by current build system. BecauseFindsodium.cmake
module already definesSODIUM_STATIC
macro forsodium
package a decision was made to refactor all CMake projects to link against sodium library viasodium
package, opposite to linking directly to library constant${sodium_LIBRARY_RELEASE}
. This change successfully then links libsodium library and defines all necessary macros. Please note, due to constantssodium_LIBRARY_DEBUG
andsodium_DLL_DEBUG
were not used anywhere in the project, they were removed fromFindsodium.cmake
, and constantssodium_LIBRARY_RELEASE
&sodium_DLL_RELEASE
were renamed tosodium_LIBRARY
andsodium_DLL
.fix #4582
Update: ported to #6209 to use Botan crypto library.
Testing strategy
Tests were run only for Visual Studio compiled builds and not for MinGW or other builds.
All test have passed successfully for debug and release mode.
Note: For some tests warnings were encountered.
Type of change