Skip to content

Commit 7aa69e4

Browse files
Update build/install instructions for custom install dir translations to work (flameshot-org#3821)
1 parent c35e16a commit 7aa69e4

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

README.md

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Also you can open and build/debug the project in a C++ IDE. For example, in Qt C
401401
- Qt >= 5.9
402402
+ Development tools
403403
- GCC >= 7.4
404-
- CMake >= 3.13
404+
- CMake >= 3.29
405405
406406
#### Run-time
407407
@@ -461,50 +461,64 @@ nix-shell
461461
462462
#### macOS
463463
464-
First of all you need to install [brew](https://brew.sh) and than install the dependencies
464+
First of all you need to install [brew](https://brew.sh) and then install the dependencies
465465
```shell
466466
brew install qt5
467467
brew install cmake
468468
```
469469
470470
### Build
471471
472-
After installing all the dependencies, finally run the following commands in the sources root directory:
472+
After installing all the dependencies, flameshot can be built.
473473
474-
```shell
475-
cmake -S . -B build && cmake --build build
476-
```
477-
478-
NOTE: For macOS you should replace the command
474+
#### Installation/build dir
475+
For the translations to be loaded correctly, the build process needs to be aware of where you want
476+
to install flameshot.
479477
480478
```shell
481-
cmake -S . -B build
479+
# Directory where build files will be placed, may be relative
480+
export BUILD_DIR=build
481+
482+
# Directory prefix where flameshot will be installed. If you are just building and don't want to
483+
# install, comment this environment variable.
484+
# This excludes the bin/flameshot part of the install,
485+
# e.g. in /opt/flameshot/bin/flameshot, the CMAKE_INSTALL_PREFIX is /opt/flameshot
486+
# This must be an absolute path. Requires CMAKE 3.29.
487+
export CMAKE_INSTALL_PREFIX=/opt/flameshot
488+
489+
# Linux
490+
cmake -S . -B "$BUILD_DIR" \
491+
&& cmake --build "$BUILD_DIR"
492+
493+
#MacOS
494+
cmake -S . -B "$BUILD_DIR" \
495+
-DQt5_DIR="$(brew --prefix qt5)/lib/cmake/Qt5" \
496+
&& cmake --build "$BUILD_DIR"
482497
```
483498
484-
with
485-
486-
```shell
487-
cmake -S . -B build -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5
488-
```
489-
490-
When the `cmake --build build` command has completed you can launch flameshot from the `project_folder/build/src` folder.
499+
When the `cmake --build` command has completed you can launch flameshot from the `project_folder/build/src` folder.
491500
492501
### Install
493502
494503
Note that if you install from source, there _is no_ uninstaller, so consider installing to a custom directory.
495504
496505
#### To install into a custom directory
506+
Make sure you are using cmake `>= 3.29` and build flameshot with `$CMAKE_INSTALL_PREFIX` set to the
507+
installation directory. If this is not done, the translations won't be found when using a custom directory.
508+
Then, run the following:
509+
497510
```bash
498-
# Best to use an absolute path here
499-
INST_DIR=/opt/flameshot
511+
# !Build with CMAKE_INSTALL_PREFIX and use cmake >= 3.29! Using an older cmake will cause
512+
# installation into the default /usr/local dir.
513+
500514
# You may need to run this with privileges
501-
cmake --install build --prefix "$INST_DIR"
515+
cmake --install "$BUILD_DIR"
502516
```
503517
504518
#### To install to the default install directory
505519
```bash
506520
# You may need to run this with privileges
507-
cmake --install build
521+
cmake --install "$BUILD_DIR"
508522
```
509523
510524
### FAQ

0 commit comments

Comments
 (0)