How to compile Cmake file with Android.mk?

I need to generate ARMa shared library structure for a sample project CPP.

Examples of projects include:

  • CMakeLists.txt
  • some.cpp (s)
  • Some.h (s)
  • some.tab.cpp.make (S)
  • some.tab.hpp.cmake (s)

Now I want to create a shared library for another Android project. I tried to compile with [Android-Cmake][1], but it generates an X86architecture library, not ARM.

Please let me know if there is another way to do this. Also can I run X86on the Android platform for all versions?

Edit:

Here is my Android.mk:

LOCAL_PATH := $(call my-dir)/../   //Path is according JNI Folder
SRC_TOP_DIR := $(LOCAL_PATH)

include $(CLEAR_VARS)

LOCAL_MODULE := smileParse
LOCAL_CFLAGS := -DANDROID

LOCAL_SRC_FILES := main.cpp test.cpp smamain.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include $(LOCAL_PATH)/
+4
source share
1 answer

JNI:

enter image description here

Android.mk JNI, ,

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := some.cpp
include $(BUILD_SHARED_LIBRARY)

java, :

public class JWrapperSomeClass {
    public native void Demo(int para);
}

javah ++:

javah -jni -classpath bin/classes/ -d jni com.example.Your.Package.Class

++

, :

$ANDROID_NDK/ndk-build

$ANDROID_NDK - , NDK

. NDK JNI.

+2

Source: https://habr.com/ru/post/1546800/


All Articles