add more OS handling in the Makefile
This commit is contained in:
parent
3025c882ea
commit
e765142a57
|
@ -2,20 +2,29 @@ INCLUDE_DIRS = ../../src ../../blst/bindings
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
CLANG_EXECUTABLE=gcc
|
CLANG_EXECUTABLE=gcc
|
||||||
CLANG_FLAGS=
|
CLANG_FLAGS=-shared
|
||||||
JNI_INCLUDE_FOLDER=win32
|
JNI_INCLUDE_FOLDER=win32
|
||||||
LIBRARY_RESOURCE=ckzg4844jni.dll
|
LIBRARY_RESOURCE=ckzg4844jni.dll
|
||||||
GRADLE_COMMAND=gradlew
|
GRADLE_COMMAND=gradlew
|
||||||
else
|
else
|
||||||
CLANG_EXECUTABLE=clang
|
CLANG_EXECUTABLE=clang
|
||||||
CLANG_FLAGS=-fPIC
|
GRADLE_COMMAND=./gradlew
|
||||||
JNI_INCLUDE_FOLDER=linux
|
UNAME_S := $(shell uname -s)
|
||||||
LIBRARY_RESOURCE=libckzg4844jni.so
|
ifeq ($(UNAME_S),Linux)
|
||||||
GRADLE_COMMAND=./gradlew
|
CLANG_FLAGS=-fPIC -shared
|
||||||
|
JNI_INCLUDE_FOLDER=linux
|
||||||
|
LIBRARY_RESOURCE=libckzg4844jni.so
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
CLANG_FLAGS=-dynamiclib
|
||||||
|
JNI_INCLUDE_FOLDER=darwin
|
||||||
|
LIBRARY_RESOURCE=libckzg4844jni.dylib
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
c_kzg_4844_jni:
|
c_kzg_4844_jni:
|
||||||
${CLANG_EXECUTABLE} -O -Wall -shared ${CLANG_FLAGS} ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o src/main/resources/lib/${LIBRARY_RESOURCE} c_kzg_4844_jni.c c_kzg_4844.o ../../lib/libblst.a
|
${CLANG_EXECUTABLE} ${CLANG_FLAGS} -O -Wall ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o src/main/resources/lib/${LIBRARY_RESOURCE} c_kzg_4844_jni.c c_kzg_4844.o ../../lib/libblst.a
|
||||||
|
|
||||||
test:
|
test:
|
||||||
${GRADLE_COMMAND} clean test
|
${GRADLE_COMMAND} clean test
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* Follow the instructions in the [README.md](../../README.md) to install blst and build the C-KZG code.
|
* Follow the instructions in the [README.md](../../README.md) to install blst and build the C-KZG code.
|
||||||
* JAVA_HOME environment variable is set to a JDK with an `include` folder containing a jni.h file.
|
* `JAVA_HOME` environment variable is set to a JDK with an `include` folder containing a jni.h file.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
```bash
|
```bash
|
||||||
make c_kzg_4844_jni
|
make c_kzg_4844_jni
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install the library in the `src/main/resources/lib` folder according to your os and arch
|
This will install the library in the `src/main/resources/lib` folder according to your OS
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -63,7 +63,6 @@ public class CKZg4844JNITest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private byte[] createRandomBlob() {
|
private byte[] createRandomBlob() {
|
||||||
final byte[] blob = new byte[CKzg4844JNI.BYTES_PER_BLOB];
|
final byte[] blob = new byte[CKzg4844JNI.BYTES_PER_BLOB];
|
||||||
random.nextBytes(blob);
|
random.nextBytes(blob);
|
||||||
|
|
Loading…
Reference in New Issue