axmol/cmake
leeda edee97278f V3 android cmake support, add mac/ios support (#18646)
* CMake build improvements

* android cmake support

* Enable proguard for cocos2d

* examples & test cmake support

* add android build type param to gradle.properties file

* less warnings

* update all android configs to recomended settings

* fix network cmake error

* fix js-tests cmake error

* android build config, add cmake

* android build config, add cmake

* add lua share lib

* android lua cmake build fix

* fix

* luajit test

* run fail, still

* fix js-warning

* correct lua main include

* lua test project cmake support android

* try to add lua-template cmake support

* lua template fix

* js_tests support cmake on android

* js-tests improve

* cmake support js-template

* test to realise prebuild

* cmake improve, no feature

* improve templates cmake

* refactor cmake struct

* correct cpp-tests cmake

* cpp-templates cmake improve

* typo fix

* cmake struct refator

* change default option

* adapt new project struct

* uniform cmake test style

* add_dependencies to support make -j

* little struct improve

* little fix

* adapt cmake bin dir

* little improve about cmake version

* change build all tests condition

* add source_group for Xcode

* add mark source files

* add more mark source code

* add template project to test

* add macos info.plist template

* add pak macos for all project

* lua test icon fix

* not consider lua project for now

* modify pak method

* add another ios toolchain

* add ios system library

* update ios toolchain, and reduce ios compile errors

* reduce error

* make ios engine lib compile pass

* cpp-empty-test ios bundle

* cpp-tests ios support

* js-tests ios support

* templates project support ios

* fix the way of lua-tests package

* try to fix lua-template on macOS

* comment lua-template sim file

* improve display on xcode

* update cmake readme

* check android compile again

* fix android compile error

* fix linux cmake res error

* update deps version, for cmake

* fix lua_template linux compile error

* close android cmake support for now

* review template android share library name

* change PROP_BUILD_TOOLS_VERSION version to 27.0.1

* change android compile version

* make `PROP_APP_PLATFORM` back, add comments for android native build

* Revert "make `PROP_APP_PLATFORM` back, add comments for android native build"

This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
..
Modules V3 android cmake support, add mac/ios support (#18646) 2018-02-08 09:24:33 +08:00
AndroidNdkGdb.cmake Various CMake improvements 2016-06-14 10:20:57 -04:00
AndroidNdkModules.cmake Squashed commit of the following: 2016-03-02 16:51:54 -08:00
BuildHelpers.CMakeLists.txt Move BuildHelpers.CMakeLists.txt to Modules/CocosBuildHelpers.cmake, this name is more standard for cmake include files, and in future this file can be installed to use by external applications. 2014-11-11 10:30:48 +03:00
README.md V3 android cmake support, add mac/ios support (#18646) 2018-02-08 09:24:33 +08:00
android.toolchain.cmake Various CMake improvements 2016-06-14 10:20:57 -04:00
ios.toolchain.cmake V3 android cmake support, add mac/ios support (#18646) 2018-02-08 09:24:33 +08:00

README.md

CMake Build Instructions

Depending on your host system your Generator flag -G may be different

Typical -G options For using gcc and clang from a makefile

msys2 = "MSYS Makefiles" windows = "MinGW Makefiles" nix and mac = "Unix Makefiles"

For using and editor such as Visual Studio or xcode there are different flags

To like all available flags for your system run

cmake --help

Build Examples

using CMake in macOS terminal

cmake -H$COCOS_TEMPLATES_ROOT/.. -Bbuild_cocos2dx
cd build_cocos2dx
make all -j 4

Generate Xcode Project for macOS platform

cmake -H$COCOS_TEMPLATES_ROOT/.. -Bbuild_mac -GXcode
cd build_mac
open Cocos2d-x.xcodeproj

Generate Xcode Project for iOS platform

cd any_dir_you_want
cmake -DCMAKE_TOOLCHAIN_FILE=$COCOS_TEMPLATES_ROOT/../cmake/ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64 -H$COCOS_TEMPLATES_ROOT/.. -Bbuild_ios_sim64 -GXcode
cd build_ios_sim64
open Cocos2d-x.xcodeproj

using CMake in Android Studio

see the Gradle properties: PROP_NDK_MODE, it control the way of build Native

# android cmake support
# uncomment it, native code will build by cmake
# keep comment, native code will build by ndkBuild
# PROP_NDK_MODE=cmake

TODO

1. make cmake build support windows
2. generate Visual Studio project
3. test cmake build again on Linux 
4. add examples and more details in this manual