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

V3 android cmake support #18154

Closed
wants to merge 27 commits into
base: v3
from

Conversation

Projects
None yet
4 participants
@newnon
Contributor

newnon commented Aug 11, 2017

CMake build improvements & android CMake support
add to graddle.properties
PROP_NDK_MODE=cmake
replace files in folder external/android-specific
android-specific.zip

last PR #17100

pull request for external
cocos2d/cocos2d-x-3rd-party-libs-bin#300

@minggo

This comment has been minimized.

Show comment
Hide comment
@minggo

minggo Aug 22, 2017

Contributor

Looks good, so i have to merge cocos2d/cocos2d-x-3rd-party-libs-bin#300 to test it right? Could you please show me the steps to use cmake in gradle, thanks?

Contributor

minggo commented Aug 22, 2017

Looks good, so i have to merge cocos2d/cocos2d-x-3rd-party-libs-bin#300 to test it right? Could you please show me the steps to use cmake in gradle, thanks?

@newnon

This comment has been minimized.

Show comment
Hide comment
@newnon

newnon Aug 22, 2017

Contributor
  1. ensure that you have installed NDK & CMake from android studio package manager
  2. update externals(just few changes in android_specific folder)
  3. add to graddle.properties PROP_NDK_MODE=cmake(without it it will use ndkbuild)
  4. make clean build
Contributor

newnon commented Aug 22, 2017

  1. ensure that you have installed NDK & CMake from android studio package manager
  2. update externals(just few changes in android_specific folder)
  3. add to graddle.properties PROP_NDK_MODE=cmake(without it it will use ndkbuild)
  4. make clean build
@minggo

This comment has been minimized.

Show comment
Hide comment
@minggo

minggo Aug 23, 2017

Contributor

thanks, i have CMake installed in system(Mac OS), should the CMake be installed from android studio package manger again?

And in which path should i run make clean build?

Contributor

minggo commented Aug 23, 2017

thanks, i have CMake installed in system(Mac OS), should the CMake be installed from android studio package manger again?

And in which path should i run make clean build?

@newnon

This comment has been minimized.

Show comment
Hide comment
@newnon

newnon Aug 23, 2017

Contributor

Yes you shod install it from package manager(it will be installed inside SDK folder) if google does not change this, android studio does not use system CMake.

Contributor

newnon commented Aug 23, 2017

Yes you shod install it from package manager(it will be installed inside SDK folder) if google does not change this, android studio does not use system CMake.

@crazyhappygame

This comment has been minimized.

Show comment
Hide comment
@crazyhappygame

crazyhappygame Oct 19, 2017

Contributor

Guys,
When we may expect cmake to see in v3 branch?

Contributor

crazyhappygame commented Oct 19, 2017

Guys,
When we may expect cmake to see in v3 branch?

@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 3, 2018

Collaborator

Sorry for a long response, I really appreciate this patch. @newnon

Following your steps, I have tested it using latest code, it occurred a path error ,and then I fixed it in this commit. finally cpp-tests and cpp-empty-test build works well both cmake build and ndkBuild.

Suggestion:

  1. to merge the latest code into your branch to solve conflicts
  2. fix path error, from proj.android/jni/main.cpp to proj.android/app/jni/main.cpp
  3. add PROP_NDK_MODE=cmake to gradle.properties for all proj.android, and do some comments in detail.
    comments like:
# android cmake support
# uncomment it, native code will build by cmake
# keep comment, native code will build by ndkBuild
#PROP_NDK_MODE=cmake
  1. do further test, and tell what done and what undone, we should test in detail as possible as we can before merge. I will do it with you.
Collaborator

drelaptop commented Jan 3, 2018

Sorry for a long response, I really appreciate this patch. @newnon

Following your steps, I have tested it using latest code, it occurred a path error ,and then I fixed it in this commit. finally cpp-tests and cpp-empty-test build works well both cmake build and ndkBuild.

Suggestion:

  1. to merge the latest code into your branch to solve conflicts
  2. fix path error, from proj.android/jni/main.cpp to proj.android/app/jni/main.cpp
  3. add PROP_NDK_MODE=cmake to gradle.properties for all proj.android, and do some comments in detail.
    comments like:
# android cmake support
# uncomment it, native code will build by cmake
# keep comment, native code will build by ndkBuild
#PROP_NDK_MODE=cmake
  1. do further test, and tell what done and what undone, we should test in detail as possible as we can before merge. I will do it with you.
@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 3, 2018

Collaborator

@crazyhappygame cmake support android will be done in 3.17, this is I wish.

support other platforms is on schedule, but I couldn't give you the deadline, we can do it together to make it done earlier.

Collaborator

drelaptop commented Jan 3, 2018

@crazyhappygame cmake support android will be done in 3.17, this is I wish.

support other platforms is on schedule, but I couldn't give you the deadline, we can do it together to make it done earlier.

@newnon

This comment has been minimized.

Show comment
Hide comment
@newnon

newnon Jan 3, 2018

Contributor

OK I will try to do it as soon as possible.

Contributor

newnon commented Jan 3, 2018

OK I will try to do it as soon as possible.

@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 5, 2018

Collaborator

CMake support for js-tests android project occurred errors, when I try to run js-tests using CMake build, please have a test after you adding cmake config to js-tests, and try to fix this.

you know we have to make sure all android project support cmake well, the tests project, the template project, even the lib project. really a lot of work to do for us.

Collaborator

drelaptop commented Jan 5, 2018

CMake support for js-tests android project occurred errors, when I try to run js-tests using CMake build, please have a test after you adding cmake config to js-tests, and try to fix this.

you know we have to make sure all android project support cmake well, the tests project, the template project, even the lib project. really a lot of work to do for us.

@crazyhappygame

This comment has been minimized.

Show comment
Hide comment
@crazyhappygame

crazyhappygame Jan 6, 2018

Contributor

@newnon would it be possible with cmake to build cocos2d-x once and use build output libraries in other games? I would like to save compilation time for my android games.

Contributor

crazyhappygame commented Jan 6, 2018

@newnon would it be possible with cmake to build cocos2d-x once and use build output libraries in other games? I would like to save compilation time for my android games.

@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 8, 2018

Collaborator

Any progress about cmake ? @newnon

You can have a try to use the output libraries in your game, hope for your feedback @crazyhappygame

Collaborator

drelaptop commented Jan 8, 2018

Any progress about cmake ? @newnon

You can have a try to use the output libraries in your game, hope for your feedback @crazyhappygame

@newnon

This comment has been minimized.

Show comment
Hide comment
@newnon

newnon Jan 8, 2018

Contributor

@drelaptop cleared version rebased on top of current v3

Contributor

newnon commented Jan 8, 2018

@drelaptop cleared version rebased on top of current v3

@newnon

This comment has been minimized.

Show comment
Hide comment
@newnon

newnon Jan 8, 2018

Contributor

@crazyhappygame unfortunately i haven't try this options, but it is possible.

Contributor

newnon commented Jan 8, 2018

@crazyhappygame unfortunately i haven't try this options, but it is possible.

@drelaptop

when change the cmake files of Android, I suggest keep other platform logic same. If not, do test to confirm the logic right.

Show outdated Hide outdated cocos/network/CMakeLists.txt Outdated
@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 9, 2018

Collaborator

This commit fix js-tests build error on mac, and build success, but run failed, only a black box appear. please help to do some check if you have free time.

#18545 have been fixed too, run failed is strange, please give some instructions about black box if you have time recently. @dumganhar

Collaborator

drelaptop commented Jan 9, 2018

This commit fix js-tests build error on mac, and build success, but run failed, only a black box appear. please help to do some check if you have free time.

#18545 have been fixed too, run failed is strange, please give some instructions about black box if you have time recently. @dumganhar

Merge pull request #5 from drelaptop/v3-merge-android-cmake
V3 merge android cmake, fix error for network module
@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Jan 9, 2018

Collaborator

Sorry, some config difference exist on js-tests, build right and run success, App path is different from others, see bin files tree:

├── cpp_empty_test.app
│   └── Contents
├── cpp_tests.app
│   └── Contents
├── js-tests
│   ├── js-tests
│   ├── main.js
│   ├── project.json
│   ├── res
│   ├── script
│   └── src
├── lua-tests.app
│   └── Contents
└── lua_empty_test.app
    └── Contents

bin/js-tests/js-tests is the js-tests project App, which is different from cpp-tests.app

Now, this branch on macOS(not include iOS) platform, cocos2d-x cmake build success, all tests project run success too. cmake .. -G ”Xcode“ generate Xcode macOS project success, tests project except js-tests run in Xcode well.

js-tests project run in Xcode need to be look into
project by cocos new need to be test

Collaborator

drelaptop commented Jan 9, 2018

Sorry, some config difference exist on js-tests, build right and run success, App path is different from others, see bin files tree:

├── cpp_empty_test.app
│   └── Contents
├── cpp_tests.app
│   └── Contents
├── js-tests
│   ├── js-tests
│   ├── main.js
│   ├── project.json
│   ├── res
│   ├── script
│   └── src
├── lua-tests.app
│   └── Contents
└── lua_empty_test.app
    └── Contents

bin/js-tests/js-tests is the js-tests project App, which is different from cpp-tests.app

Now, this branch on macOS(not include iOS) platform, cocos2d-x cmake build success, all tests project run success too. cmake .. -G ”Xcode“ generate Xcode macOS project success, tests project except js-tests run in Xcode well.

js-tests project run in Xcode need to be look into
project by cocos new need to be test

@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Feb 8, 2018

Collaborator

#18646 have been merged, this PR can be closed directly, thank you @newnon

Collaborator

drelaptop commented Feb 8, 2018

#18646 have been merged, this PR can be closed directly, thank you @newnon

@minggo minggo closed this Feb 8, 2018

@minggo

This comment has been minimized.

Show comment
Hide comment
@minggo

minggo Feb 8, 2018

Contributor

@drelaptop please write a doc for it and ask developers to test it. Thanks.

Contributor

minggo commented Feb 8, 2018

@drelaptop please write a doc for it and ask developers to test it. Thanks.

@drelaptop

This comment has been minimized.

Show comment
Hide comment
@drelaptop

drelaptop Feb 8, 2018

Collaborator

yeah, I should do that, a sample guide have been added in the http://discuss.cocos2d-x.org/t/in-progress-cmake-support-all-platform-for-cocos2d-x/41164/13

I will add cmake android guide later

Collaborator

drelaptop commented Feb 8, 2018

yeah, I should do that, a sample guide have been added in the http://discuss.cocos2d-x.org/t/in-progress-cmake-support-all-platform-for-cocos2d-x/41164/13

I will add cmake android guide later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment