diff --git a/README.md b/README.md index 27f3c765af..baf450ed47 100644 --- a/README.md +++ b/README.md @@ -401,7 +401,7 @@ Also you can open and build/debug the project in a C++ IDE. For example, in Qt C - Qt >= 5.9 + Development tools - GCC >= 7.4 -- CMake >= 3.13 +- CMake >= 3.29 #### Run-time @@ -461,7 +461,7 @@ nix-shell #### macOS -First of all you need to install [brew](https://brew.sh) and than install the dependencies +First of all you need to install [brew](https://brew.sh) and then install the dependencies ```shell brew install qt5 brew install cmake @@ -469,42 +469,56 @@ brew install cmake ### Build -After installing all the dependencies, finally run the following commands in the sources root directory: +After installing all the dependencies, flameshot can be built. -```shell -cmake -S . -B build && cmake --build build -``` - -NOTE: For macOS you should replace the command +#### Installation/build dir +For the translations to be loaded correctly, the build process needs to be aware of where you want +to install flameshot. ```shell -cmake -S . -B build +# Directory where build files will be placed, may be relative +export BUILD_DIR=build + +# Directory prefix where flameshot will be installed. If you are just building and don't want to +# install, comment this environment variable. +# This excludes the bin/flameshot part of the install, +# e.g. in /opt/flameshot/bin/flameshot, the CMAKE_INSTALL_PREFIX is /opt/flameshot +# This must be an absolute path. Requires CMAKE 3.29. +export CMAKE_INSTALL_PREFIX=/opt/flameshot + +# Linux +cmake -S . -B "$BUILD_DIR" \ + && cmake --build "$BUILD_DIR" + +#MacOS +cmake -S . -B "$BUILD_DIR" \ + -DQt5_DIR="$(brew --prefix qt5)/lib/cmake/Qt5" \ + && cmake --build "$BUILD_DIR" ``` -with - -```shell -cmake -S . -B build -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5 -``` - -When the `cmake --build build` command has completed you can launch flameshot from the `project_folder/build/src` folder. +When the `cmake --build` command has completed you can launch flameshot from the `project_folder/build/src` folder. ### Install Note that if you install from source, there _is no_ uninstaller, so consider installing to a custom directory. #### To install into a custom directory +Make sure you are using cmake `>= 3.29` and build flameshot with `$CMAKE_INSTALL_PREFIX` set to the +installation directory. If this is not done, the translations won't be found when using a custom directory. +Then, run the following: + ```bash -# Best to use an absolute path here -INST_DIR=/opt/flameshot +# !Build with CMAKE_INSTALL_PREFIX and use cmake >= 3.29! Using an older cmake will cause +# installation into the default /usr/local dir. + # You may need to run this with privileges -cmake --install build --prefix "$INST_DIR" +cmake --install "$BUILD_DIR" ``` #### To install to the default install directory ```bash # You may need to run this with privileges -cmake --install build +cmake --install "$BUILD_DIR" ``` ### FAQ