Skip to content
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 vcpkg manifest with build dependencies #10088

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions cmake/FindQREncode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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"
phoerious marked this conversation as resolved.
Show resolved Hide resolved
},
{
"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)
8 changes: 8 additions & 0 deletions vcpkg/triplets/arm64-osx-dynamic.cmake
Original file line number Diff line number Diff line change
@@ -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)
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)
8 changes: 8 additions & 0 deletions vcpkg/triplets/x64-osx-dynamic.cmake
Original file line number Diff line number Diff line change
@@ -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)
Loading