Update library usage documentation
This commit is contained in:
parent
98a802552b
commit
05fe1df8aa
|
@ -88,6 +88,59 @@ Simply include the source files directly in your project:
|
||||||
gcc your_project.c -lnostr_core -lm
|
gcc your_project.c -lnostr_core -lm
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Building the Library
|
||||||
|
|
||||||
|
### Using the Provided Build Script
|
||||||
|
|
||||||
|
The library includes an automated build script that handles all dependencies and creates a self-contained static library.
|
||||||
|
|
||||||
|
**IMPORTANT**: The build script must be run from within the `nostr_core_lib` directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Correct usage:
|
||||||
|
cd nostr_core_lib
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
# If you need to use it from your project directory:
|
||||||
|
cd nostr_core_lib
|
||||||
|
./build.sh
|
||||||
|
cd ..
|
||||||
|
gcc your_app.c nostr_core_lib/libnostr_core_x64.a -lz -ldl -lpthread -lm -o your_app
|
||||||
|
```
|
||||||
|
|
||||||
|
**Common Error**: Running `./nostr_core_lib/build.sh` from outside the library directory will fail with:
|
||||||
|
```
|
||||||
|
[ERROR] Build script must be run from the nostr_core_lib directory
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Script Options
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Auto-detect NIPs from your source code
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
# Force specific NIPs
|
||||||
|
./build.sh --nips=1,6,19
|
||||||
|
|
||||||
|
# Build all available NIPs
|
||||||
|
./build.sh --nips=all
|
||||||
|
|
||||||
|
# Build for specific architecture
|
||||||
|
./build.sh arm64
|
||||||
|
|
||||||
|
# Build with tests
|
||||||
|
./build.sh --tests
|
||||||
|
|
||||||
|
# Get help
|
||||||
|
./build.sh --help
|
||||||
|
```
|
||||||
|
|
||||||
|
The build script automatically:
|
||||||
|
- Scans your `.c` files for `#include "nip*.h"` statements
|
||||||
|
- Compiles only the needed NIPs
|
||||||
|
- Creates a self-contained static library (`libnostr_core_x64.a`)
|
||||||
|
- Includes all dependencies (OpenSSL, curl, secp256k1, cJSON)
|
||||||
|
|
||||||
## Basic Usage Example
|
## Basic Usage Example
|
||||||
|
|
||||||
```c
|
```c
|
||||||
|
|
Loading…
Reference in New Issue