2021-12-31 12:12:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# exit this script if any commmand fails
|
|
|
|
set -e
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2022-08-29 20:51:22 +08:00
|
|
|
AX_ROOT="$DIR"/../..
|
2021-12-31 12:12:40 +08:00
|
|
|
|
|
|
|
function do_retry()
|
|
|
|
{
|
|
|
|
cmd=$@
|
|
|
|
retry_times=5
|
|
|
|
retry_wait=3
|
|
|
|
c=0
|
|
|
|
while [ $c -lt $((retry_times+1)) ]; do
|
|
|
|
c=$((c+1))
|
|
|
|
echo "Executing \"$cmd\", try $c"
|
|
|
|
$cmd && return $?
|
|
|
|
if [ ! $c -eq $retry_times ]; then
|
|
|
|
echo "Command failed, will retry in $retry_wait secs"
|
|
|
|
sleep $retry_wait
|
|
|
|
else
|
|
|
|
echo "Command failed, giving up."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function build_linux()
|
|
|
|
{
|
2022-11-01 17:35:00 +08:00
|
|
|
cmake . -G "Unix Makefiles" -Bbuild -DCMAKE_BUILD_TYPE=Release -DAX_ENABLE_EXT_IMGUI=ON -DAX_ENABLE_EXT_EFFEKSEER=ON
|
2022-12-12 02:23:39 +08:00
|
|
|
cmake --build build --parallel `nproc` --target cpp_tests
|
2021-12-31 12:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_osx()
|
|
|
|
{
|
2022-11-01 06:48:57 +08:00
|
|
|
cmake -S . -B build -GXcode -DCMAKE_OSX_ARCHITECTURES=$BUILD_ARCH -DAX_ENABLE_EXT_IMGUI=ON -DAX_ENABLE_EXT_EFFEKSEER=ON -DAX_USE_ALSOFT=ON
|
2022-12-12 02:23:39 +08:00
|
|
|
cmake --build build --parallel --config Release --target cpp_tests -- -quiet
|
2021-12-31 12:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_ios()
|
|
|
|
{
|
2022-11-01 06:48:57 +08:00
|
|
|
cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR64 -DENABLE_ARC=OFF -DDEPLOYMENT_TARGET=11.0 -DAX_ENABLE_EXT_EFFEKSEER=ON -DAX_USE_ALSOFT=ON
|
2022-12-12 02:23:39 +08:00
|
|
|
cmake --build build --parallel --config Release --target cpp_tests -- -quiet -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)"
|
2022-09-05 14:13:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_tvos()
|
|
|
|
{
|
2022-11-01 18:23:27 +08:00
|
|
|
cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR_TVOS -DENABLE_ARC=OFF -DDEPLOYMENT_TARGET=14.5 -DAX_ENABLE_EXT_EFFEKSEER=ON -DAX_USE_ALSOFT=ON
|
2022-12-12 02:23:39 +08:00
|
|
|
cmake --build build --parallel --config Release --target cpp_tests -- -quiet -destination "platform=tvOS Simulator,name=Apple TV Simulator"
|
2021-12-31 12:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_android()
|
|
|
|
{
|
2022-01-28 15:01:42 +08:00
|
|
|
# print jdk detail
|
|
|
|
echo "JAVA_HOME=$JAVA_HOME"
|
|
|
|
java -version
|
2022-09-05 14:13:52 +08:00
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
# Build all samples
|
|
|
|
echo "Building Android samples ..."
|
|
|
|
|
2022-05-23 21:55:30 +08:00
|
|
|
# build fairygui_tests
|
2022-08-29 20:51:22 +08:00
|
|
|
pushd $AX_ROOT/tests/fairygui-tests/proj.android
|
2023-02-18 11:26:37 +08:00
|
|
|
do_retry ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake -PPROP_APP_ABI=$BUILD_ARCH -PRELEASE_STORE_FILE=$AX_ROOT/tools/unix-ci/axmol-ci.jks -PRELEASE_STORE_PASSWORD=axmol-ci -PRELEASE_KEY_ALIAS=axmol-ci -PRELEASE_KEY_PASSWORD=axmol-ci --parallel --info
|
2022-01-08 00:08:12 +08:00
|
|
|
popd
|
|
|
|
|
2022-05-23 21:55:30 +08:00
|
|
|
# build cpp_tests
|
2022-08-29 20:51:22 +08:00
|
|
|
pushd $AX_ROOT/tests/cpp-tests/proj.android
|
2023-02-18 11:26:37 +08:00
|
|
|
do_retry ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake -PPROP_APP_ABI=$BUILD_ARCH -PAX_ENABLE_EXT_EFFEKSEER=ON -PRELEASE_STORE_FILE=$AX_ROOT/tools/unix-ci/axmol-ci.jks -PRELEASE_STORE_PASSWORD=axmol-ci -PRELEASE_KEY_ALIAS=axmol-ci -PRELEASE_KEY_PASSWORD=axmol-ci --parallel --info
|
2021-12-31 12:12:40 +08:00
|
|
|
popd
|
2023-01-12 13:04:38 +08:00
|
|
|
|
|
|
|
# build cpp-template-default, template project not adapte to build in engine directory for android, so needs export env AX_ROOT
|
|
|
|
export AX_ROOT=$AX_ROOT
|
|
|
|
pushd $AX_ROOT/templates/cpp-template-default/proj.android
|
2023-02-18 11:26:37 +08:00
|
|
|
do_retry ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake -PPROP_APP_ABI=$BUILD_ARCH -PAX_ENABLE_EXT_EFFEKSEER=ON -PRELEASE_STORE_FILE=$AX_ROOT/tools/unix-ci/axmol-ci.jks -PRELEASE_STORE_PASSWORD=axmol-ci -PRELEASE_KEY_ALIAS=axmol-ci -PRELEASE_KEY_PASSWORD=axmol-ci --parallel --info
|
2023-01-12 13:04:38 +08:00
|
|
|
popd
|
2021-12-31 12:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_build()
|
|
|
|
{
|
2022-12-12 02:23:39 +08:00
|
|
|
set -x
|
|
|
|
cd $AX_ROOT
|
2021-12-31 12:12:40 +08:00
|
|
|
echo "Building..."
|
2022-09-05 14:13:52 +08:00
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
if [ $BUILD_TARGET == 'osx' ]; then
|
|
|
|
build_osx
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $BUILD_TARGET == 'ios' ]; then
|
|
|
|
build_ios
|
|
|
|
fi
|
|
|
|
|
2022-09-05 14:13:52 +08:00
|
|
|
if [ $BUILD_TARGET == 'tvos' ]; then
|
|
|
|
build_tvos
|
|
|
|
fi
|
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
if [ $BUILD_TARGET == 'linux' ]; then
|
|
|
|
build_linux
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $BUILD_TARGET == 'android' ]; then
|
|
|
|
build_android
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
run_build
|
|
|
|
|