cpp-utilities/README.md

83 lines
3.5 KiB
Markdown
Raw Normal View History

2016-06-11 18:53:26 +02:00
# C++ utilities
2015-04-22 18:24:43 +02:00
Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities.
2015-05-19 22:33:12 +02:00
2016-02-17 20:20:37 +01:00
## Features
The library utilizes:
2016-07-04 23:53:56 +02:00
* parsing command-line arguments and providing Bash completion
2016-06-11 18:53:26 +02:00
* dealing with dates and times
* conversion of primitive data types to byte-buffers and vice versa (litte-endian and big-endian)
2016-02-17 20:20:37 +01:00
* common string conversions/operations, eg.
2016-06-11 18:53:26 +02:00
- split, join, find and replace
- conversion from number to string and vice verca
- encoding/decoding base-64
2016-02-17 20:20:37 +01:00
* IO
- reading/writing primitive data types of various sizes (little-endian and big-endian)
2016-02-17 20:20:37 +01:00
- reading/writing terminated strings and size-prefixed strings
2016-06-11 18:53:26 +02:00
- reading/writing INI files
- reading bitwise
* building with CMake by providing some modules and templates
2016-02-17 20:20:37 +01:00
2015-05-19 22:33:12 +02:00
## Build instructions
2016-01-29 00:47:05 +01:00
### Requirements
#### Build-only dependencies
2016-01-29 00:47:05 +01:00
* C++ compiler supporting C++11 (I've tested GNU g++, Clang and mingw-w64 yet.)
* CMake (I've only tested 3.5.1 so far.)
* cppunit for unit tests (optional)
2016-06-11 18:53:26 +02:00
* Doxygen for API documentation (optional)
2016-07-04 23:53:56 +02:00
* Graphviz for diagrams in the API documentation (optional)
#### Runtime dependencies
* The c++utilities library itself only needs the C/C++ standard library.
* For dependencies of my other projects check the README.md of these projects.
2016-01-29 00:47:05 +01:00
### How to build
Just run:
```
cd "path/to/build/directory"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/final/install/location" "path/to/projectdirectory"
2016-01-29 00:47:05 +01:00
make
make check # build and run unit tests (optional)
2016-06-11 18:53:26 +02:00
make c++utilities_apidoc # build API documentation (optional)
make DESTDIR="/temporary/install/location" install
2015-05-19 22:33:12 +02:00
```
2016-01-29 00:47:05 +01:00
#### General notes
* Building with qmake is not supported anymore.
2016-07-04 23:53:56 +02:00
* The make option ```-j``` can be used for concurrent compilation.
* ```LIB_SUFFIX```, ```LIB_SUFFIX_32``` and ```LIB_SUFFIX_64``` can be set to
specify a suffix for the library directory, eg. lib*64* or lib*32*. The 32/64 variants are only used when building for 32/64-bit architecture.
#### Building for Windows
2016-01-29 00:47:05 +01:00
Building for Windows with Mingw-w64 cross compiler can be utilized using a small
[cmake wrapper from Fedora](https://aur.archlinux.org/cgit/aur.git/tree/mingw-cmake.sh?h=mingw-w64-cmake):
2015-12-05 22:47:49 +01:00
```
2016-06-12 01:56:57 +02:00
${_arch}-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/final/install/location" "path/to/source/directory"
make DESTDIR="/temporary/install/location" install-mingw-w64-strip
2015-12-05 22:47:49 +01:00
```
* To create the \*.ico file for the application icon ffmpeg/avconv is required.
* The target ```install-mingw-w64-strip``` in the example will only install files
suitable for creating a cross-compiler package and additionally strip the binaries.
#### Development builds
During development I find it useful to build all required projects (for instace c++utilities, qtutilities, tagparser and tageditor) as one big project.
2016-07-04 23:53:56 +02:00
This can be easily achieved by using CMake's ```add_subdirectory()``` function. For project files
see the repository [subdirs](https://github.com/Martchus/subdirs).
2016-01-29 00:47:05 +01:00
For a debug build, just use ```-DCMAKE_BUILD_TYPE=Debug```.
2015-12-05 22:47:49 +01:00
2016-07-04 23:53:56 +02:00
#### Arch Linux package
The repository [PKGBUILDs](https://github.com/Martchus/PKGBUILDs) contains files
for building Arch Linux packages.
2016-01-29 00:47:05 +01:00
PKGBUILD files to build for Windows using the Mingw-w64 compiler are also included.
2015-12-05 22:47:49 +01:00
2016-07-04 23:53:56 +02:00
#### RPM package
A \*.spec files can be found at [openSUSE Build Servide](https://build.opensuse.org/project/show/home:mkittler).
### General notes
2016-06-14 22:53:19 +02:00
* There is a workaround for [GCC Bug 66145](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66145) provided
in io/catchiofailure.h.
2016-01-18 23:41:30 +01:00
## TODO
- remove unused features