docs: Add build instructions
This commit is contained in:
parent
8e16524e1c
commit
bacc971007
@ -47,6 +47,8 @@ The user-facing API (functions defined in `minitar.h` and documented in this REA
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
See the [build instructions](docs/Build.md) to start using minitar.
|
||||||
|
|
||||||
See the [API documentation](docs/API.md) for a full description of all functions and types.
|
See the [API documentation](docs/API.md) for a full description of all functions and types.
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
42
docs/Build.md
Normal file
42
docs/Build.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# minitar build instructions
|
||||||
|
|
||||||
|
minitar uses the cross-platform [CMake](https://cmake.org/) build generator.
|
||||||
|
|
||||||
|
## Configuring
|
||||||
|
|
||||||
|
Standard CMake out-of-source build:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ mkdir -p build
|
||||||
|
$ cmake -S . -B build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Simply run `$ cmake --build build`.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
`# cmake --install build`
|
||||||
|
|
||||||
|
This will (on UNIX-like platforms) install `minitar.h` to /usr/local/include, and `libmtar.a` to /usr/local/lib.
|
||||||
|
|
||||||
|
## Using
|
||||||
|
|
||||||
|
After installation, you can compile regular programs that include `minitar.h` and use the minitar API by adding the `-lmtar` flag to your compiler.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
`cc -o my-own-tar my-own-tar.c -O2 -Wall -lmtar`
|
||||||
|
|
||||||
|
## Using (with CMake)
|
||||||
|
|
||||||
|
Add the `minitar` directory as a subdirectory of your project (perhaps using git submodules?) and add the following lines to your `CMakeLists.txt`:
|
||||||
|
|
||||||
|
```
|
||||||
|
add_subdirectory(minitar)
|
||||||
|
|
||||||
|
target_link_libraries(<YOUR_PROJECT_NAME> PRIVATE minitar)
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're using this method, this is the only step necessary, since minitar will be built and linked along with the rest of your project when you invoke your own build system.
|
Loading…
Reference in New Issue
Block a user