Skip to content

Installing ksnip from source

Damir Porobić edited this page Jun 26, 2022 · 10 revisions

Installing ksnip from source

Assuming here you're starting from a clean system and you want to install the projects files in ~/projects. Cloning and build is same for all systems, the only difference is the installation of dependencies.

Linux

Ubuntu

$ sudo apt-get install build-essential git cmake qtbase5-dev libqt5svg5-dev qttools5-dev extra-cmake-modules libqt5x11extras5-dev libxcb-xfixes0-dev

Fedora

$ sudo dnf install gcc gcc-c++ git cmake qt5-qtbase-devel qt5-qtsvg-devel qt5-linguist extra-cmake-modules qt5-qtx11extras-devel

Manjaro

$ sudo pacman -Sy base-devel cmake git extra-cmake-modules libqt5-qtx11extras-devel

OpenSUSE

$ sudo zypper install -t pattern devel_basis
$ sudo zypper install cmake libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-linguist-devel extra-cmake-modules

Following steps are the same for every install

$ cd ~
$ mkdir projects && cd projects
$ git clone https://github.com/ksnip/kColorPicker
$ git clone https://github.com/ksnip/kImageAnnotator
$ git clone https://github.com/ksnip/ksnip
$ cd kColorPicker
$ mkdir build && cd build
$ cmake .. && make && sudo make install
$ cd ../../
$ cd kImageAnnotator
$ mkdir build && cd build
$ cmake .. && make && sudo make install
$ cd ../../
$ cd ksnip
$ mkdir build && cd build
$ cmake .. && make && ./src/ksnip

Windows

I'm using Git Bash to download ksnip and its dependencies:
$ mkdir projects && cd projects
$ git clone https://github.com/ksnip/kColorPicker
$ git clone https://github.com/ksnip/kImageAnnotator
$ git clone https://github.com/ksnip/ksnip

Assuming here you are using CLion as IDE. Qt should be installed and the Qt bin directory should be already added to the PATH Environment variable. Also assuming you have Visual Studio with the C++ package installed. For me Qt was installed here C:\Qt\5.12.5 so following entry -DCMAKE_PREFIX_PATH=C:\Qt\5.12.5\msvc2017\lib\cmake (check path in your case) needs to be added in CLion under Settings > Build, Execution, Deployment > CMake > CMake Options, for all three projects, kColorPicker, kImageAnnotator and ksnip.

Open kColorPicker in CLion as Admin, add the CMAKE_PREFIX_PATH as mentioned earlier. Next install via Build > Install

Open kImageAnnotator in CLion as Admin, add the CMAKE_PREFIX_PATH as mentioned earlier. Next install via Build > Install

Now we need to update or add the LIB and INCLUDE Environment variables, depending on if you have them already or not. For me kImageAnnotator for example was installed here C:\Program Files (x86)\kImageAnnotator and kColorPicker here C:\Program Files (x86)\kColorPicker so I'm adding a new Environment variable LIB with values C:\Program Files (x86)\kImageAnnotator\lib and C:\Program Files (x86)\kColorPicker\lib. And basically the same with the INCLUDE Environment variable with values C:\Program Files (x86)\kImageAnnotator\include and C:\Program Files (x86)\kColorPicker\include. Now you can build ksnip.

Open ksnip in CLion, add the CMAKE_PREFIX_PATH as mentioned earlier and build via Build > Build Project