94 lines
2.6 KiB
Markdown
94 lines
2.6 KiB
Markdown
# Helper libraries
|
|
|
|
## Information for students
|
|
|
|
- you do **not** need to copy any files from this repository "by-hand"
|
|
- you do **not** need to clone this repo explicitly
|
|
- you will make use of functions provided by these libraries in the exercises
|
|
- these libraries will be configured as a *git submodule* in the respective exercises, this is why you need to clone with `git clone --recursive ...`
|
|
- tentative: we will use these libraries to showcase differences when implementing the same functionality in C and C++
|
|
|
|
## Overview
|
|
|
|
```
|
|
├── iue-io # reading and writing csv-files of numeric data, header-only
|
|
│ ├── ccsv.h
|
|
│ ├── ccsv.test.c
|
|
│ ├── csv.hpp
|
|
│ └── csv.test.cpp
|
|
├── iue-po # minimalistic support for parsing command line options, header-only
|
|
│ ├── cpo.h
|
|
│ ├── cpo.test.c
|
|
│ ├── po.hpp
|
|
│ └── po.test.cpp
|
|
├── iue-num # helper functions for numeric calculations with floating point values, header-only
|
|
│ ├── numerics.hpp
|
|
│ └── numerics.test.cpp
|
|
├── iue-rnd # helper functions for generating random instances of values and generic objects, header-only
|
|
│ ├── random.hpp
|
|
│ └── random.test.cpp
|
|
├── iue-svg # minimal svg-generator from geometric primitives (e.g. box/circle/triangle), header-only
|
|
│ ├── tags.hpp
|
|
│ ├── tags.test.cpp
|
|
│ ├── render.hpp
|
|
│ ├── render.test.cpp
|
|
│ ├── tree.hpp
|
|
│ └── tree.test.cpp
|
|
└── README.md
|
|
```
|
|
|
|
|
|
## config/build/test/install
|
|
|
|
```shell
|
|
# cmake -S . -B build
|
|
cmake --preset gcc-debug
|
|
cmake --build build
|
|
ctest --test-dir build --verbose
|
|
cmake --install build --prefix ./install
|
|
rm -rf build/ install/ # cleanup
|
|
```
|
|
|
|
## fresh integration into an exercise
|
|
|
|
```shell
|
|
git submodule add -b main https://sgit.iue.tuwien.ac.at/360050/modules ./modules
|
|
git add modules
|
|
git commit -m "added modules as git-submodule"
|
|
```
|
|
|
|
## pull for a submodule enabled exercise
|
|
|
|
```shell
|
|
cd exerciseX
|
|
git pull --recurse-submodules
|
|
```
|
|
|
|
## bump to latest modules commit for an exercise
|
|
|
|
```shell
|
|
cd exerciseX
|
|
git submodule update --remote --merge modules
|
|
git add modules
|
|
git commit -m "bump modules to latest commit"
|
|
```
|
|
|
|
## intended incorporation/usecase in an exercise
|
|
|
|
```cpp
|
|
// task1.main.cpp
|
|
#include "iue-io/csv.hpp"
|
|
//...
|
|
```
|
|
|
|
```cpp
|
|
// task1.main.c
|
|
#include "iue-io/ccsv.h"
|
|
//...
|
|
```
|
|
|
|
```
|
|
mkdir build
|
|
g++ -Imodules -std=c++20 task1.main.cpp -o build/task1_cpp && ./build/task1_cpp
|
|
gcc -Imodules -std=c11 task1.main.c -o build/task1_c && ./build/task1_c
|
|
``` |