diff --git a/README.md b/README.md index 148696a..862b461 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ The user-facing API (functions defined in `minitar.h` and documented in this REA ## 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. ## Error handling diff --git a/docs/Build.md b/docs/Build.md new file mode 100644 index 0000000..ff1edbe --- /dev/null +++ b/docs/Build.md @@ -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( 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. \ No newline at end of file