简体   繁体   中英

Eclipse and Android NDK compile C++ Code in another folder than JNI

I Have a folder with follow struct:

/-
 |-CPPCore-
          |-C++ Code
 |-Android-
          |-Eclipse Root Project and standarts folders, "src", "lib", "res"..
          |-jni folder << here the c code to android use
 |-Iphone--
          |-IOS code using CPPCore too managed by xcode

in cpp core folder, i have the shared code to android and ios, in ios the xcode import the cppcore folder easy. now in eclipse i do not know how use the same code in the same folder, how i can do it?

I solve my problem doing like as follow:

First on eclipse I clicked with right button on jni folder >> new folder >> advanced >> Link with alternative location (Linked Folder) >> Browser >> select >> OK

Second I edited my Android.mk file like as follow:

LOCAL_PATH := $(call my-dir)
CPP_CORE := $(abspath $(call my-dir)/../../CPPCore)
include $(CLEAR_VARS)
LOCAL_MODULE := mymodule
LOCAL_SRC_FILES := codeOnJniFolder.cpp
LOCAL_SRC_FILES += ../../CPPCore/codeOnCppCoreFolder.cpp
LOCAL_C_INCLUDES := codeOnJniFolder.h
LOCAL_C_INCLUDES += $(CPP_CORE) 
include $(BUILD_SHARED_LIBRARY)

it's all, works fine for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM