Skip to content

Commit

Permalink
Add vcpkg manifest with build dependencies
Browse files Browse the repository at this point in the history
Also bump minimum CMake release
  • Loading branch information
phoerious committed Feb 22, 2024
1 parent a472ef8 commit 956e3d0
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ CMakePresets.json
CMakeUserPresets.json
.vs/
out/

# vcpkg
vcpkg_installed*/

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
54 changes: 19 additions & 35 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
==================
Toolchain and Build Dependencies
================================

The following tools must exist within your PATH:
The following build tools must exist within your PATH:

* make
* cmake (>= 3.3.0)
* g++ (>= 4.7) or clang++ (>= 6.0)
* cmake (>= 3.10.0)
* make (>= 4.2) or ninja (>= 1.10)
* g++ (>= 4.9) 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
================================
* 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:

* [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)
* [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
===========
Expand Down Expand Up @@ -63,48 +50,45 @@ 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
cd build
cmake -DWITH_XC_ALL=ON ..
make
```
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.

Note: These steps place the compiled KeePassXC binary inside the `./build/src/` directory.
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:

Expand Down
9 changes: 1 addition & 8 deletions cmake/FindQREncode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@

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})
else()
find_library(QRENCODE_LIBRARY qrencode)
endif()

find_library(QRENCODE_LIBRARY qrencode)
mark_as_advanced(QRENCODE_LIBRARY QRENCODE_INCLUDE_DIR)

include(FindPackageHandleStandardArgs)
Expand Down
6 changes: 6 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"overlay-ports": [],
"overlay-triplets": [
"vcpkg/triplets"
]
}
81 changes: 81 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
9 changes: 9 additions & 0 deletions vcpkg/triplets/arm64-osx-dynamic-release.cmake
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions vcpkg/triplets/x64-osx-dynamic-release.cmake
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 956e3d0

Please sign in to comment.