2018-08-10 02:22:06 +02:00
|
|
|
**xdgcfg** is a very simple wrapper around libconfig written in C++. It reads
|
2018-08-10 03:02:57 +02:00
|
|
|
and writes files in `${XDG_CONFIG_HOME}`. It creates subdirectories if
|
2018-08-10 02:22:06 +02:00
|
|
|
necessary.
|
|
|
|
|
2019-08-02 08:40:04 +02:00
|
|
|
## Usage
|
2018-08-10 02:22:06 +02:00
|
|
|
|
2019-08-02 08:40:04 +02:00
|
|
|
`xdgcfg.hpp` has explanatory comments in it and there is an
|
2019-08-02 10:12:56 +02:00
|
|
|
[example](examples/example.cpp). The reference is also available at
|
2019-08-02 08:40:04 +02:00
|
|
|
[doc.schlomp.space/xdgcfg/](https://doc.schlomp.space/xdgcfg/classxdgcfg.html).
|
|
|
|
|
|
|
|
Use it in your CMake project like this:
|
|
|
|
|
|
|
|
``` cmake
|
|
|
|
find_package(xdgcfg CONFIG REQUIRED)
|
|
|
|
target_link_libraries(MyProject xdgcfg::xdgcfg)
|
|
|
|
```
|
|
|
|
|
|
|
|
If you don't use CMake, you can get the compile-flags with pkg-config:
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
pkg-config --libs --cflags xdgcfg
|
|
|
|
```
|
2018-08-10 02:22:06 +02:00
|
|
|
|
2019-07-22 02:43:19 +02:00
|
|
|
## Install
|
2018-08-10 02:22:06 +02:00
|
|
|
|
2019-07-22 03:10:29 +02:00
|
|
|
### Gentoo
|
|
|
|
|
|
|
|
Add my [repository](https://schlomp.space/tastytea/overlay) and install it from
|
|
|
|
there.
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
eselect repository enable tastytea
|
|
|
|
echo "dev-cpp/xdgcfg" >> /etc/portage/package.accept_keywords/xdgcfg
|
|
|
|
emaint sync -r tastytea
|
|
|
|
emerge -a dev-cpp/xdgcfg
|
|
|
|
```
|
|
|
|
|
|
|
|
### From source
|
|
|
|
|
2019-08-02 08:40:04 +02:00
|
|
|
### Dependencies
|
|
|
|
|
|
|
|
* C++ compiler (Tested: g++ 5/8/9)
|
|
|
|
* [cmake](https://cmake.org/) (at least: 3.1)
|
|
|
|
* [pkgconfig](https://pkgconfig.freedesktop.org/wiki/) (tested: 0.29)
|
|
|
|
* [libconfig++](https://github.com/hyperrealm/libconfig) (tested: 1.5)
|
|
|
|
* [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
|
|
|
|
|
|
|
|
### Compile
|
2018-08-10 02:22:06 +02:00
|
|
|
|
2019-07-21 22:37:02 +02:00
|
|
|
``` shell
|
2018-08-10 02:22:06 +02:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake ..
|
2019-08-02 08:40:04 +02:00
|
|
|
cmake --build .
|
2018-08-10 02:22:06 +02:00
|
|
|
make install
|
|
|
|
```
|
|
|
|
|
2019-07-22 02:43:19 +02:00
|
|
|
### CMake options
|
2018-08-10 02:22:06 +02:00
|
|
|
|
2019-07-22 02:43:19 +02:00
|
|
|
* `-DWITH_TESTS=YES` to compile the tests.
|
|
|
|
* `-DWITH_EXAMPLES=YES` to compile the example.
|
2019-08-02 08:40:04 +02:00
|
|
|
* `-DBUILD_SHARED_LIBS=NO` to build a static library.
|