Updated Set up Build Environment on macOS (markdown)

Janek Bevendorff
2024-02-18 23:24:12 +01:00
parent d015df8651
commit ec6871c94a

@@ -44,32 +44,6 @@ brew install pkg-config vcpkg
```
If you installed the vcpkg stub package, set the `VCPKG_ROOT` environment variable to your install location. You can then run the `vcpkg` command from anywhere, given that Homebrew is in your `PATH`. Otherwise, call the `vcpkg` binary with its full path.
Finally, compile and install the actual build dependencies using the `arm64-osx-dynamic` or `x64-osx-dynamic` triplets (depending on your architecture). The default `arm64-osx` or `x64-osx` triplets will compile Qt as a static library, which will give you lots of headaches.
The first time, you compile KeePassXC, vcpkg will download, compile, and install all required dependencies from the vcpkg manifest.
Apple Silicon:
```
vcpkg --triplet=arm64-osx-dynamic install argon2 botan minizip qt5 qt5-svg qt5-tools qt5-imageformats \
qt5-macextras qt5-translations readline zlib libqrencode
```
Intel Mac:
```
vcpkg --triplet=x64-osx-dynamic install argon2 botan minizip qt5 qt5-svg qt5-tools qt5-imageformats \
qt5-macextras qt5-translations readline zlib libqrencode
```
Afterwards, add the `include` and `lib` directories under `$VCPKG_ROOT/installed/<triplet>` to your compiler and linker path or set `-DCMAKE_PREFIX_PATH` when compiling KeePassXC. You also need to set the runtime path (`DYLD_LIBRARY_PATH`) accordingly.
Hint: If you have custom `INCLUDE` or `CPATH` variables set, make sure, `.` is not part of your include path and the path variables contain no empty segmemts (which can happen easily if you construct them like `export INCLUDE="/some/include/path:${INCLUDE}"`) or else you will see strange compilation errors.
### Update your environment regularly
Homebrew:
```
brew update && brew upgrade
```
vcpkg:
```
cd vcpkg && git pull && ./vcpkg update
```
**Important:** If you have custom `INCLUDE` or `CPATH` variables set, make sure, `.` is not part of your include path and the path variables contain no empty segmemts (which can happen easily if you construct them like `export INCLUDE="/some/include/path:${INCLUDE}"`) or else you will see strange compilation errors.