Skip to content

Commit

Permalink
Update the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dr8co committed Apr 30, 2024
1 parent dec0c80 commit 14e378e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ to the Configuration step:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -G Ninja
```

The library will be built in the `build` directory.
The library will be built in the `build` directory
(or `Release` subdirectory of the `build` directory, if using a multi-configuration generator).

### Building Manually

Expand Down Expand Up @@ -180,10 +181,12 @@ The following packages are available:
|:--------------:|:-----------------------:|---------------------------------------|
| win64.exe | Windows 64-bit | Self installing executable |
| win64.zip | Windows 64-bit | Extraction to appropriate directories |
| x86_64.rpm | RPM-based Linux 64-bit | rpm installers, such as apt and dpkg |
| amd64.deb | DEB-based Linux 64-bit | deb installers, such as yum and dnf |
| minGW64.exe | MinGW-w64 Windows | Self installing executable |
| minGW64.zip | MinGW-w64 Windows | Extraction to appropriate directories |
| x86_64.rpm | RPM-based Linux, 64-bit | rpm installers, such as apt and dpkg |
| amd64.deb | DEB-based Linux, 64-bit | deb installers, such as yum and dnf |
| Linux.tar.gz | Linux 64-bit | Extraction to appropriate directories |
| Darwin.dmg | macOS 64-bit | Drag and Drop |
| Darwin.dmg | macOS 64-bit | Drag and Drop to Applications |
| Darwin.tar.gz | macOS 64-bit | Extraction to appropriate directories |

SHA-256 checksums are provided for each package to verify the integrity of the files.
Expand All @@ -192,12 +195,12 @@ Alternatively, you can install the library directly after
[building with CMake](#building-with-cmake-recommended):

```bash
# Install from the build directory.
# Install from the build directory. Run this from the project root directory.
cmake --install build --config Release
```

Escalation of privileges may be required to install the library system-wide.
Use `sudo` on UNIX or run the command prompt (or powershell) as an administrator on Windows.
Use `sudo` on UNIX or run the command prompt/PowerShell/Windows Terminal as an administrator on Windows.

### Uninstallation

Expand All @@ -210,7 +213,7 @@ For UNIX, use the following command:

```bash
# In the build directory, run:
xargs rm -f < install_manifest.txt # May require sudo
xargs rm -f < install_manifest.txt # May require sudo/escalation of privileges
```

For Windows, use the following command in the build directory:
Expand All @@ -235,7 +238,7 @@ To use the library, include the header file in your source code:
#include <lite_string.h>
// or:
#include "lite_string.h"
// Depending on whether the library was installed or not.
// Depending on the location of the header file.
...
```

Expand All @@ -247,6 +250,12 @@ To link the library with a CMake project, include the following lines in the `CM

```cmake
########### If the library was installed: ###########
# For Windows only: Update CMake module path.
list(APPEND CMAKE_MODULE_PATH "C:/path/to/LiteString/cmake")
# The path should point to the directory containing the LiteStringConfig.cmake file, depending on the installation.
# In UNIX, the library installation path is usually scanned automatically.
# Locate the required files.
find_package(LiteString REQUIRED)
Expand All @@ -256,6 +265,7 @@ target_link_libraries(yourTarget LiteString::lite-string)
######## If the library was built manually, or is not installed: ########
# Add the library to the project.
add_library(LiteString STATIC IMPORTED)
# Set the path to the library. For Windows, use the .lib file.
set_target_properties(LiteString PROPERTIES IMPORTED_LOCATION /path/to/libLiteString.a)
# Link the library to the target.
Expand Down
18 changes: 10 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ For building the LiteString library, refer to the

The text file should not be bigger than 1MB.

```bash
```console
# Compile and link the example
gcc -std=c2x -o word_stats word_stats.c -L /path/to/built/lite-string/library -llite-string
ian@github:examples$ gcc -std=c2x -o word_stats word_stats.c -L /path/to/built/lite-string/library -llite-string

# Run the example
./word_stats blindtext.txt
ian@github:examples$ ./word_stats blindtext.txt
# Expected output:
Word count: 5800
Character count: 33355
Expand All @@ -29,15 +29,15 @@ Average word length: 5.75

[grep clone](./cheap_grep.cpp) - A simple clone of the `grep` command.

```bash
```console
# Compile and link the example
g++ -std=c++20 -o cheap_grep cheap_grep.cpp -L /path/to/built/lite-string/library -llite-string
ian@github:examples$ g++ -std=c++20 -o cheap_grep cheap_grep.cpp -L /path/to/built/lite-string/library -llite-string

# Run the example
./cheap_grep -i "ipsum dolor" blindtext.txt
ian@github:examples$ ./cheap_grep -i "ipsum dolor" blindtext.txt

# The program can also read from standard input, when the file name is replaced with a hyphen
cat blindtext.txt | ./cheap_grep -i "ipsum dolor" -
ian@github:examples$ cat blindtext.txt | ./cheap_grep -i "ipsum dolor" -
./cheap_grep -i "lorem ipsum dolor sit amet consectetur adipiscing" - < blindtext.txt
```

Expand All @@ -52,7 +52,9 @@ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja
cmake --build build --config Release -j 4
```

The examples can be found in the `build` directory.
The examples can be run from the `build` directory.
(Or, from the `Release` subdirectory of `build` directory,
if you have built with a multi-configuration generator, like Visual Studio.)

```bash
# From this directory (examples), run:
Expand Down

0 comments on commit 14e378e

Please sign in to comment.