• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    Perl
  • Created over 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dependencies of cocos2d-x.

cocos2d-x 3rd party libs

This repository includes the source code of the 3rd party libraries (binary) that are bundled with cocos2d-x.

This repository is needed for cocos2d-x developers and/or people who want to:

  • generate a updated version of a certain library (eg: upgrade libpng 1.6.2 to 1.6.14)
  • port cocos2d-x to other platforms (eg: port it to Android ARM64, or Tizen, etc)
  • generate DEBUG versions of all the 3rd party library

Note:

  • We use MacOSX to build all the static libraries for iOS, Android, Mac and Tizen.

  • We use Ubuntu to build all the static libraries for Linux.

  • Windows is not supported yet

Other configuration were not tested. Compiling the Android binaries from a Linux or Windows machine were not tested, so we don't know if it works or not.

Download

$ git clone https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src.git

Prerequisite

For Mac users

  • If you want to use these scripts, you should install Git 1.8+, CMake 2.8+, autoconf and libtool. If you are a Homebrew user, you could simply run the following commands to install these tools:
brew update
brew install git
brew install cmake
brew install autoconf
brew install automake
brew install libtool

Note: If you have an old version autoconf installed, you may need uninstall it first, then reinstall the new version. Directly upgrade to new version by brew upgrade command may cause build always failed.

  • If you want to build static libraries for iOS and Mac, you should install the latest version of XCode. You should also install the Command Line Tools bundled with XCode.

  • If you want to build static libraries for Android, you should install NDK. NDK r16 is required at the moment and you should also specify the ANDROID_NDK environment variable in your shell.

  • If you want to build static libraries for Tizen, you should download and install Tizen SDK. And you should also add a environment variable named TIZEN_SDK in your shell.

For Linux(Ubuntu) users

  • If you want to use these scripts, you should instll autoconf:
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install cmake
sudo apt-get install libtool
sudo apt-get install git
  • If you want to build 32-bit libs on a 64-bit linux system, you should install gcc-multilib and g++-multilib
sudo apt-get update
sudo apt-get install gcc-multilib
sudo apt-get install g++-multilib

Then use command as follow to build 32-bit libs

./build.sh -p=platform --libs=libs --arch=i386 --mode=mode

Windows 10 Universal (win10) App users

The build script for Windows 10.0 Universal (win10) external dependencies in in build\build_win10_uwp.bat. The script will build all of the dependencies using a customized version of [vcpkg] (https://github.com/Microsoft/vcpkg). After build_win10_uwp.bat is complete, the external dependencies will be in contrib\install-win10\external.

For Windows (Win32) App users

To build static libraries for Win32 is straightfoward, you could just setup a new static libary project with VisualStudio and import all the needed source files and header files into the project.

Note: Some libraries use configure system to generate the required header files for Windows platform. If you find some header files are missing, please check the README file of the 3rd libs. In general, it will provide a VS project to build the static libs for Windows. Some libs also provide a CMakeLists.txt file, you could use CMake GUI tool to generate a static library project. Don't forgt to Google the error messages when you can't compile the libs successfully.

For Tizen Users

To build static libraries for Tizen, you should install Tizen Studio at first. At the time of writing, the latest version of Tizen Studio is v1.1.0, you could download it from here.

Note: By default, we use Tizen SDK 2.4 to build static libs. If you want to build static libraries with other Tizen SDK version, you should change cfg_default_tizen_sdk_version in tizen.ini file.

After downloading the Tizen Studio, you should also install the native packages with the Tizen Update Manager from the Tools/Package Manager menu in Tizen Studio.

When finished the above setup, you should set a TIZEN_STUDIO_HOME environment variable to your shell configure file. (Normally .bash_profile for bash and .zshrc for zsh).

How to use

We have one build script for each platform, it is under build directory.

The usage would be:

./build.sh -p=platform --libs=libs --arch=arch --mode=mode --list
  • platform: specify a platform. Supported platforms: ios, mac, android, linux and tizen

    libs:

    • use all to build all the 3rd party libraries.
    • use comma separated library names, for example, png,lua,jpeg,webp, no space between the comma to select one or more libs

    arch:

    • use all to build all the supported architectures.
    • for iOS, they are "armv7, arm64, i386, x86_64"
    • for Android, they are "arm,armv7,arm64,x86"
    • for Mac, they are "x86_64"
    • for Tizen, they are "armv7"
    • use comma separated arch name, for example, armv7, arm64, no space between the comma.
  • mode:

    • release: Build library on release mode. This is the default option. We use -O3 -DNDEBUG flags to build release library.
    • debug: Build library on debug mode. we use -O0 -g -DDEBUG flag to build debug library.
  • list:

    • Use these option to list all the supported library names and versions.

Build png on iOS platform

For building libpng fat library with all arch x86_64, i386, armv7, arm64 on release mode:

cd build
./build.sh -p=ios --libs=png

After running this command, it will generate a folder named png:

The folder structure would be:

-png
--include(this folder contains the exported header files)
- prebuilt(this folder contains the fat library)

All the other libraries share the same folder structure.

For building libpng fat library with arch armv7 and arm64 on debug mode:

cd build
./build.sh -p=ios --libs=png --arch=armv7,arm64 --mode=debug

Build for Android arm64

  1. Download Android NDK r10c+ and set the ANDROID_NDK to point to the Android NDK path. Don't forget to source ~/.bash_profile.

  2. Make sure the cfg_default_arm64_build_api is 21+(The default is 21) and cfg_default_gcc_version is 4.9 in android.ini config.

  3. Pass --arch=arm64 to build the libraries with arm64 support.

Note: If you build webp with arm64, you will get cpu-features.h header file not found error. This is a known issue of Android NDK r10c. You could simply create a empty header file named cpu-features.h under {ANDROID_NDK}/platforms/android-21/arch-arm64/usr/include.

Enable bitcode for iOS

On default, when building static libs for TVOS, it will enable bitcode, but iOS doesn't.

You should change cgf_build_bitcode in ios.ini to -fembed-bitcode.

Here is the example code:

cfg_build_bitcode="-fembed-bitcode"

How to build a DEBUG and RELEASE version

You can add flag "--mode=[debug | release]" for building DEBUG and RELEASE version.

How to do build clean?

You could simply turn on the flag cfg_is_cleanup_after_build to "yes" in main.ini file. After each build, you could also delete the generated folders under contrib directory.

How to upgrade a existing library

If you find a 3rd party library has some critical bug fix, you might need to update it. You can following the README file to do this job.

How to add new 3rd party libraries

Please refer to README

More Repositories

1

cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
C++
18,090
star
2

cocos2d-objc

Cocos2d for iOS and OS X, built using Objective-C
Objective-C
4,070
star
3

cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
JavaScript
3,055
star
4

cocos2d-js

cocos2d-x for JS
C++
1,858
star
5

CocosBuilder

CocosBuilder, the visual editor for cocos2d
Objective-C
1,012
star
6

cocos2d-iphone-extensions

3rd party extensions for cocos2d-iphone
Objective-C
638
star
7

cocos2d-x-samples

Contains different cocos2d-x samples
Python
575
star
8

creator_to_cocos2dx

Creator plugin to support C++& Lua in cocos2d-x
C++
234
star
9

cocos2d-x-3rd-party-libs-bin

C
197
star
10

cocos2d-js-tests

cocos2d JavaScript test cases and games.
JavaScript
187
star
11

bindings-generator

JSBindings generator for C++
Python
168
star
12

cocos2d-x-extensions

samples games & code snips for cocos2d-x
C++
152
star
13

cocos2d-console

cocos2d command line tool
Python
151
star
14

cocos2d-x-for-xna

port cocos2d-x into c# based on XNA
C#
123
star
15

cocos2d-x-docs

documentation of cocos2d-x
HTML
102
star
16

cocos2d-objc-ext

Extensions and utility classes for Cocos2D-iphone
Objective-C
58
star
17

cocos2d-iphone-classic

Repository of original V1 and V2 of Cocos2D-iphone
Objective-C
47
star
18

cocos2d-frame

Player and "stub" for cocos2d
C
37
star
19

cocos2d-js-samples

Includes different samples to be used with cocos2d
JavaScript
36
star
20

cocos2d-x-swift-bindings

Swift bindings for cocos2d-x
Objective-C++
32
star
21

cocos2d-x-external

use CMake to build external 3rd party modules for cocos2d-x
C
18
star
22

cocos2d-js__old__

cocos2d in JavaScript central repository
JavaScript
14
star
23

js-bindings

C++
13
star
24

cocos2d-x-classic

For full history commit logs of cocos2d-x
C
8
star
25

v8

V8 building
Python
7
star
26

migration-demo-objc

The Objective-C flavoured version of migration-demo-x
Objective-C
6
star
27

migration-demo-x

Demonstrates -obj to -x project migration
C++
5
star
28

console-binary

The binary files for cocos2d-console
4
star
29

cocos2d-x-docs-deps

Dependencies of building cocos2d-x docs
Shell
2
star
30

cocos2d.github.io

1
star