| Topic | Status |
|---|---|
Build / test (CI) |
|
Coverity |
|
OpenHub |
View on OpenHub |
Provides some libraries to read and write simple plain text using the boost Spirit library.
The main use case is a CSV parser, that should read files conform to CSV-1203 and RFC 4180
For the available classes, functions, and their usage, see the API documentation
Some tools and libraries are required to use MdtPlainText:
- Git
- CMake
- Conan (optional)
- A compiler (Gcc or Clang or MSVC)
- Make (optional)
- Qt5 (optional: for libraries with Qt support or for the tests)
For a overview how to install them, see https://gitlab.com/scandyna/build-and-install-cpp
Update your CMakeLists.txt to use the required libraries:
cmake_minimum_required(VERSION 3.15)
project(MyApp)
find_package(Mdt0 REQUIRED COMPONENTS PlainText)
add_executable(myApp myApp.cpp)
target_link_libraries(myApp Mdt0::PlainText)If you use Qt, you can use PlainText_QtCore:
cmake_minimum_required(VERSION 3.15)
project(MyApp)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
find_package(Mdt0 REQUIRED COMPONENTS PlainText_QtCore)
add_executable(myApp myApp.cpp)
target_link_libraries(myApp Mdt0::PlainText_QtCore)If you use Conan,
add MdtPlainText as requirement in your conanfile.txt:
[requires]
mdtplaintext/x.y.z@scandyna/testing
[generators]
CMakeDeps
CMakeToolchain
VirtualBuildEnv
If you need better unicode support, you may choose the Qt based one:
[requires]
mdtplaintext_qtcore/x.y.z@scandyna/testing
[generators]
CMakeDeps
CMakeToolchain
VirtualBuildEnv
This chapter covers only the installation of the library. To run the unit tests, see the next chapter.
Get MdtPlainText:
git clone git@gitlab.com:scandyna/mdtplaintext.gitCreate a build directory and cd to it:
mkdir build
cd buildSome note on the CMAKE_INSTALL_PREFIX:
- To target a system wide installation on Linux, set it to
/usr(-DCMAKE_INSTALL_PREFIX=/usr) . - For other locations, spcecify also the
<package-name>, (for example-DCMAKE_INSTALL_PREFIX=~/opt/MdtPlainText).
For details about that, see:
- https://scandyna.gitlab.io/mdt-cmake-modules/Modules/MdtInstallDirs.html
- https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
- https://scandyna.gitlab.io/mdt-cmake-modules/Modules/MdtInstallLibrary.html
This is the recommended way.
MdtPlainText has those dependencies:
- mdt-cmake-modules
- boost
- Qt
Here are the available options:
| Option | Default | Possible Values | Explanations |
|---|---|---|---|
| shared | True | [True, False] | Build as shared library |
When using Conan for dependency management, it is recommended to use Conan profiles. This permits to have personal binary repository, avoiding to recompile everything everytime. This becomes more important if Qt is managed by Conan.
This requires modifications in the settings_user.yml Conan configuration,
and also some profile files.
See my conan-config repository for more informations.
Some following sections will rely on Conan profiles.
Install the dependencies:
conan install -s build_type=Release --build=missing ..Configure MdtPlainText:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/opt/MdtPlainText ..
cmake-gui .To build and install, run:
cmake --build . --target INSTALLOpen a terminal that has gcc and mingw32-make in the PATH.
Create a build directory and go to it:
mkdir build
cd buildInstall the required dependencies:
conan install --profile windows_gcc7_x86_64 -s build_type=Release --build=missing ..Configure the project:
cmake -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\some\path -DCMAKE_BUILD_TYPE=Release ..
cmake-gui .If QT_PREFIX_PATH was not specified, and no Qt5 installation is in the PATH,
a error will probably occur, telling that Qt was not found.
Set the QT_PREFIX_PATH by choosing the path to the Qt5 installation,
then run "Configure".
Also choose different options, like the components to build. Once done, run "Generate", then quit cmake-gui.
To build and install, run:
cmake --build . --target INSTALLSee BUILD.
See README in the conan packaging folder.