feat: env vars configuration

This commit is contained in:
Igor Sirotin 2025-10-20 12:39:50 +01:00
parent 089aa33a19
commit b206129b71
No known key found for this signature in database
GPG Key ID: 0EABBCB40CB9AD4A
2 changed files with 7 additions and 5 deletions

View File

@ -19,21 +19,21 @@ To do so, you can:
Example environment setup (adjust paths to your nwaku checkout): Example environment setup (adjust paths to your nwaku checkout):
``` ```
export NWAKU_DIR=/path/to/nwaku export NWAKU_DIR=/path/to/nwaku
export CGO_CFLAGS="-I${NWAKU_DIR}/library" export NWAKU_INCLUDE_DIR="{NWAKU_DIR}/library"
export CGO_LDFLAGS="-L${NWAKU_DIR}/build -lwaku -Wl,-rpath,${NWAKU_DIR}/build" export NWAKU_LIB_DIR="${NWAKU_DIR}/build"
``` ```
Such setup would look like this in a `Makefile`: Such setup would look like this in a `Makefile`:
```Makefile ```Makefile
NWAKU_DIR ?= /path/to/nwaku NWAKU_DIR ?= /path/to/nwaku
CGO_CFLAGS = -I$(NWAKU_DIR)/library
CGO_LDFLAGS = -L$(NWAKU_DIR)/build -lwaku -Wl,-rpath,$(NWAKU_DIR)/build
build: NWAKU_INCLUDE_DIR ?= $(NWAKU_DIR)/library
build: NWAKU_LIB_DIR ?= $(NWAKU_DIR)/build
build: ## Your project build command build: ## Your project build command
go build ./... go build ./...
``` ```
For a reference integration, see how `status-go` wires `CGO_CFLAGS` and `CGO_LDFLAGS` in its build setup. For a reference integration, see how `status-go` wires `NWAKU_INCLUDE_DIR` and `NWAKU_LIB_DIR` in its build setup.
NOTE: If your project is itself used as a Go dependency, all its clients will have to follow the same nwaku setup. NOTE: If your project is itself used as a Go dependency, all its clients will have to follow the same nwaku setup.

View File

@ -1,6 +1,8 @@
package waku package waku
/* /*
#cgo CFLAGS: -I${NWAKU_INCLUDE_DIR}
#cgo LDFLAGS: -L${NWAKU_LIB_DIR} -lnwaku -Wl,-rpath,${NWAKU_LIB_DIR}
#include "libwaku.h" #include "libwaku.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>