Skip to content

Commit

Permalink
Android: added support for building libcocos2d
Browse files Browse the repository at this point in the history
Signed-off-by: martell <[email protected]>
  • Loading branch information
martell committed Oct 3, 2014
1 parent d420ae3 commit 8a4b8af
Show file tree
Hide file tree
Showing 5 changed files with 1,850 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ elseif(MACOSX)
elseif(LINUX)
ADD_DEFINITIONS(-DLINUX)
set(PLATFORM_FOLDER linux)
elseif(ANDROID)
ADD_DEFINITIONS (-DUSE_FILE32API)
set(PLATFORM_FOLDER android)
else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
Expand Down Expand Up @@ -178,8 +181,13 @@ if(NOT MINGW)
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/include/${PLATFORM_FOLDER_ARCH}
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER_ARCH}


${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER_ARCH}/freetype2
)

#todo: fix location of freetype includes for linux android on cocos prebuilt repo
#i.e we should not need to include an extra dir of /freetype2

link_directories(

${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2/prebuilt/${PLATFORM_FOLDER_ARCH}
Expand Down
40 changes: 40 additions & 0 deletions README.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

CMake Build Instructions

NB. 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 or sublime text there are different flags

To like all available flags for your system run

cmake --help


More Examples

mac build Instructions

cd cocos2d-x
mkdir macbuild && cd macbuild
cmake -G "Unix Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..

Android Build Instructions

cd cocos2d-x
mkdir androidbuild && cd androidbuild
cmake -G"MSYS Makefiles" -DANDROID_NDK=/path/to/android-ndk-r9d -DANDROID_NATIVE_API_LEVEL=android-9 -DCMAKE_TOOLCHAIN_FILE=../cmake/android.toolchain.cmake ..

mingw64 with msys2 build Instructions

cd cocos2d-x
mkdir mingwbuild && cd mingwbuild
cmake -G "MSYS Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..

todo: structure this document in markdown with better examples and more details
Loading

0 comments on commit 8a4b8af

Please sign in to comment.