Skip to content
Snippets Groups Projects
user avatar
SCRUM#102 - Fix name function
Lais Frigério authored
9e5d9a17
History

simmc-agent

The agent for the SIMMC - Sistema de Monitoramento do Ministério das Comunicações project.

Requirements

Using Linux as default

  • c++ compiler
  • cmake
  • libudev

Building and compiling

Run the follow steps to compile

$ cd build
$ cmake ..
$ make

cmake .. will generate a Makefile, library objects and misterious CMake files.

To run the resulting executable agent-vx.x go to directory agent/bin. Run it with

$ ./agent-vx.x


Building and compiling (on Windows)

To build and compile on Windows follow these steps:

  • Install .NET Framework 4.6 or higher

  • Install Visual Studio Community 2017 or higher

    • Select: Desktop development with C++
    • Select: Data storage and processing (for latter)
  • Install Cmake

    • Download .msi
    • Select option: Add CMake to the system PATH for all users
  • Install Git for Windows

    • Bash only
    • Default settings
    • Config your user
  • Clone git project repository

    git clone git@gitlab.c3sl.ufpr.br:simmc/agent.git

  • Change to the correct branch

  • Configurate accordly with project README

  • Run Developer Command Prompt for VS 2017

    • Go to project directory

    • Run:

      $ mkdir build
      $ cd build
      $ cmake .. -G "NMake Makefiles"
      $ nmake

Building and compiling (cross compiling Linux Host/ Windows target)

requirements

  • i685-w64-mingw32-gcc compiler for Windows 32-bit target
  • x86_64-w64-mingw32-gcc compiler for Windows 64-bit target

building and compiling

Follow the steps from the regular Building and compiling, changing the command cmake .. by

$ cmake -D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain_32-bit.cmake ..

to generate a Makefile for crosscompiling with a Linux Host/ W32 target

or

$ cmake -D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain_64-bit.cmake ..

to generate a Makefile for crosscompiling with a Linux Host/ W64 target

Generate agent.exe (for Windows) on Linux machine

Creates package similar to the .run created on Linux from the file generate_agent.sh .

  • Install wine
$ dpkg --add-architecture i386 - multiarch
$ apt update
$ apt install wine
  • Install inno setup
$ wget http://www.jrsoftware.org/download.php/is.exe
$ wine ./is.exe
  • Add inno setup compiler at environment variable at wine. Run:
$ wine regedit (this will open a window from wine)
- Go to - HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment and set the following path at PATH environment variable: C:/Program Files\Inno Setup
  • Compile generate_agent.iss
$ wine iscc generate_agent.iss


Development

submodules

Library cpr is a submodule forked from github's repository

https://github.com/whoshuu/cpr

Which contains library curl, forked from github's repository

https://github.com/curl/curl

Also mongoose and googletest.

To get them working, run

$ git submodule init
$ git submodule update --init --recursive

Any editions made to such modules must be commited inside the submodule, to a branch of our own, and further commited in the superior module. Check Git-Tools-Submodules .

TODO: when packing the version for download, make sure these modules are regular directories.

cmake fails

Current CMakeLists.txt is not mature, so if you find that building fails at something that was already corrected, run

$ rm -rf *

inside the build directory and cmake again.

building and compiling

You may also set the Debug flag if using gdb

$ cmake -DCMAKE_BUILD_TYPE=Debug ..

parameters

When compiling and executing the agent locally, in order to see the resulting JSON objects, run the executable with the option --print

$ ./agent-vx.x --print

If you want to run just once, add the option --once

$ ./agent-vx.x --print --once

For all options run with --help.



Documentation

Clone doxygen project from github

$ git clone https://github.com/doxygen/doxygen

requirements - flex lib

$ apt-get install flex

building and compiling

$ cd doxygen
$ mkdir build
$ cmake -G "Unix Makefiles" ..
$ make

testing

Execute doxygen to generate the simmc-agent documentation

$ doxygen Doxyfile

Will be generated a Documentation directory that contains HTML pages for each file from agent