mirror of
https://github.com/speice-io/polyglot_jni
synced 2024-10-11 01:11:30 -04:00
24 lines
806 B
CMake
24 lines
806 B
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
project(polyglot)
|
|
|
|
find_package(Java)
|
|
find_package(JNI REQUIRED)
|
|
|
|
include(UseJava)
|
|
|
|
set(POLYGLOT_CPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main/c)
|
|
set(POLYGLOT_JAVA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main/java)
|
|
|
|
add_jar(polyglot_jar
|
|
SOURCES
|
|
${POLYGLOT_JAVA_SOURCES}/io/speice/Polyglot.java
|
|
# NOTE: To view the generated headers, add a DESTINATION
|
|
GENERATE_NATIVE_HEADERS polyglot_jni)
|
|
|
|
add_library(polyglot SHARED ${POLYGLOT_CPP_SOURCES}/io/speice/Polyglot.c)
|
|
target_link_libraries(polyglot PRIVATE polyglot_jni)
|
|
|
|
# Install the JNI library into the Gradle resources directory so that it's picked up during testing and JAR building
|
|
install(TARGETS polyglot DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/build/resources/main/META-INF/lib/linux_64/)
|