Documentation can be found in the doc directory.
A description of the logic behind some of the original LabView VI's
can be found in doc/viDocs.
Much thanks to Patricio Cortes for putting those together.
- boost library available from mutilple sources
- www.boost.com
- centos
yum install boost-devel - Ubuntu
apt-get install libboost-all-dev
- nlohmann json for CPP
- centos
yum install json-devel - Ubuntu
apt install nlohmann-json3-dev
- centos
- yaml-cpp
- centos
yum install yaml-cpp - Ubuntu
apt install libyaml-cpp-dev
- centos
- Catch2
- gcovr
- clang-format (optional)
- glib-devel
The C++ code is automatically formatted by clang-format see the .clang-format file.
To enable this with a git pre-commit hook:
- Install the
clang-formatC++ package. - Run
git config core.hooksPath .githooksonce in this repository.
The absolute path to configuration files can set by exporting
the M2CELL_CFG_PATH environemnt variable. This is optional
as the executable and unit tests should build normally without
this being set.
export M2CELL_CFG_PATH="/home/<usrname>/ts_m2cellcpp/configs"The executable is bin/m2cell.
makeThe software compiles significantly faster with the following line, but this prevents code coverage from working.
NOGCOVR=1 makeTo remove all files from previous builds
make cleanmake run_testsLogging now uses spdlog. There is an in depth explanation in src/LSST/util/Log.h
The environment variable LOGLVL sets the minimum level of
log message to log.
1 - trace, 2 - debug, 3 - info, 4 - warn, 5 - error, 6 - critical
The amount of output of most unit tests can be reduced by setting the
environment variable LOGLVL to 6, for minimal output.
export LOGLVL=6For verbose output either of the following
export LOGLVL=1Default behavior is verbose if the LOGLVL variable is undefined.
unset LOGLVLmake clean
unset NOGCOVR
make run_tests
gcovr -r src/ .The unset NOGOVR and make clean can be skipped if NOGCOVR was never set.
If the Cobertura xml report is needed, change the gcovr command to
gcovr -r src/ . --xml-pretty > coverageReport.xmlTo produce Jenkins results, make junit needs to be called. For details, please see the Jenkinsfile Unit Test section.
make docUML documents are available in the /doc subdirectory The text of these can be cut
and pasted into http://www.plantuml.com/plantuml/uml/.
Current UML files are
/doc/comClassUML.txtFor each of the following, setting or unsetting the environment
variable will probably require a make clean to have its effects
apply to all files.
-
DEBUGsetting this will have the code compile with the-goption so the code will include debugging information for gdb. -
SIMULATORsetting this cause make to build for the simulator. -
NOGCOVRsetting this removes compiler options that thegcovrcoverage tool requires to generate reports. It does reduce compile time. -
VERBOSEsetting this should result in verbose output from the compiler.
- On the build computer, download the Linux version for x68 from https://www.ni.com/en-us/support/downloads/software-products/download/unpackaged-linux.gnu-c---c---compile-tools-x64.338443.html
- run the downloaded file to install - oecore-x86_64-core2-64-toolchain-6.0.sh
-
When a new shell is started:
source /usr/local/oecore-x86_64/environment-setup-core2-64-nilrt-linux export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu/pkgconfig/
-
build with
make tests
cRIO:
mkdir <reasonable_directory>/ts_m2cellcppBuild machine: (scp -r ts_m2cellcpp copies a large set of .git files, so avoid that.)
source statement is only needed for a new shell
source /usr/local/oecore-x86_64/environment-setup-core2-64-nilrt-linux
cd ts_m2cellcpp
make clean
NOGOVR=1 make -j8 run_tests
scp -r * admin@<crIO>:<reasonable_directory>/ts_m2cellcpp/.cRIO: (note: make crio_x_test will not build anything, it just runs what it finds in the tests directory.)
bash``` cd <reasonable_directory>/ts_m2cellcpp/tests make crio_x_test
### Building on the cRIO
This is not recommended as the cRIO has limited resources.
Installing required packages
- On cRIO
-- opkg update
-- opkg install packagegroup-core-buildessential
-- opkg install boost-dev (opkg list | grep boost)
- On local machine, install nlohmann, and clone Catch2
-- copied nlohmann header files to <cRIO>:/usr/include/nlohmann/.
-- Catch2 will likely need to be cloned from github, copied to the cRIO and built with
--- cmake -Bbuild -H. -DBUILD_TESTING=OFF
--- cmake --build build/ --target install
-- cd Catch2 (check that the branch is v2.x)
-- scp -r single_include/catch2/ <crIO>:/usr/include/.
- Clone yaml-cpp to the local machine and copy it to an appropriate directory on the cRIO.
-- Build yaml-cpp library on the cRIO
--- ssh to the cRIO
--- cd yaml-cpp (Top level of copy of yaml-cpp clone.)
--- mkdir build && cd build
--- cmake .. && make -j
--- make install
- On cRIO build m2cell
-- cd ts_m2cellcpp
-- make clean
-- edit Makefile.inc and add "-lboost_system" (no quotes) to the "CPP :=" lines
-- make (this will take several minutes)