ademar111190
ademar111190

Reputation: 14505

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?

Upvotes: 1

Views: 700

Answers (1)

ademar111190
ademar111190

Reputation: 14505

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!

Upvotes: 2

Related Questions