Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android.mk relative or absolute paths?

I'm trying to build a project using the android ndk (on Windows), and I'm having some issues specifically with the source files (LOCAL_SRC_FILES in the Android.mk)

I'm trying to use relative paths to a parent folder such as

LOCAL_SRC_FILES := ../../../src/main.cpp

And when running ndk_build.cmd, it outputs the following error:

Compile++ thumb : GTP <= main.cpp
The system cannot find the file specified.
make: *** [obj/local/armeabi/objs/GTP/__/__/__/src/.o] Error 1

So I tried using absolute paths:

LOCAL_SRC_FILES := D:/Path/To/src/main.cpp

Unfortunately this doesn't work because the : causes issues on windows

Is there any way I can specify source files in a relative directory (or absolute)? The reason I am asking is because I want to avoid making a symbolic link to the src folder if possible.

like image 876
Brad Avatar asked Nov 01 '13 03:11

Brad


1 Answers

According to ndk documentation it is recommended to use relative paths and the following macro (Android.mk uses syntax of make files):

  LOCAL_PATH := $(call my-dir)

An Android.mk file must begin with the definition of the LOCAL_PATH variable.
It is used to locate source files in the development tree. In this example,
the macro function 'my-dir', provided by the build system, is used to return
the path of the current directory (i.e. the directory containing the
Android.mk file itself).

So you can replace your LOCAL_SRC_FILES with something similar to:

LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../src/main.cpp
like image 107
Michael Avatar answered Sep 24 '22 19:09

Michael