Make cocos' Android.mk self containing (#18392) #18393
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PROBLEM
cocos makefile is not self-containing.
From the perspective of a developer that link his target with
cocos2dx_static
library, it should specify in hisAndroid.mk
onlya path to a makefile that defines that module, by
a) using
import-add-path
andimport-module
or ...
b) using directly an
include
commandUnfortunately the current configuration of cocos' Android.mk doesn't
specify (using
import-add-path
) locations of modules that it uses.In result, every dev that uses cocos to create Android app has to
populate NDK_MODULE_PATH at his Android.mk files by adding two lines:
Those lines have to be placed at cocos/Android.mk file.
The current configuration of build script breaks a good practice of
hiding internal details from clients of library or component. In fact
the script exposes internal dependencies and require from a dev to make
them out.
SOLUTION
This commit adds corresponding
import-add-path
commands to Android.mkfiles.
HOW TO TEST
Create cocos2d-x app.
Import in your Android.mk file a
cocos
module using one ofaforementioned approaches.
The app should compile without a error message like the one below:
Android NDK: jni/../../cocos2d/cocos/Android.mk: Cannot find module with tag 'freetype2/prebuilt/android' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Issue: #18392