Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cocos' Android.mk self containing (#18392) #18393

Merged
merged 1 commit into from Oct 24, 2017

Conversation

rynkowsg
Copy link
Contributor

@rynkowsg rynkowsg commented Oct 21, 2017

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 his Android.mk only
a path to a makefile that defines that module, by

a) using import-add-path and import-module

$(call import-add-path, <path-to-cocos-root>)
$(call import-module, cocos)

or ...

b) using directly an include command

include <path-to-cocos-root>/cocos/Android.mk

Unfortunately 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:

$(call import-add-path, <path-to-cocos-root>/cocos)
$(call import-add-path, <path-to-cocos-root>/external)

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.mk
files.

HOW TO TEST

  1. Create cocos2d-x app.

  2. Import in your Android.mk file a cocos module using one of
    aforementioned approaches.

  3. 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

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 his `Android.mk` only
a path to a makefile that defines that module, by

a) using `import-add-path` and `import-module`

    $(call import-add-path, <path-to-cocos-root>)
    $(call import-module, cocos)

  or ...

b) using directly an `include` command

    include <path-to-cocos-root>/cocos/Android.mk

Unfortunately 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:

    $(call import-add-path, <path-to-cocos-root>/cocos)
    $(call import-add-path, <path-to-cocos-root>/external)

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.mk
files.

---

HOW TO TEST

1. Create cocos2d-x app.

2. Import in your Android.mk file a `cocos` module using one of
aforementioned approaches.

3. 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: cocos2d#18392
@minggo minggo merged commit 76ba85a into cocos2d:v3 Oct 24, 2017
stevetranby added a commit to stevetranby/cocos2d-x that referenced this pull request Oct 24, 2017
* commit '76ba85adfbb1deedf52162386012afa961c9c016':
  Make cocos' Android.mk self containing (cocos2d#18392) (cocos2d#18393)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#18397)
  Fix for Non-TTF Label Shadow, it makes it follow label opacity (cocos2d#18324)
  Remove autorelease mark from UIWebViewWrapper and manage memory manually (cocos2d#18391)
  Corrected bugs with cursor in TextField (cocos2d#18371)
  Fix Windows 10 compilation (cocos2d#18394)

# Conflicts:
#	cocos/base/ccConfig.h
@rynkowsg rynkowsg deleted the make-Android.mk-self-containing branch October 24, 2017 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants