Skip to content

Commit

Permalink
use travis to build iOS and mac (cocos2d#17999)
Browse files Browse the repository at this point in the history
  • Loading branch information
minggo authored Jun 29, 2017
1 parent 41ef696 commit 4b61ea1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 64 deletions.
48 changes: 12 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,18 @@ matrix:
android:
components:
- android-13
# mac lua-tests + js-tests
# - os: osx
# env: BUILD_TARGET=mac
# language: cpp
# osx_image: xcode7.3
# sudo: required
# python:
# - "2.7"
# cache: pip
# # mac cpp-tests
# - os: osx
# env: BUILD_TARGET=mac BUILD_CPP=true
# language: cpp
# osx_image: xcode7.3
# sudo: required
# python:
# - "2.7"
# cache: pip
# # iOS lua-tests + js-tests
# - os: osx
# env: BUILD_TARGET=ios
# language: cpp
# osx_image: xcode7.3
# sudo: required
# python:
# - "2.7"
# cache: pip
# # iOS cpp-tests
# - os: osx
# env: BUILD_TARGET=ios BUILD_CPP=true
# language: cpp
# osx_image: xcode7.3
# sudo: required
# python:
# - "2.7"
# cache: pip
# mac
- os: osx
env: BUILD_TARGET=mac
language: cpp
osx_image: xcode8.3
sudo: required
# iOS
- os: osx
env: BUILD_TARGET=ios
language: cpp
osx_image: xcode8.3
sudo: required

script:
- tools/travis-scripts/run-script.sh
Expand Down
13 changes: 0 additions & 13 deletions build/cocos2d_tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
buildPhases = (
);
dependencies = (
50FC3FAB1D74C3D0001C936A /* PBXTargetDependency */,
293CE83A1B43F3ED00F66EF1 /* PBXTargetDependency */,
1ADA8BA418CF277400AE24B9 /* PBXTargetDependency */,
1ADA8BA618CF277400AE24B9 /* PBXTargetDependency */,
Expand Down Expand Up @@ -1755,13 +1754,6 @@
remoteGlobalIDString = 1551A33E158F2AB200E66CFE;
remoteInfo = "cocos2dx Mac";
};
50FC3FAA1D74C3D0001C936A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = 50FC3F701D74BCC9001C936A;
remoteInfo = "game-controller-test Mac";
};
A035ACBF178246BD00987F6C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
Expand Down Expand Up @@ -7379,11 +7371,6 @@
name = "cocos2dx Mac";
targetProxy = 50FC3F721D74BCC9001C936A /* PBXContainerItemProxy */;
};
50FC3FAB1D74C3D0001C936A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 50FC3F701D74BCC9001C936A /* game-controller-test Mac */;
targetProxy = 50FC3FAA1D74C3D0001C936A /* PBXContainerItemProxy */;
};
A035ACC0178246BD00987F6C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1D6058900D05DD3D006BFB54 /* cpp-tests Mac */;
Expand Down
28 changes: 13 additions & 15 deletions tools/travis-scripts/run-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,18 @@ function build_mac()
{
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`

if [ $BUILD_CPP == 'true' ]; then
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "cpp-empty-test Mac" -jobs $NUM_OF_CORES -arch x86_64 -sdk macosx10.11 build
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "cpp-tests Mac" -jobs $NUM_OF_CORES -arch x86_64 -sdk macosx10.11 build
else
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "lua-tests Mac" -jobs $NUM_OF_CORES -arch x86_64 -sdk macosx10.11 build
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "js-tests Mac" -jobs $NUM_OF_CORES -arch x86_64 -sdk macosx10.11 build
fi
xcodebuild -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "build all tests Mac" -jobs $NUM_OF_CORES -arch x86_64 build | xcpretty
##xcpretty has a bug, some xcodebuid fails return value would be treated as 0.
xcodebuild -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "build all tests Mac" -jobs $NUM_OF_CORES -arch x86_64 build
}

function build_ios()
{
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`

if [ $BUILD_CPP == 'true' ]; then
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "cpp-empty-test iOS" -jobs $NUM_OF_CORES -arch i386 -sdk iphonesimulator9.3 build
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "cpp-tests iOS" -jobs $NUM_OF_CORES -arch i386 -sdk iphonesimulator9.3 build
else
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "lua-tests iOS" -jobs $NUM_OF_CORES -arch i386 -sdk iphonesimulator9.3 build
xctool -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "js-tests iOS" -jobs $NUM_OF_CORES -arch i386 -sdk iphonesimulator9.3 build
fi
xcodebuild -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
#the following commands must not be removed
xcodebuild -project $COCOS2DX_ROOT/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
}

function build_android()
Expand Down Expand Up @@ -96,9 +88,15 @@ function genernate_binding_codes()
{
# set environment variables needed by binding codes

which python

export NDK_ROOT=$HOME/bin/android-ndk
export PYTHON_BIN=/usr/bin/python

if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export PYTHON_BIN=/usr/local/bin/python
else
export PYTHON_BIN=/usr/bin/python
fi

# Generate binding glue codes

Expand Down

0 comments on commit 4b61ea1

Please sign in to comment.