Skip to content

Commit fb50508

Browse files
committed
modify readme
1 parent 3bac1ca commit fb50508

File tree

4 files changed

+137
-3
lines changed

4 files changed

+137
-3
lines changed

README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,143 @@ This repository is needed for cocos2d-x developers and/or people who want to por
77

88
As an example, if you want to support cocos2d-x in ARM64, you need to compile all these libraries for ARM64.
99

10+
**Note:**
11+
12+
- We use MacOSX to build all the static libraries for iOS, Android, Mac and Tizen.
13+
14+
- We use Windows to build all the static libraries for Win32.
15+
16+
- We use Ubuntu to build all the static libraries for Linux.
17+
18+
- Other platforms is not tested which means if you use windows to build static libraries for Android, it might be failed.
19+
1020

1121
## Download
1222

1323
$ git clone https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src.git
1424
$ cd cocos2d-x-dependencies
1525
$ git submodule update --init
26+
27+
## Prerequisite
28+
### For Mac users
29+
- You should install the latest version of XCode. You should also install the `Command Line Tools` bundled with XCode.
30+
31+
- You should install Git 1.8+, CMake 2.8+ and M4 1.4+.
32+
If you are a Homebrew user, you could simply run the following commands to install these tools:
33+
34+
```cpp
35+
brew install git
36+
brew install cmake
37+
brew install m4
38+
```
39+
40+
41+
### For Linux users
42+
xxx need to improve the document here later.
43+
44+
### For Windows users
45+
In order to run these scripts, you should install [msys2](http://msys2.github.io/) and update the system packages.
46+
47+
After that, you should also install the following dependencies:
48+
49+
```cpp
50+
pacman -S gcc
51+
pacman -S make
52+
pacman -S autoconf
53+
pacman -S automake
54+
pacman -S git
55+
pacman -S cmake
56+
pacman -S libtool
57+
```
58+
59+
## How to use
60+
### For iOS Platform
61+
For building libpng fat library:
62+
63+
```cpp
64+
cd build/ios
65+
./build_png.sh
66+
```
67+
68+
Or you can also use `build.sh` script build each static library for different arch.
69+
The usage would be:
70+
71+
```cpp
72+
usage: $0 [-s] [-k sdk] [-a arch] [-l libname]
73+
74+
OPTIONS
75+
-k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: 8.1)
76+
-s Build for simulator
77+
-a <arch> Specify which arch to use (current: armv7)
78+
-l <libname> Specify which static library to build
79+
```
80+
81+
If you want to build *websockets* with *i386* arch, you could use the following command:
82+
83+
```cpp
84+
./build.sh -s -a i386 -l websockets (Don't forget the -s option, it is stand for simulator, if you omit it, it will give you errors.)
85+
```
86+
87+
In this way, you can only build one arch a time, if you want to build a fat library, please use `build_xxx.sh` instead.(xxx is the library name, we will follow this conversion throughout this document.)
88+
89+
If you use `build_xxx.sh` to build static libraries, all the generated `header files` and `.a files` are under the folder named as `xxx`.
90+
91+
Let's give png as an example, after you run `./build_png.sh`, it will generate a folder named `png`:
92+
93+
The folder structure would be:
94+
95+
```
96+
-png
97+
--include(this folder contains the exported header files)
98+
- prebuilt(this folder contains the fat library)
99+
```
100+
101+
All the other libraries share the same folder structure.
102+
103+
### For Android Platform
104+
For building libpng with armeabi, armeabi-v7a and x86 arch, you can do it like this:
105+
106+
```cpp
107+
cd build/android
108+
./build_png.sh
109+
```
110+
Or you can also use `build.sh` script build each static library for different arch.
111+
The usage would be:
112+
113+
```cpp
114+
-k <sdk> Use the specified Android API level (default: android-19)
115+
-a <arch> Use the specified arch (default: armeabi-v7a)
116+
-n <version> Use the gcc version(default: 4.8)
117+
-l <libname> Use the specified library name
118+
EOF
119+
```
120+
121+
If you want to build a `curl` library with `armeabi` arch support, you can do it like this:
122+
123+
```cpp
124+
./build.sh -a armeabi -l curl
125+
```
126+
127+
### For Mac
128+
For building libpng x86_64 arch library:
129+
130+
```cpp
131+
cd build/mac
132+
./build_png.sh
133+
```
134+
### For Tizen
135+
136+
### For Linux
137+
138+
## How to build a DEBUG and RELEASE version
139+
xxx we need to improve the script to add debug and release options.
140+
141+
## How to do build clean?
142+
If you use `./build_xxx.sh` to build static libraries, there is no need to do clean. After generating the static library, script will delete the intermediate files.
143+
144+
If you use `./build.sh` manually, you should delete the folders generated in src folder.
145+
146+
## How to upgrade a existing library
147+
If you find a 3rd party library has some critical bug fix, you might need to update it.
148+
You can following the [README](./contrib/src/README) file to do this job.
149+

build/android/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ info()
1010
}
1111

1212
# TODO: You must set your ANDROID_NDK path in .bash_profile
13-
source ~/.bash_profile
13+
# source ~/.bash_profile
1414
ANDROID_ABI="armeabi-v7a"
1515
ANDROID_API="android-19"
1616
ANDROID_GCC_VERSION=4.8

build/android/build_without_export.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ info()
1010
}
1111

1212
# TODO: You must set your ANDROID_NDK path in .bash_profile
13-
source ~/.bash_profile
13+
# source ~/.bash_profile
1414
ANDROID_ABI="armeabi-v7a"
1515
ANDROID_API="android-19"
1616
ANDROID_GCC_VERSION=4.8

build/tizen/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33
set -x
44
# FIXME: you must set TIZEN_SDK in your .bash_profile
5-
source ~/.bash_profile
5+
# source ~/.bash_profile
66
# export TIZEN_SDK=~/tizen-sdk/
77

88
info()

0 commit comments

Comments
 (0)