Update bindings Makefiles with configurable blob size

This commit is contained in:
Ramana Kumar 2022-11-29 20:47:44 +00:00
parent c9274d8f43
commit 070948d68f
No known key found for this signature in database
GPG Key ID: ED471C788B900433
4 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,7 @@
INCLUDE_DIRS = ../../src ../../blst/bindings
FIELD_ELEMENTS_PER_BLOB ?= 4096
ifeq ($(OS),Windows_NT)
BLST_BUILDSCRIPT=./build.bat
BLST_OBJ=blst.lib
@ -20,6 +22,8 @@ else
CKZG_LIBRARY_PATH=Ckzg.Bindings/runtimes/$(CSHARP_PLATFORM)/native/ckzg.so
endif
CLANG_FLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
TARGETS=ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
.blst:
@ -29,7 +33,7 @@ TARGETS=ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
git apply -R ../blst_sha.patch &&\
cd ../bindings/csharp
.ckzg:
.ckzg:
$(CLANG_EXECUTABLE) -O -Wall -shared $(CLANG_FLAGS) ${addprefix -I,${INCLUDE_DIRS}} -o $(CKZG_LIBRARY_PATH) $(TARGETS)
# Ckzg library
@ -51,4 +55,4 @@ run-test:
# To build full package - use ckzg command on every plaform and dotnet build
ckzg-dotnet:
@make ckzg
dotnet build
dotnet build

View File

@ -2,7 +2,9 @@ INCLUDE_DIRS = ../../src ../../blst/bindings
LIBRARY_FOLDER=src/main/resources/ethereum/ckzg4844/lib
CC_FLAGS=
FIELD_ELEMENTS_PER_BLOB ?= 4096
CC_FLAGS = -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
ifeq ($(OS),Windows_NT)
CLANG_EXECUTABLE=clang

View File

@ -8,7 +8,8 @@
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "13.0"
},
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS"],
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS",
"FIELD_ELEMENTS_PER_BLOB=<!(echo ${FIELD_ELEMENTS_PER_BLOB:-4096})"],
"sources": ["kzg.cxx"],
"include_dirs": [
"../../inc",

View File

@ -1,6 +1,8 @@
INCLUDE_DIRS = .. ../../src ../../inc
INCLUDE_PY = $(shell python -c 'import sysconfig; print(sysconfig.get_config_var("INCLUDEPY"))')
FIELD_ELEMENTS_PER_BLOB?=4096
.PHONY: all
all: test ecc_test
@ -12,4 +14,4 @@ ecc_test: py_ecc_tests.py ckzg.so
python $<
ckzg.so: ckzg.c ../../src/c_kzg_4844.o ../../lib/libblst.a
clang -O -Wall -shared -fPIC -Wl,-Bsymbolic -I${INCLUDE_PY} ${addprefix -I,${INCLUDE_DIRS}} -o $@ $^
clang -O -Wall -shared -fPIC -Wl,-Bsymbolic -I${INCLUDE_PY} ${addprefix -I,${INCLUDE_DIRS}} -DFIELD_ELEMENTS_PER_BLOB=${FIELD_ELEMENTS_PER_BLOB} -o $@ $^