-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Fix find_library when using unified headers." into ndk-r14-rel…
…ease
- Loading branch information
Showing
3 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required(VERSION 3.6.0) | ||
|
||
add_library(native-lib SHARED jni/foo.cpp) | ||
find_library(log-lib log) | ||
target_link_libraries(native-lib ${log-lib}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <jni.h> | ||
#include <string> | ||
|
||
#include <android/log.h> | ||
|
||
extern "C" | ||
JNIEXPORT jstring JNICALL | ||
Java_com_example_myapplication_MainActivity_stringFromJNI( | ||
JNIEnv *env, | ||
jobject /* this */) { | ||
std::string hello = "Hello from C++"; | ||
__android_log_print(ANDROID_LOG_INFO, "tag", "%s", hello.c_str()); | ||
return env->NewStringUTF(hello.c_str()); | ||
} |