Documentation for Co[ro]nan
Co[ro]nan is an example C++17 Qt project using conan and CMake. It reads the current data of Corona (Covid-19) cases for a country from the The About Corona Covid-19 API.
The About Corona Covid-19 provides statistics via REST API from The World Health Organization Situation Reports, Johns Hopkins CSSE, The U.S. Department of Health & Human Services, The National Health Commission of the People’s Republic of China, The European Centre for Disease Prevention and Control, and China CDC Weekly.
Development
To build the project you need python and a recent conan version:
#> pip install conan
Further a recent version of CMake (> 3.15), a modern C++ compiler (C++17) and Qt with QtCharts must be installed.
How to build
You have the following options to build the project
Use build script:
In a linux shell you can build the project with the provided build.sh
script. E.g. to build in folder build
execute:
#> ./build.sh build
See ./build.sh -h
for more options
CMake
You can also build it yourself using CMake:
-
cmake < 3.20
#> mkdir build #> (cd build && cmake ..) #> cmake --build build
-
cmake >= 3.20
#> cmake -S . --preset=linux-ninja #> cmake --build -S . --preset=linux-build
or any other CMakePresets.
Source Code formatting
For source code formatting clang-format for C++ files and cmake-format for the CMake files are used. Run format_source_files.sh
to format all C++ and CMake files.
Note: Delete the build directory before formatting, otherwise all CMake files in the build folder will be formatted as well, what may take a while.
CMake options
ENABLE_TESTING
: Build (and run) unittests. Default:ON
ENABLE_BUILD_WITH_TIME_TRACE
: Enable Clang Time Trace Feature. Default:OFF
ENABLE_PCH
: Enable Precompiled Headers. Default:OFF
ENABLE_CACHE
: Enable caching if available, e.g. cchache or sccache. Default:ON
ENABLE_COVERAGE
: Enable coverage reporting for gcc/clang. Default:OFF
ENABLE_DOXYGEN
: Enable doxygen documentation build (doxygen with graphviz dot must be installed). Default:ON
ENABLE_SANITIZER_ADDRESS
: Enable address sanitizer. Default:OFF
ENABLE_SANITIZER_LEAK
: Enable leak sanitizer. Default:OFF
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
: Enable undefined behavior sanitizer. Default:OFF
ENABLE_SANITIZER_THREAD
: Enable thread sanitizer. Default:OFF
ENABLE_SANITIZER_MEMORY
: Enable memory sanitizer. Default:OFF
ENABLE_IPO
: Enable Interprocedural Optimization, aka Link Time Optimization (LTO). Default:OFF
ENABLE_CPPCHECK
: Enable static analysis with cppcheck. Default:ON
if cppcheck is installedOFF
otherwise.ENABLE_CLANG_TIDY
: Enable static analysis with clang-tidy. Default:ON
if clang-tidy is installedOFF
otherwise.ENABLE_INCLUDE_WHAT_YOU_USE
: Enable static analysis with include-what-you-use. Default:ON
if include-what-you-use is installedOFF
otherwise.
direnv & Nix
If you have direnv and nix installed everything should be setup to start upon entering the project folder.
TODO
For the workshop not everything is set-up correctly yet. (See the original project for a more complete version.)
-
Exercise gitpod:
See .gitpod.Dockerfile and .gitpod.yml for TODOs
-
Exercise nix:
See shell.nix for TODOs