Skip to content

Commit 31510ee

Browse files
PatriceJiangminggo
authored andcommitted
[CI ]add cocos new for iOS (#20380)
1 parent 61ff9ed commit 31510ee

File tree

2 files changed

+66
-15
lines changed

2 files changed

+66
-15
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ matrix:
5656
env: BUILD_TARGET=linux_cocos_new_test
5757
language: cpp
5858
sudo: required
59+
- os: osx
60+
env: BUILD_TARGET=ios_cocos_new_lua_test
61+
language: cpp
62+
osx_image: xcode11
63+
sudo: required
64+
- os: osx
65+
env: BUILD_TARGET=ios_cocos_new_cpp_test
66+
language: cpp
67+
osx_image: xcode11
68+
sudo: required
5969

6070
script:
6171
- tools/travis-scripts/run-script.sh

tools/travis-scripts/run-script.sh

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ function build_linux()
3333
echo "Building tests ..."
3434
source ../environment.sh
3535
cd $COCOS2DX_ROOT
36-
mkdir -p linux-build
37-
cd linux-build
38-
cmake ..
39-
cmake --build .
36+
set -x
37+
cmake . -G "Unix Makefiles" -Blinux-build-release -DCMAKE_BUILD_TYPE=Release
38+
cmake --build linux-build-release -- -j `nproc`
39+
set +x
4040
}
4141

4242
function build_mac_cmake()
@@ -51,10 +51,10 @@ function build_mac_cmake()
5151
mkdir -p mac_cmake_build
5252
cd mac_cmake_build
5353
cmake .. -GXcode
54-
# cmake --build .
55-
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build | xcpretty
56-
#the following commands must not be removed
57-
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build
54+
cmake --build . --config Release -- -quiet
55+
#xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build | xcpretty
56+
##the following commands must not be removed
57+
#xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build
5858
exit 0
5959
}
6060

@@ -71,10 +71,11 @@ function build_ios_cmake()
7171
cd ios_cmake_build
7272
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator
7373
# too much logs on console when "cmake --build ."
74-
# cmake --build .
75-
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
76-
#the following commands must not be removed
77-
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
74+
cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)"
75+
76+
#xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
77+
##the following commands must not be removed
78+
#xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
7879
exit 0
7980
}
8081

@@ -215,24 +216,64 @@ function run_pull_request()
215216
update_cocos_files
216217
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l lua -p my.pack.qqqq cocos_new_test
217218
popd
218-
219219
echo "Building tests ..."
220+
221+
set -x
220222
cd $COCOS2DX_ROOT/cocos_new_test
221223
mkdir -p linux-build
222224
cd linux-build
223-
cmake ..
224-
cmake --build .
225+
cmake .. -G"Unix Makefiles"
226+
cmake --build . -- -j `nproc`
227+
exit 0
228+
fi
229+
230+
if [ "$BUILD_TARGET" == "ios_cocos_new_lua_test" ]; then
231+
export PATH=$PATH:$COCOS2DX_ROOT/tools/cocos2d-console/bin
232+
#NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`
233+
genernate_binding_codes
234+
pushd $COCOS2DX_ROOT
235+
echo "Creating tests ..."
236+
237+
set -x
238+
cocos --agreement n new -l lua ios_new_lua_proj
239+
cd ios_new_lua_proj
240+
mkdir build
241+
cd build
242+
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator
243+
cmake --build . --config Release -- -quiet
244+
popd
245+
exit 0
246+
fi
247+
248+
if [ "$BUILD_TARGET" == "ios_cocos_new_cpp_test" ]; then
249+
export PATH=$PATH:$COCOS2DX_ROOT/tools/cocos2d-console/bin
250+
#NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`
251+
genernate_binding_codes
252+
pushd $COCOS2DX_ROOT
253+
echo "Creating tests ..."
254+
255+
set -x
256+
cocos --agreement n new -l cpp ios_new_cpp_proj
257+
cd ios_new_cpp_proj
258+
mkdir build
259+
cd build
260+
echo "Building tests ..."
261+
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator
262+
cmake --build . --config Release -- -quiet
263+
popd
225264
exit 0
226265
fi
227266

228267
if [ $BUILD_TARGET == 'mac_cmake' ]; then
229268
genernate_binding_codes
269+
set -x
230270
build_mac_cmake
231271
exit 0
232272
fi
233273

234274
if [ $BUILD_TARGET == 'ios_cmake' ]; then
235275
genernate_binding_codes
276+
set -x
236277
build_ios_cmake
237278
exit 0
238279
fi

0 commit comments

Comments
 (0)