| 1 |
== System installation == |
| 2 |
|
| 3 |
This library is header only. So you can either copy `include/cxxopts.hpp` to `/usr/include` or `/usr/local/include`, or add `include` to your search path. |
| 4 |
|
| 5 |
== Building the examples and tests == |
| 6 |
|
| 7 |
It is preferable to build out of source. Make a build directory somewhere, and then |
| 8 |
do the following, where `${CXXOPTS_DIR}` is the path that you checked out `cxxopts` |
| 9 |
to: |
| 10 |
|
| 11 |
cmake ${CXXOPTS_DIR} |
| 12 |
make |
| 13 |
|
| 14 |
You can use another build tool, such as ninja. |
| 15 |
|
| 16 |
cmake -G Ninja ${CXXOPTS_DIR} |
| 17 |
ninja |
| 18 |
|
| 19 |
|
| 20 |
To run the tests, you have to configure `cxxopts` with another flag: |
| 21 |
cmake -D CXXOPTS_BUILD_TESTS=On ${CXXOPTS_DIR} |
| 22 |
make |
| 23 |
make test |
| 24 |
|
| 25 |
== Using cxxopts in tipi.build projects == |
| 26 |
|
| 27 |
`cxxopts` can be easily used in [tipi.build](https://tipi.build) projects simply by adding the following entry to your `.tipi/deps`: |
| 28 |
|
| 29 |
```json |
| 30 |
{ |
| 31 |
"jarro2783/cxxopts": { "@": "v3.0.0" } |
| 32 |
} |
| 33 |
``` |
| 34 |
|
| 35 |
To try this you can run the following command in `/src` (change the target name appropriately to `linux` or `macos` or `windows`): |
| 36 |
|
| 37 |
```bash |
| 38 |
tipi . -t <target> |
| 39 |
./build/linux-cxx17/bin/test_package -v |
| 40 |
``` |
| 41 |
|
| 42 |
To develop `cxxopts` using tipi run the following command at the root of the repository: |
| 43 |
|
| 44 |
```bash |
| 45 |
tipi . -t <target> --test all -v |
| 46 |
``` |