File tree Expand file tree Collapse file tree 4 files changed +37
-17
lines changed Expand file tree Collapse file tree 4 files changed +37
-17
lines changed Original file line number Diff line number Diff line change 210
210
fi
211
211
212
212
echo " build $arch for $lib "
213
- $top_dir /contrib/$build_script_name $is_simulator -a $arch -l $library_name
213
+ $top_dir /contrib/$build_script_name $is_simulator -a $arch -l $library_name -m $build_mode
214
214
215
215
cp $top_dir /contrib/$install_library_path /$arch /lib/lib$archive_name .a $archive_name /prebuilt/lib$archive_name -$arch .a
216
216
# FIXME: some archive names have some postfix in it.
246
246
# TODO: add more header files decides here
247
247
248
248
echo " cleaning up"
249
- # rm -rf $top_dir/contrib/$install_library_path
250
- # rm -rf $top_dir/contrib/$build_library_path-$arch
249
+ rm -rf $top_dir /contrib/$install_library_path
250
+ rm -rf $top_dir /contrib/$build_library_path -$arch
251
251
done
252
252
253
253
create_fat_library $archive_name
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ SDK_VERSION=$(xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{pr
8
8
# FIXME: why min deploy target can't use 5.1.1
9
9
SDK_MIN=6.0
10
10
ARCH=armv7
11
+ BUILD_MODE=release
11
12
12
13
# TODO: configure to compile speficy 3rd party libraries
13
14
OPTIONS=" "
@@ -16,13 +17,14 @@ OPTIONS=""
16
17
usage ()
17
18
{
18
19
cat << EOF
19
- usage: $0 [-s] [-k sdk] [-a arch] [-l libname]
20
+ usage: $0 [-s] [-k sdk] [-a arch] [-l libname] [-m biuld mode]
20
21
21
22
OPTIONS
22
23
-k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION} )
23
24
-s Build for simulator
24
25
-a <arch> Specify which arch to use (current: ${ARCH} )
25
26
-l <libname> Specify which static library to build
27
+ -m <build mode> Specify release or debug mode(current: ${BUILD_MODE} )
26
28
EOF
27
29
}
28
30
44
46
}
45
47
46
48
47
- while getopts " hvsk:a:l:" OPTION
49
+ while getopts " hvsk:a:l:m: " OPTION
48
50
do
49
51
case $OPTION in
50
52
h)
66
68
l)
67
69
OPTIONS=--enable-$OPTARG
68
70
;;
71
+ m) BUILD_MODE=$OPTARG
72
+ ;;
69
73
? )
70
74
usage
71
75
exit 1
@@ -98,10 +102,16 @@ info "Building cocos2d-x third party libraries for iOS"
98
102
99
103
if [ " $PLATFORM " = " Simulator" ]; then
100
104
TARGET=" ${ARCH} -apple-darwin"
101
- OPTIM=" -O3 -g"
102
105
else
103
106
TARGET=" arm-apple-darwin"
104
- OPTIM=" -O3 -g"
107
+ fi
108
+
109
+ if [ $BUILD_MODE = " release" ]; then
110
+ OPTIM=" -O3 -DNDEBUG"
111
+ fi
112
+
113
+ if [ $BUILD_MODE = " debug" ]; then
114
+ OPTIM=" -O0 -g -DDEBUG"
105
115
fi
106
116
107
117
info " Using ${ARCH} with SDK version ${SDK_VERSION} "
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ SDK_VERSION=$(xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{pr
8
8
# FIXME: why min deploy target can't use 5.1.1
9
9
SDK_MIN=6.0
10
10
ARCH=armv7
11
+ BUILD_MODe=release
11
12
12
13
# TODO: configure to compile speficy 3rd party libraries
13
14
OPTIONS=" "
@@ -16,13 +17,14 @@ OPTIONS=""
16
17
usage ()
17
18
{
18
19
cat << EOF
19
- usage: $0 [-s] [-k sdk] [-a arch] [-l libname]
20
+ usage: $0 [-s] [-k sdk] [-a arch] [-l libname] [-m build mode]
20
21
21
22
OPTIONS
22
23
-k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION} )
23
24
-s Build for simulator
24
25
-a <arch> Specify which arch to use (current: ${ARCH} )
25
26
-l <libname> Specify which static library to build
27
+ -m <build mode> Specify release or debug mode(current: ${BUILD_MODE} )
26
28
EOF
27
29
}
28
30
44
46
}
45
47
46
48
47
- while getopts " hvsk:a:l:" OPTION
49
+ while getopts " hvsk:a:l:m: " OPTION
48
50
do
49
51
case $OPTION in
50
52
h)
66
68
l)
67
69
OPTIONS=--enable-$OPTARG
68
70
;;
71
+ m) BUILD_MODE=$OPTARG
72
+ ;;
69
73
? )
70
74
usage
71
75
exit 1
@@ -98,10 +102,16 @@ info "Building cocos2d-x third party libraries for iOS"
98
102
99
103
if [ " $PLATFORM " = " Simulator" ]; then
100
104
TARGET=" ${ARCH} -apple-darwin"
101
- OPTIM=" -O3 -g"
102
105
else
103
106
TARGET=" arm-apple-darwin"
104
- OPTIM=" -O3 -g"
107
+ fi
108
+
109
+ if [ $BUILD_MODE = " release" ]; then
110
+ OPTIM=" -O3"
111
+ fi
112
+
113
+ if [ $BUILD_MODE = " debug" ]; then
114
+ OPTIM=" -O0 -g"
105
115
fi
106
116
107
117
info " Using ${ARCH} with SDK version ${SDK_VERSION} "
Original file line number Diff line number Diff line change @@ -109,11 +109,11 @@ RANLIB=xcrun ranlib
109
109
# EXTRA_CFLAGS += -isysroot $(MACOSX_SDK) -mmacosx-version-min=$(MIN_OSX_VERSION) -DMACOSX_DEPLOYMENT_TARGET=$(MIN_OSX_VERSION)
110
110
# EXTRA_LDFLAGS += -Wl,-syslibroot,$(MACOSX_SDK) -mmacosx-version-min=$(MIN_OSX_VERSION) -isysroot $(MACOSX_SDK) -DMACOSX_DEPLOYMENT_TARGET=$(MIN_OSX_VERSION)
111
111
ifeq ($(ARCH ) ,x86_64)
112
- EXTRA_CFLAGS += -m64 -O3 -DNDEBUG
113
- EXTRA_LDFLAGS += -m64 -O3 -DNDEBUG
112
+ EXTRA_CFLAGS += -m64
113
+ EXTRA_LDFLAGS += -m64
114
114
else
115
- EXTRA_CFLAGS += -m32 -O3 -DNDEBUG
116
- EXTRA_LDFLAGS += -m32 -O3 -DNDEBUG
115
+ EXTRA_CFLAGS += -m32
116
+ EXTRA_LDFLAGS += -m32
117
117
endif
118
118
119
119
XCODE_FLAGS = -sdk macosx$(OSX_VERSION )
@@ -165,8 +165,8 @@ cppcheck = $(shell $(CC) $(CFLAGS) -E -dM - < /dev/null | grep -E $(1))
165
165
166
166
EXTRA_CFLAGS += -I$(PREFIX ) /include
167
167
CPPFLAGS := $(CPPFLAGS ) $(EXTRA_CFLAGS )
168
- CFLAGS := $(CFLAGS ) $(EXTRA_CFLAGS ) -g
169
- CXXFLAGS := $(CXXFLAGS ) $(EXTRA_CFLAGS ) -g
168
+ CFLAGS := $(CFLAGS ) $(EXTRA_CFLAGS )
169
+ CXXFLAGS := $(CXXFLAGS ) $(EXTRA_CFLAGS )
170
170
EXTRA_LDFLAGS += -L$(PREFIX ) /lib
171
171
LDFLAGS := $(LDFLAGS ) $(EXTRA_LDFLAGS )
172
172
# Do not export those! Use HOSTVARS.
You can’t perform that action at this time.
0 commit comments