How to compile a custom folder structure with ndk-build?

2.2k views Asked by At

I have the next folder structure:


On $My_Eclipse_Project

  • jni/Android.mk
  • jni/Application.mk
  • jni/main.cpp
  • lib/

On $My_Library_Project

  • src/
  • include/
  • Android.mk

$My_Eclipse_Project/jni/main.cpp is a basic makefile whom call the source to compile, following the instructions from $My_Library_Project/Android.mk

    # NOTE:
$(warning Compiling Android.mk from sample_cameraview_activity)

# This path
LOCAL_PATH := $(call my-dir)
$(warning Local path: $(LOCAL_PATH))

# GNU var
include $(CLEAR_VARS)

# Include extra library
include $(mylibrary_INCLUDE)/../Android.mk

# Add openCV

# Add in .bashrc enviroment var
include $(OPENCV_SHARE_MK)/OpenCV.mk

LOCAL_ARM_NEON := true

# Local libraries

LOCAL_LDLIBS += -llog -lGLESv1_CM

# Name library

LOCAL_MODULE    := camView

# Local SRC

LOCAL_SRC_FILES := main.cpp

# Shared library

include $(BUILD_SHARED_LIBRARY)

The problem is, $My_Library_Project>Android.mk don't detect the folder structure what is waiting, because my source is on src folder, don't at jni folder. I get:

Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it. 

How could i compile the code at $My_Library_Project from $My_Eclipse_Project, and copy the library generated on $My_Eclipse_Project>lib/armeabi, to be used by main.cpp?

Thanks in advance.

1

There are 1 answers

0
goe On BEST ANSWER

2 Options. You can define $NDK_PROJECT_PATH = /your_ndk_path, Makefile auto detect the path and use it to compile, or add a enviroment var with name $NDK_PROJECT_PATH and value /your_ndk_path.