Add vcpkg manifest with build dependencies

Also bump minimum CMake release
This commit is contained in:
Janek Bevendorff 2023-12-09 14:43:29 +01:00 committed by Jonathan White
parent d2a4ccbc16
commit d2e7d4a5ad
10 changed files with 153 additions and 44 deletions

4
.gitignore vendored
View File

@ -27,3 +27,7 @@ CMakePresets.json
CMakeUserPresets.json
.vs/
out/
# vcpkg
vcpkg_installed*/

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.3.0)
cmake_minimum_required(VERSION 3.10.0)
project(KeePassXC)
set(APP_ID "org.keepassxc.${PROJECT_NAME}")

View File

@ -6,34 +6,21 @@ For more information, see also the [_Building KeePassXC_](https://github.com/kee
The [QuickStart Guide](https://keepassxc.org/docs/KeePassXC_GettingStarted.html) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page](https://keepassxc.org/download).
Build Dependencies
==================
The following tools must exist within your PATH:
* make
* cmake (>= 3.3.0)
* g++ (>= 4.7) or clang++ (>= 6.0)
* asciidoctor (>= 2.0)
The following libraries are required:
* Qt 5 (>= 5.9.5): qtbase5, qtbase5-private, libqt5svg5, qttools5, qt5-image-formats-plugins
* botan (>= 2.12)
* libargon2
* zlib
* minizip
* readline (for completion in cli)
* qtx11extras, libxi, and libxtst (for auto-type on X11)
* qrencode
* libusb-1.0, pcsc-lite (for Yubikey support on Linux)
Prepare the Building Environment
Toolchain and Build Dependencies
================================
* [Building Environment on Linux](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Linux)
* [Building Environment on Windows](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows)
* [Building Environment on MacOS](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS)
The following build tools must exist within your PATH:
* cmake (>= 3.10.0)
* make (>= 4.2) or ninja (>= 1.10)
* g++ (>= 4.9) or clang++ (>= 6.0)
* asciidoctor (>= 2.0)
* Besides a working C++ toolchain, KeePassXC also has a number of direct build and runtime dependencies. For detailed information about how to install them, please refer to the GitHub wiki:
* [Set up Build Environment on Linux](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Linux)
* [Set up Build Environment on Windows](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows)
* [Set up Build Environment on macOS](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS)
Build Steps
===========
@ -63,7 +50,7 @@ To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Comm
git checkout latest
```
2. Navigate to the directory where you have downloaded KeePassXC and type these commands:
2. Navigate to the directory where you have downloaded KeePassXC and run:
```
mkdir build
@ -72,39 +59,36 @@ To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Comm
make
```
Note: These steps place the compiled KeePassXC binary inside the `./build/src/` directory.
If you have `vcpkg` installed, add `-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake` to the `cmake` command to automatically download and install all required build and runtime dependencies locally to your build directory before compiling KeePassXC. Using `vcpkg` is the preferred way to install dependencies on macOS and required on Windows if using the MSVC toolchain.
For more detailed build instructions for each platform, please refer to the [GitHub wiki](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC).
Note: These steps place the compiled KeePassXC binary inside the `./build/src/` directory (`src/KeePassXC.app/Contents/MacOS` on macOS).
## MacOS Build Notes
If you installed Qt5 via Homebrew, you should be able to compile KeePassXC without any changes. If CMake fails to find your Qt installation, you can specify it manually by adding the following parameter:
If you installed Qt5 via Homebrew and CMake fails to find your Qt installation, you can specify it manually by adding the following parameter:
`-DCMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake`
(or whatever your Qt installation path is)
When building with ASAN support on macOS, you need to use `export ASAN_OPTIONS=detect_leaks=0` before running the tests (LSAN is no supported on macOS).
## Windows Build Notes
For detailed build steps see the [Windows Build Instructions](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC#windows).
If you are using MSVC, you may have to specify your Vcpkg toolchain by adding the following CMake parameter: `-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake`
If you are using MSYS2, you have to add ```-G "MSYS Makefiles"``` at the beginning of the cmake command.
CMake Configuration Options
==========================
## Common Parameters
## Recommended CMake Build Parameters
```
-DCMAKE_INSTALL_PREFIX=$(brew --prefix)
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=<RelWithDebInfo/Debug/Release>
-DWITH_GUI_TESTS=ON
```
## KeePassXC Parameters
## Additional CMake Parameters
KeePassXC comes with a variety of build options that can turn on/off features. Most notably, we allow you to build the application with all TCP/IP networking code disabled. Please note that we still require and link against Qt5's network library in order to use local named pipes on all operating systems. Each of these build options are supplied at the time of calling cmake:

View File

@ -15,12 +15,12 @@
find_path(QRENCODE_INCLUDE_DIR NAMES qrencode.h)
if (VCPKG_INSTALLED_DIR)
find_library(QRENCODE_LIBRARY_RELEASE qrencode)
find_library(QRENCODE_LIBRARY_DEBUG qrencoded)
set(QRENCODE_LIBRARY optimized ${QRENCODE_LIBRARY_RELEASE} debug ${QRENCODE_LIBRARY_DEBUG})
if(WIN32 AND MSVC)
find_library(QRENCODE_LIBRARY_RELEASE qrencode)
find_library(QRENCODE_LIBRARY_DEBUG qrencoded)
set(QRENCODE_LIBRARY optimized ${QRENCODE_LIBRARY_RELEASE} debug ${QRENCODE_LIBRARY_DEBUG})
else()
find_library(QRENCODE_LIBRARY qrencode)
find_library(QRENCODE_LIBRARY qrencode)
endif()
mark_as_advanced(QRENCODE_LIBRARY QRENCODE_INCLUDE_DIR)

6
vcpkg-configuration.json Normal file
View File

@ -0,0 +1,6 @@
{
"overlay-ports": [],
"overlay-triplets": [
"vcpkg/triplets"
]
}

81
vcpkg.json Normal file
View File

@ -0,0 +1,81 @@
{
"name": "keepassxc",
"version-string": "2.8.0",
"builtin-baseline": "2a6371b01420d8820d158b4707e79931feba27aa",
"dependencies": [
{
"name": "argon2",
"version>=": "20190702"
},
{
"name": "botan",
"version>=": "3.1.1"
},
{
"name": "minizip",
"version>=": "1.3"
},
{
"name": "libqrencode",
"version>=": "4.1.1"
},
{
"name": "libusb",
"version>=": "1.0.26.11791",
"platform": "linux | freebsd"
},
{
"name": "libxi",
"version>=": "1.8",
"platform": "linux | freebsd"
},
{
"name": "libxtst",
"version>=": "1.2.4",
"platform": "linux | freebsd"
},
{
"name": "qt5",
"version>=": "5.15.11"
},
{
"name": "qt5-imageformats",
"version>=": "5.15.11"
},
{
"name": "qt5-macextras",
"version>=": "5.15.11",
"platform": "osx"
},
{
"name": "qt5-svg",
"version>=": "5.15.11"
},
{
"name": "qt5-tools",
"version>=": "5.15.11"
},
{
"name": "qt5-translations",
"version>=": "5.15.11"
},
{
"name": "qt5-wayland",
"version>=": "5.15.11",
"platform": "linux | freebsd"
},
{
"name": "qt5-x11extras",
"version>=": "5.15.11",
"platform": "linux | freebsd"
},
{
"name": "readline",
"version>=": "0#5"
},
{
"name": "zlib",
"version>=": "1.3"
}
]
}

View File

@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)

View File

@ -0,0 +1,8 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)

View File

@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)

View File

@ -0,0 +1,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)