change library output folder and make it configurable

This commit is contained in:
Stefan Bratanov 2022-11-25 13:48:27 +00:00
parent ec7eae4815
commit 73bba9ef91
3 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,7 @@
INCLUDE_DIRS = ../../src ../../blst/bindings
LIBRARY_FOLDER=src/main/resources/ethereum/ckzg4844/lib
ifeq ($(OS),Windows_NT)
CLANG_EXECUTABLE=clang
GRADLE_COMMAND=gradlew
@ -32,7 +34,8 @@ endif
all: build test
build:
${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
mkdir -p ${LIBRARY_FOLDER}
${CLANG_EXECUTABLE} ${CLANG_FLAGS} -O -Wall ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o ${LIBRARY_FOLDER}/${LIBRARY_RESOURCE} c_kzg_4844_jni.c c_kzg_4844.o ../../lib/libblst.a
test:
${GRADLE_COMMAND} clean test

View File

@ -12,9 +12,8 @@ public class CKzg4844JNI {
private static final String PLATFORM_NATIVE_LIBRARY_NAME = System.mapLibraryName(LIBRARY_NAME);
static {
InputStream libraryResource = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(
"lib/" + PLATFORM_NATIVE_LIBRARY_NAME);
InputStream libraryResource = CKzg4844JNI.class.getResourceAsStream(
"lib/" + PLATFORM_NATIVE_LIBRARY_NAME);
if (libraryResource == null) {
try {
System.loadLibrary(LIBRARY_NAME);