Fix audio load error on TaoBao-MiniGame platform #7422
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: <Native> Compile | |
on: | |
pull_request: | |
paths: | |
- 'templates/**' | |
- 'native/**' | |
- '.github/workflows/native-compile-platforms.yml' | |
# github.head_ref is only defined on pull_request events | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
compile_windows: | |
name: "Windows" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- name: Install deps | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: 1.2.189.0 | |
vulkan-components: Vulkan-Headers, Vulkan-Loader | |
vulkan-use-cache: true | |
- name: Compile win64 | |
shell: bash | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
cd $GITHUB_WORKSPACE/templates/windows | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake | |
mkdir -p build-win64/proj | |
touch build-win64/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 ON)" >> build-win64/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN ON)" >> build-win64/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 ON)" >> build-win64/proj/cfg.cmake | |
echo "set(USE_SPINE OFF)" >> build-win64/proj/cfg.cmake | |
echo "set(USE_DRAGONBONES OFF)" >> build-win64/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER ON)" >> build-win64/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-win64/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-win64/proj/cfg.cmake | |
mkdir build-win64/assets | |
cd build-win64 | |
RES_DIR=${GITHUB_WORKSPACE//\\//}/templates/windows/build-win64 | |
COCOS_X_PATH=${GITHUB_WORKSPACE//\\//}/native | |
cmake ../ -G"Visual Studio 16 2019" -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS_X_PATH -Ax64 | |
cmake --build . --config Release | |
echo "Compile Win64 Release Done!" | |
compile_android_minimal: | |
name: "Android Minimal" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
add-to-path: false | |
local-cache: true | |
- uses: actions/setup-java@v4 | |
id: setup-jdk | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} | |
NATIVE_DIR=$GITHUB_WORKSPACE/templates/android-template | |
echo "Compiling Android ... " | |
cd $GITHUB_WORKSPACE/templates/ | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> android/template/Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> android/template/Post-Sample.cmake | |
if [ ! -d android-template ]; then | |
cp -r android/template android-template | |
fi | |
cd $GITHUB_WORKSPACE/templates/android/build | |
mkdir -p build-android/proj | |
touch build-android/proj/cfg.cmake | |
echo "set(CI_FORCE_MINIMAL_FEATURES ON)" >> build-android/proj/cfg.cmake | |
echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-android/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-android/proj/cfg.cmake | |
mkdir -p build-android/proj/res/values | |
cat << EOF > build-android/proj/res/values/strings.xml | |
<resources> | |
<string name="app_name" translatable="false">CocosGame</string> | |
</resources> | |
EOF | |
mkdir -p build-android/assets | |
ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ | |
sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDROID_NDK@g" gradle.properties | |
sed -i "s@^APPLICATION_ID.*@APPLICATION_ID=com.cocos.android@g" gradle.properties | |
sed -i "s@^RES_PATH.*@RES_PATH=$ASSET_DIR@g" gradle.properties | |
sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$NATIVE_ROOT@g" gradle.properties | |
sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" gradle.properties | |
# To speedup CI, compile x86 only | |
# sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties | |
sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=x86@g" gradle.properties | |
echo "Compile Android - cmake ..." | |
echo "ANDROID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" | |
# ./gradlew :CocosGame:assembleDebug --quiet | |
./gradlew :CocosGame:assembleRelease --quiet | |
echo "Compile Android Debug Done!" | |
compile_android: | |
name: "Android" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Before free space | |
run: | | |
df -h | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@d5af243ce7bacb67384aa6c5b1fc5f169e30903e | |
with: | |
tool-cache: true | |
android: false | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: After free space | |
run: | | |
df -h | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
add-to-path: false | |
local-cache: true | |
- uses: actions/setup-java@v4 | |
id: setup-jdk | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} | |
NATIVE_DIR=$GITHUB_WORKSPACE/templates/android-template | |
echo "Compiling Android ... " | |
cd $GITHUB_WORKSPACE/templates/ | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> android/template/Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> android/template/Post-Sample.cmake | |
if [ ! -d android-template ]; then | |
cp -r android/template android-template | |
fi | |
cd $GITHUB_WORKSPACE/templates/android/build | |
mkdir -p build-android/proj | |
touch build-android/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 ON)" >> build-android/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN ON)" >> build-android/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 ON)" >> build-android/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER ON)" >> build-android/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-android/proj/cfg.cmake | |
echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-android/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-android/proj/cfg.cmake | |
mkdir -p build-android/proj/res/values | |
cat << EOF > build-android/proj/res/values/strings.xml | |
<resources> | |
<string name="app_name" translatable="false">CocosGame</string> | |
</resources> | |
EOF | |
mkdir -p build-android/assets | |
ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ | |
sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDROID_NDK@g" gradle.properties | |
sed -i "s@^APPLICATION_ID.*@APPLICATION_ID=com.cocos.android@g" gradle.properties | |
sed -i "s@^RES_PATH.*@RES_PATH=$ASSET_DIR@g" gradle.properties | |
sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$NATIVE_ROOT@g" gradle.properties | |
sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" gradle.properties | |
# To speedup CI, compile arm64-v8a only | |
# sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties | |
df -h | |
sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=arm64-v8a@g" gradle.properties | |
echo "Compile Android - cmake ..." | |
echo "ANDROID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" | |
./gradlew :CocosGame:assembleDebug --quiet | |
df -h | |
./gradlew clean | |
sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a@g" gradle.properties | |
./gradlew :CocosGame:assembleDebug --quiet | |
df -h | |
echo "Compile Android Debug Done!" | |
compile_openharmony: | |
name: "Openharmony" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Before free space | |
run: | | |
df -h | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@d5af243ce7bacb67384aa6c5b1fc5f169e30903e | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: After free space | |
run: | | |
df -h | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- uses: actions/setup-java@v4 | |
id: setup-jdk | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Get oh sdk cache directory path | |
id: oh-sdk-cache-dir-path | |
run: | | |
echo "cache dir: " | |
echo "dir=$HOME/openharmony" >> $GITHUB_OUTPUT | |
- name: Output cache dir | |
run: | | |
echo "Output cache dir: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}" | |
- name: Cache OH SDK | |
id: cache-oh-sdk | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-oh-sdk-12 | |
with: | |
path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
# - name: Add package.json | |
# run: | | |
# echo "{}" > package.json | |
# echo "{\"name\": \"tests\",\"lockfileVersion\": 3,\"requires\": true,\"packages\": {}}" > package-lock.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 14 | |
cache: 'npm' | |
- if: ${{ steps.cache-oh-sdk.outputs.cache-hit != 'true' }} | |
name: No Cache found, install oh sdk | |
continue-on-error: false | |
run: | | |
if [ ! -d "$HOME/openharmony" ]; then | |
mkdir -p $HOME/openharmony | |
echo "Download commandline-tools-linux.zip ..." | |
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.001 | |
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.002 | |
echo "Unzip commandline-tools-linux.zip ..." | |
7z x commandline-tools-linux-x64-5.0.3.906.zip.001 -o$HOME/openharmony > /dev/null | |
cd $HOME/openharmony | |
ls -l | |
cd commandline-tools-linux-x64-5.0.3.906 | |
ls -l | |
fi | |
- name: Compile for Openharmony | |
run: | | |
which node | |
which npm | |
which java | |
node -v | |
npm -v | |
java --version | |
echo "=============== list files in oh sdk ($HOME/openharmony) ===============" | |
pushd $HOME/openharmony/commandline-tools-linux-x64-5.0.3.906 | |
ls -l | |
popd | |
export PATH=$PATH:$HOME/openharmony/commandline-tools-linux-x64-5.0.3.906/bin | |
which hvigorw | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
echo "Compiling Openharmony ... " | |
cd $GITHUB_WORKSPACE/templates/openharmony | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake | |
mkdir -p build-oh/proj | |
touch build-oh/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 ON)" >> build-oh/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN OFF)" >> build-oh/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 ON)" >> build-oh/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-oh/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-oh/proj/cfg.cmake | |
echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-oh/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-oh/proj/cfg.cmake | |
echo "set(USE_SE_V8 ON)" >> build-oh/proj/cfg.cmake | |
echo "set(USE_SE_NAPI OFF)" >> build-oh/proj/cfg.cmake | |
echo "set(USE_SE_JSVM OFF)" >> build-oh/proj/cfg.cmake | |
echo "=============== cat build-oh/proj/cfg.cmake ===============" | |
cat build-oh/proj/cfg.cmake | |
mkdir -p build-oh/assets | |
ASSET_DIR=$GITHUB_WORKSPACE/templates/openharmony/build-oh | |
echo "=============== HACK ./entry/build-profile.json5 ===============" | |
sed -i "s@[^-]DRES_DIR[^=]@$ASSET_DIR@g" ./entry/build-profile.json5 | |
sed -i "s@[^-]DCOMMON_DIR[^=]@$GITHUB_WORKSPACE/templates/common@g" ./entry/build-profile.json5 | |
# To speedup CI, compile arm64-v8a only | |
sed -i "s@\"armeabi-v7a\",@@g" ./entry/build-profile.json5 | |
echo "entry/build-profile.json5: " | |
cat ./entry/build-profile.json5 | |
# echo "=============== UPDATE ./hvigor/hvigor-config.json5 ===============" | |
# echo "{\"hvigorVersion\":\"3.0.2\",\"dependencies\":{\"@ohos/hvigor-ohos-plugin\":\"3.0.2\"}}" > ./hvigor/hvigor-config.json5 | |
echo "=============== Do not import game.ts for cocos_worker.ts ===============" | |
sed -i '/<% if(!useV8) { %>/,/<% } %>/d' ./entry/src/main/ets/workers/cocos_worker.ts | |
sed -i '/<% if(useV8) { %>/,/<% } %>/d' ./entry/src/main/ets/workers/cocos_worker.ts | |
ls -l ./entry/src/main/ets/workers/cocos_worker.ts | |
echo "=============== EXECUTE hvigorw ===============" | |
hvigorw clean -i | |
hvigorw --stop-daemon -i | |
hvigorw --mode module -p product=default assembleHap --parallel --incremental debuggable=true --no-daemon -d | |
#./hvigorw default@ProcessLibs -p debuggable=true --no-daemon -d | |
echo "=============== EXECUTE hvigorw DONE ===============" | |
compile_mac_x86_64: | |
name: "MacOS x86_64" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
echo "Compiling MacOSX ... " | |
cd $GITHUB_WORKSPACE/templates/mac | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake | |
mkdir -p build-mac/proj | |
touch build-mac/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake | |
mkdir build-mac/assets | |
RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac | |
cd build-mac | |
cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT | |
set +e | |
cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch x86_64 | |
retcode=$? | |
set -e | |
if [ $retcode -ne 0 ]; then | |
echo "-----------------------------------------------------------------------------------------------" | |
echo "------------------------------------ recompile without `-quiet` -------------------------------" | |
echo "-----------------------------------------------------------------------------------------------" | |
cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch x86_64 | |
fi | |
echo "Compile MacOSX x86_64 Release Done!" | |
compile_mac_arm64: | |
name: "MacOS arm64" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
echo "Compiling MacOSX ... " | |
cd $GITHUB_WORKSPACE/templates/mac | |
mkdir -p build-mac/proj | |
touch build-mac/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake | |
mkdir build-mac/assets | |
RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac | |
cd build-mac | |
cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT | |
set +e | |
cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64 | |
retcode=$? | |
set -e | |
if [ $retcode -ne 0 ]; then | |
echo "-----------------------------------------------------------------------------------------------" | |
echo "------------------------------------ recompile without `-quiet` -------------------------------" | |
echo "-----------------------------------------------------------------------------------------------" | |
cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch arm64 | |
fi | |
echo "Compile MacOSX ARM64 Release Done!" | |
compile_iOS: | |
name: "iOS" | |
if: | |
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download external libraries | |
shell: bash | |
run: | | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
set -x | |
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
echo "Compiling iOS ... " | |
cd $GITHUB_WORKSPACE/templates/ios | |
echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake | |
echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake | |
mkdir -p build-ios/proj | |
touch build-ios/proj/cfg.cmake | |
echo "set(CC_USE_GLES3 OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(CC_USE_METAL ON)" >> build-ios/proj/cfg.cmake | |
echo "set(TARGET_IOS_VERSION 12.0)" >> build-ios/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(USE_DRAGONBONES OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED OFF)" >> build-ios/proj/cfg.cmake | |
echo "set(MACOSX_BUNDLE_GUI_IDENTIFIER com.cocos.demo.ios)" >> build-ios/proj/cfg.cmake | |
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-ios/proj/cfg.cmake | |
mkdir build-ios/assets | |
cd build-ios | |
RES_DIR=$GITHUB_WORKSPACE/templates/ios/build-ios | |
cmake ../ -GXcode -DCMAKE_SYSTEM_NAME=iOS \ | |
-DCMAKE_OSX_SYSROOT=iphoneos \ | |
-DCMAKE_OSX_ARCHITECTURES=arm64 \ | |
-DRES_DIR=$RES_DIR \ | |
-DCOCOS_X_PATH=$NATIVE_ROOT | |
set +e | |
#cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES -allowProvisioningUpdates CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
retcode=$? | |
set -e | |
if [ $retcode -ne 0 ]; then | |
echo "-----------------------------------------------------------------------------------------------" | |
echo "------------------------------------ recompile without `-quiet` -------------------------------" | |
echo "-----------------------------------------------------------------------------------------------" | |
cmake --build . --config Debug -- -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
fi | |
echo "Compile iOS Done!" |