diff options
Diffstat (limited to 'examples/demo/native')
-rw-r--r-- | examples/demo/native/CMakeLists.txt | 45 | ||||
-rw-r--r-- | examples/demo/native/main.c | 16 | ||||
-rw-r--r-- | examples/demo/native/org_example_jni_demo_Library__.h | 21 |
3 files changed, 0 insertions, 82 deletions
diff --git a/examples/demo/native/CMakeLists.txt b/examples/demo/native/CMakeLists.txt deleted file mode 100644 index 059a0dd..0000000 --- a/examples/demo/native/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -# Define project and related variables -# -project (demo) - -# Set versions and library name -# Note: major version will be appended to library name -# -set (VERSION_MAJOR 1) -set (VERSION_MINOR 2) -set (VERSION_PATCH 3) -set (LIB_NAME demo${VERSION_MAJOR}) - -# Command-line options -# -# required by sbt-jni to install binaries to correct places -set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (Autoconf equivalent to --libdir).") -# required by sbt-jni to disable versioned libraries -set (ENABLE_VERSIONED_LIB ON CACHE BOOLEAN "Generate versioned library files and symlinks.") - -# Setup JNI -find_package(JNI REQUIRED) -if (JNI_FOUND) - message (STATUS "JNI include directories: ${JNI_INCLUDE_DIRS}") -endif() - -# Include directories -include_directories(.) -include_directories(${JNI_INCLUDE_DIRS}) - -# Setup main shared library -# Note: major version is appended to library name -add_library(${LIB_NAME} SHARED main.c) -if (ENABLE_VERSIONED_LIB) - set_target_properties( - ${LIB_NAME} - PROPERTIES - VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in name - SOVERSION 0 - ) -endif() - -# Installation targets -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) diff --git a/examples/demo/native/main.c b/examples/demo/native/main.c deleted file mode 100644 index 5916c48..0000000 --- a/examples/demo/native/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdio.h> -#include "org_example_jni_demo_Library__.h" - -/* - * Class: org_example_jni_demo_Library__ - * Method: print - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_org_example_jni_demo_Library_00024_print -(JNIEnv *env, jobject clazz, jstring message) { - const char* msg = (*env)->GetStringUTFChars(env, message, 0); - fprintf(stdout, "Printing from native library: %s", msg); - fflush(stdout); - (*env)->ReleaseStringUTFChars(env, message, msg); - return 0; -} diff --git a/examples/demo/native/org_example_jni_demo_Library__.h b/examples/demo/native/org_example_jni_demo_Library__.h deleted file mode 100644 index 06a7fa4..0000000 --- a/examples/demo/native/org_example_jni_demo_Library__.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class org_example_jni_demo_Library__ */ - -#ifndef _Included_org_example_jni_demo_Library__ -#define _Included_org_example_jni_demo_Library__ -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_example_jni_demo_Library__ - * Method: print - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_org_example_jni_demo_Library_00024_print - (JNIEnv *, jobject, jstring); - -#ifdef __cplusplus -} -#endif -#endif |