Skip to content

Commit fd4aba1

Browse files
author
minggo
committed
Merge pull request #11 from andyque/testScripts
add build.sh to iOS platform
2 parents eb121b4 + d8f2991 commit fd4aba1

File tree

10 files changed

+513
-466
lines changed

10 files changed

+513
-466
lines changed

README.md

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ As an example, if you want to support cocos2d-x in ARM64, you need to compile al
1111

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

14-
- We use Windows to build all the static libraries for Win32.
14+
- We use Windows to build all the static libraries for Win32, WP8 and WinRT.
1515

1616
- We use Ubuntu to build all the static libraries for Linux.
1717

@@ -30,6 +30,7 @@ As an example, if you want to support cocos2d-x in ARM64, you need to compile al
3030
If you are a Homebrew user, you could simply run the following commands to install these tools:
3131

3232
```cpp
33+
brew update
3334
brew install git
3435
brew install cmake
3536
brew install m4
@@ -61,39 +62,35 @@ pacman -S libtool
6162
```
6263

6364
## How to use
64-
### For iOS Platform
65-
For building libpng fat library:
65+
We have one build script for each platform, they are under `build/platform{ios/mac/android/tizen}` directory.
6666

67-
```cpp
68-
cd build/ios
69-
./build_png.sh
67+
All of them share the same usage:
68+
69+
```
70+
./build.sh --libs=param1 --arch=param2 --mode=param3
7071
```
7172

72-
Or you can also use `build.sh` script build each static library for different arch.
73-
The usage would be:
73+
- param1:
74+
- use `all` to build all the 3rd party libraries, it will take you a very long time.
75+
- use comma separated library names, for example, `png,lua,jpeg/webp`, no space between the comma.
7476

75-
```cpp
76-
usage: $0 [-s] [-k sdk] [-a arch] [-l libname]
77+
- param2:
78+
- use `all` to build all the supported arches. For iOS, they are "armv7, arm64, i386, x86_64", for Android, they are "armeabi, armeabi-v7a, x86, arm64", for Mac, they are "x86_64", for Tizen, they are "armv7"
79+
- use comma separated arch name, for example, `armv7, arm64`, no space between the comma.
7780

78-
OPTIONS
79-
-k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: 8.1)
80-
-s Build for simulator
81-
-a <arch> Specify which arch to use (current: armv7)
82-
-l <libname> Specify which static library to build
83-
```
81+
- param3:
82+
- release: Build library on release mode. This is the default option. We use `-O3 -DNDEBUG` flags to build release library.
83+
- debug: Build library on debug mode. we use `-O0 -g -DDEBUG` flag to build debug library.
8484

85-
If you want to build *websockets* with *i386* arch, you could use the following command:
85+
### For iOS Platform
86+
For building libpng fat library with all arch x86_64, i386, armv7, arm64 on release mode:
8687

8788
```cpp
8889
cd build/ios
89-
./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.)
90+
./build.sh --libs=png
9091
```
9192

92-
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.)
93-
94-
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`.
95-
96-
Let's give png as an example, after you run `./build_png.sh`, it will generate a folder named `png`:
93+
After running this command, it will generate a folder named `png`:
9794

9895
The folder structure would be:
9996

@@ -105,45 +102,21 @@ The folder structure would be:
105102

106103
All the other libraries share the same folder structure.
107104

108-
### For Android Platform
109-
For building libpng with armeabi, armeabi-v7a and x86 arch, you can do it like this:
110-
111-
```cpp
112-
cd build/android
113-
./build_png.sh
114-
```
115-
Or you can also use `build.sh` script build each static library for different arch.
116-
The usage would be:
105+
For building libpng fat library with arch armv7 and arm64 on debug mode:
117106

118107
```cpp
119-
-k <sdk> Use the specified Android API level (default: android-19)
120-
-a <arch> Use the specified arch (default: armeabi-v7a)
121-
-n <version> Use the gcc version(default: 4.8)
122-
-l <libname> Use the specified library name
123-
EOF
108+
cd build/ios
109+
./build.sh --libs=png --arch=armv7,arm64 --mode=debug
124110
```
125111

126-
If you want to build a `curl` library with `armeabi` arch support, you can do it like this:
127-
128-
```cpp
129-
cd build/android
130-
./build.sh -a armeabi -l curl
131-
```
112+
### For Android Platform
113+
xxx document will be update later.
132114

133115
### For Mac
134-
For building libpng x86_64 arch library:
116+
xxx document will be update later.
135117

136-
```cpp
137-
cd build/mac
138-
./build_png.sh
139-
```
140118
### For Tizen
141-
For building libpng armv7 arch library:
142-
143-
```cpp
144-
cd build/tizen
145-
./build_png.sh
146-
```
119+
xxx document will be update later.
147120

148121
### For Linux
149122
xxx After testing these scripts on Linux, document will be update.
@@ -152,11 +125,12 @@ xxx After testing these scripts on Linux, document will be update.
152125
xxx we need to improve the script to add debug and release options.
153126

154127
## How to do build clean?
155-
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.
128+
If you use `./build.sh` to build static libraries, there is no need to do clean. After generating the static library, script will delete the intermediate files.
156129

157-
If you use `./build.sh` manually, you should delete the folders generated in src folder.
158130

159131
## How to upgrade a existing library
160132
If you find a 3rd party library has some critical bug fix, you might need to update it.
161133
You can following the [README](./contrib/src/README) file to do this job.
162134

135+
## How to add new 3rd party libraries
136+
Please refer to [README](./contrib/src/README)

0 commit comments

Comments
 (0)