## Cellframe Node build from source guide using cmake
### For Linux users
Install the following packages using following commands:
```bash
sudo apt-get update
```
```bash
sudo apt-get install build-essential cmake dpkg-dev libz-dev libmagic-dev libsqlite3-dev traceroute debconf-utils libexpat1-dev
```
Clone the source files of the Cellframe Node from gitlab with all submodules.
```bash
git clone https://gitlab.demlabs.net/cellframe/cellframe-node.git --recursive
```
Create a build directory and run cmake:
```bash
cd cellframe-node
mkdir ./build & cd ./build && cmake .. && make
```
> [!ATTENTION] Warning
>
>In case you don't have a C compiler, you will need to install it.
>```bash
>sudo apt-get install gcc
>```
>Specify the path to the compiler for Cmake
>
>>
>```bash
>export CXX=/path
>```
>***The default path is /usr/bin/g++***
>
Сreate cellframe-node installation package from the build directory using this command:
```bash
cpack
```
> [!Hint] Note
>
>At the moment, only deb package (debian-based distribs) can be created using cmake
Install package:
```bash
sudo dpkg -i ./<name-of-package.deb>
```
> [!ATTENTION] Warning
>
>In the case when you have previous version of CellFrameNode installed, it is required to apply the changes associated with the service file by following:
>```bash
>systemctl daemon-reload
>```
### For Windows users
Use [MSYS2](https://www.msys2.org/) teminal for the following commands:
Update information about available packages
```bash
pacman -Syy
```
Install the necessary packages sequentially
```bash
pacman -S --noconfirm msys2-runtime ncurses pacman pacman-mirrors pactoys-git pax pkgconf pkgfile rebase sed tftp-hpa time ttyrec tzcode util-linux which base base-devel bsdcpio
```
```bash
pacman -S --noconfirm bash bash-completion bsdcpio bsdtar bzip2 coreutils curl dash dtc file filesystem findutils flex gawk gcc-libs getent git grep gzip inetutils info less
```
```bash
pacman -S --noconfirm libargp lndir mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-cmake mingw-w64-x86_64-dlfcn mingw-w64-x86_64-file mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb
```
```bash
pacman -S --noconfirm mingw-w64-x86_64-json-c mingw-w64-x86_64-libzip mingw-w64-x86_64-python mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-static mintty msys2-keyring msys2-launcher
```
```bash
pacman -S --noconfirm clang cmake dtc filesystem lndir mc mingw-w64-clang-x86_64-json-c mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-cmake mingw-w64-x86_64-dlfcn mingw-w64-x86_64-file
```
```bash
pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-ada mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-gcc-libgfortran mingw-w64-x86_64-gcc-objc mingw-w64-x86_64-gdb
```
```bash
pacman -S --noconfirm mingw-w64-x86_64-gdb-multiarch mingw-w64-x86_64-geany mingw-w64-x86_64-gstreamer mingw-w64-x86_64-json-c mingw-w64-x86_64-libc++ mingw-w64-x86_64-libgccjit
```
```bash
pacman -S --noconfirm mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-libzip mingw-w64-x86_64-mesa
```
```bash
pacman -S --noconfirm mingw-w64-x86_64-tools-git mingw-w64-x86_64-winstorecompat-git msys2-runtime pkgfile tree
```
Using the [Git Bash](https://gitforwindows.org/) terminal, clone the project to a folder whose path does not contain Cyrillic.
```bash
git clone https://gitlab.demlabs.net/cellframe/cellframe-node.git
```
Go to the project folder. Initialize and update the submodules
```bash
git submodule update --init --recursive
```
Open the MSYS2 MINGW64 terminal and enter the command:
```bash
cmake.exe -S . -B <path to build> -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/cc.exe -G Ninja -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build <path to build> -j$(nproc)
```
Where `<path to build>` - the path to build the project that will be created automatically.
> [!ATTENTION] Warning
>
>The path to the C complier may be different on your device. Check where it is installed, and if it necessary, change it in the command above.
>```bash
>DCMAKE_C_COMPILER=<Your path to the C complier>