diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a9e8b91..a55e92a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,8 +31,11 @@ jobs: - name: Install Go dependencies run: go mod download - - name: Build nwaku dependencies - run: make -C waku + - name: Build libwaku from submodule + run: make -C waku build-libwaku + + - name: Build waku bindings + run: make -C waku build - name: Increase ulimit run: sudo sh -c "ulimit -n 8192" diff --git a/.github/workflows/CI_endurance.yml b/.github/workflows/CI_endurance.yml index 27b2cf6..4b8e035 100644 --- a/.github/workflows/CI_endurance.yml +++ b/.github/workflows/CI_endurance.yml @@ -29,8 +29,11 @@ jobs: - name: Install Go dependencies run: go mod download - - name: Build nwaku dependencies - run: make -C waku + - name: Build libwaku from submodule + run: make -C waku build-libwaku + + - name: Build waku bindings + run: make -C waku build - name: Increase ulimit run: sudo sh -c "ulimit -n 8192" @@ -79,8 +82,11 @@ jobs: - name: Install Go dependencies run: go mod download - - name: Build nwaku dependencies - run: make -C waku + - name: Build libwaku from submodule + run: make -C waku build-libwaku + + - name: Build waku bindings + run: make -C waku build - name: Increase ulimit run: sudo sh -c "ulimit -n 8192" diff --git a/.github/workflows/Repeated_tests_endurancce.yml b/.github/workflows/Repeated_tests_endurancce.yml index 0632cb0..fc07a17 100644 --- a/.github/workflows/Repeated_tests_endurancce.yml +++ b/.github/workflows/Repeated_tests_endurancce.yml @@ -30,8 +30,11 @@ jobs: - name: Install Go dependencies run: go mod download - - name: Build dependencies - run: make -C waku + - name: Build libwaku from submodule + run: make -C waku build-libwaku + + - name: Build waku bindings + run: make -C waku build - name: Clean environment run: go clean -cache diff --git a/waku/Makefile b/waku/Makefile index 71bcae5..09b1936 100644 --- a/waku/Makefile +++ b/waku/Makefile @@ -1,15 +1,20 @@ # Makefile for Waku Go Bindings -# The LIBWAKU_LIB_PATH and LIBWAKU_HEADER_PATH env vars should be defined beforehand -# Therefore, we assume the libwaku library and headers are located in the specified paths -export CGO_CFLAGS="-I${LIBWAKU_HEADER_PATH}/" -export CGO_LDFLAGS="-L${LIBWAKU_LIB_PATH}/ -lsds -Wl,-rpath,${LIBWAKU_LIB_PATH}/" +# Path to logos-messaging-nim (nwaku) submodule +NWAKU_DIR ?= $(shell pwd)/../third_party/nwaku + +# Default paths for libwaku library and headers (can be overridden) +LIBWAKU_HEADER_PATH ?= $(NWAKU_DIR)/library +LIBWAKU_LIB_PATH ?= $(NWAKU_DIR)/build + +export CGO_CFLAGS := -I$(LIBWAKU_HEADER_PATH)/ +export CGO_LDFLAGS := -L$(LIBWAKU_LIB_PATH)/ -lwaku -Wl,-rpath,$(LIBWAKU_LIB_PATH)/ # Expected files HEADER_FILE := $(LIBWAKU_HEADER_PATH)/libwaku.h LIB_FILES := $(wildcard $(LIBWAKU_LIB_PATH)/libwaku.*) -.PHONY: all clean prepare build +.PHONY: all clean prepare build build-libwaku # Default target all: build @@ -47,6 +52,16 @@ build: check-folders @echo "Building Waku Go Bindings..." go build ./... +# Build libwaku from the nwaku submodule +build-libwaku: + @echo "Building libwaku from nwaku submodule..." + @if [ ! -d "$(NWAKU_DIR)" ]; then \ + echo "ERROR: nwaku submodule not found at $(NWAKU_DIR)"; \ + echo "Run 'git submodule update --init --recursive' first"; \ + exit 1; \ + fi + $(MAKE) -C $(NWAKU_DIR) libwaku + # Clean up generated files clean: @echo "Cleaning up..."