-
Notifications
You must be signed in to change notification settings - Fork 46
Build from source
The compilation requires a compiler g ++ managing C++11, the compilation has been made with gcc version 6.3.0 20170516. This compiler is usually installed with a complete tool chain on Linux systems.
To build from sources you must do the following.
If you are on a Debian (Armbian, Raspbian ...), you can use my repository to install libmodbusepsi (or libmodbus at your convenience) :
wget -O- http://www.piduino.org/piduino-key.asc | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.piduino.org stretch piduino'
sudo apt update
sudo apt install build-essential pkg-config cmake libunittest++-dev libmodbusepsi-dev
otherwise, you will have to compile and install libmodbusepsi (or libmodbus at your convenience) from source.
Then you can clone and compile libmodbuspp :
git clone --recurse-submodules https://github.com/epsilonrt/libmodbuspp.git
cd libmodbuspp
git submodule init
git submodule update
mkdir cmake-build-Release
cd cmake-build-Release
cmake ..
make
sudo make install
sudo ldconfig
To uninstall:
cd cmake-build-Release
sudo make uninstall
You can also generate Debian packages with:
cd cmake-build-Release
rm -fr *
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
sudo apt-get install fakeroot
fakeroot make package
then install them:
sudo apt install ./*.deb
To generate documentation in HTML format and Man pages, you must install the pre-requisites:
sudo apt install doxygen doxygen-latex doxygen-doc doxygen-gui graphviz
To correctly display the C ++ code in the documentation, it is better to install marked which depends on nodejs:
sudo apt install npm
sudo npm install -g marked
If you do not have nodejs 8.x minimum, you will need to add the necessary repository beforehand :
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
then built the doc:
cd cmake-build-Release
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DMODBUSPP_WITH_DOXYGEN_DOC=1 ..
fakeroot make package