Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support spine version 4.2 #18325

Merged
merged 36 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1c5b10f
fix conflict
bofeng-song Feb 14, 2025
d6b23cc
refine
bofeng-song Feb 13, 2025
06dd647
refine
bofeng-song Feb 13, 2025
e42be0e
support generate spine 3.8 & 4.2
bofeng-song Feb 14, 2025
6956eea
refine
bofeng-song Feb 14, 2025
9574010
refine
bofeng-song Feb 14, 2025
9a716ad
refine
bofeng-song Feb 14, 2025
3d507a2
Temp fix spine ci (#15)
dumganhar Feb 17, 2025
15fe258
refine
bofeng-song Feb 17, 2025
53f4731
refine
bofeng-song Feb 17, 2025
485bd64
Fix ci (#16)
dumganhar Feb 18, 2025
d52cc8e
refine
bofeng-song Feb 18, 2025
e14ca2b
refine
bofeng-song Feb 18, 2025
683bd1b
refine
bofeng-song Feb 18, 2025
cf4e045
refine
bofeng-song Feb 18, 2025
1ae167c
refine
bofeng-song Feb 18, 2025
1d7db1e
Update web-npm_test.yml (#17)
dumganhar Feb 18, 2025
556ec2b
Update web-npm_test.yml (#18)
dumganhar Feb 18, 2025
f66792d
Fix spine is not defined & _overrideSpineDefine is not defined
bofeng-song Feb 20, 2025
e5f50f6
Declare spine_version at spine's namespace
bofeng-song Feb 20, 2025
7e3a887
Fix reassignmenet while build
bofeng-song Feb 21, 2025
26c9e9f
refine
bofeng-song Feb 21, 2025
4a550f4
Fix 'run test' error
bofeng-song Feb 21, 2025
4229269
Fix 'spine' is not a valid feature
bofeng-song Feb 21, 2025
5f8988c
CI change: enable spine on window platform ci
bofeng-song Feb 21, 2025
19847ec
Spine::Vector does not support range loop
bofeng-song Feb 21, 2025
04a9acb
Update external's version
bofeng-song Feb 24, 2025
3abf8b4
refine
bofeng-song Feb 24, 2025
11bae24
Merge branch 'v3.8.6' of github.com:cocos/cocos-engine into spine-42
bofeng-song Feb 25, 2025
d93aa95
Implement the waitForSpineWasmInstantiation interface in a separate f…
bofeng-song Feb 25, 2025
efe7dc4
Use export (#19)
dumganhar Feb 26, 2025
7161cf2
refine
bofeng-song Feb 26, 2025
723169e
refine
bofeng-song Feb 26, 2025
98939f2
Fix build error
bofeng-song Feb 26, 2025
4587aec
Fix SPINE_VERSION is not defined on native plafform
bofeng-song Feb 26, 2025
929b42c
refine
bofeng-song Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/native-compile-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:
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
Expand Down Expand Up @@ -193,6 +191,8 @@ jobs:
echo "set(USE_BOX2D_JSB 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(USE_SPINE_3_8 OFF)" >> build-android/proj/cfg.cmake
echo "set(USE_SPINE_4_2 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

Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/package-size-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if (args.length == 0) {
console.error('Please specify the engine root path');
process.exit(1);
}
const engineRoot = args[0];

const engineRoot = args[0];
console.log(`Engine root: ${engineRoot}`);

const features2DCommon = [
Expand All @@ -30,7 +30,8 @@ const features2DCommon = [
"physics-2d-box2d-wasm",
"profiler",
"rich-text",
"spine",
"spine", // Old version uses 'spine' feature
"spine-3.8", // New version uses 'spine-xxx' feature
"tiled-map",
"tween",
"ui",
Expand Down Expand Up @@ -115,13 +116,24 @@ async function buildEngineForFeatures(options) {
const excludeFeatures = [
'vendor-google',
'xr',
'spine-3.8',
'spine-4.2',
];

const allFeatures = statsQuery.getFeatures().filter(feature => !excludeFeatures.includes(feature));
console.log(`all features: [ ${allFeatures.join(', ')} ]`);
const allFeaturesForWeChat = [...allFeatures, 'spine-3.8'];
let allFeaturesForWeb = [...allFeatures, 'spine-4.2'];

if (!fs.pathExistsSync(ps.join(engineRoot, 'cocos', 'spine', 'lib', 'spine-version-4.2.ts'))) {
console.log(`Doesn't found spine-version-4.2.ts`);
allFeaturesForWeb = allFeaturesForWeChat;
} else {
console.log(`Found spine-version-4.2.ts`);
}

await buildEngineForFeatures({
features: allFeatures,
features: allFeaturesForWeChat,
outDir: ps.join(engineRoot, 'build-cc-out-all'),
noDeprecatedFeatures: false,
platform: "WECHAT",
Expand All @@ -130,7 +142,7 @@ async function buildEngineForFeatures(options) {
});

await buildEngineForFeatures({
features: allFeatures,
features: allFeaturesForWeb,
outDir: ps.join(engineRoot, 'build-cc-out-all-web'),
noDeprecatedFeatures: false,
platform: "HTML5",
Expand Down
201 changes: 155 additions & 46 deletions .github/workflows/web-interface-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ jobs:
echo "HEAD LOG:"
git --no-pager log -3

- name: Check for SPINE_VERSION in CMakeLists.txt (BASE)
run: |
cd ./engine/native/cocos/editor-support/spine-wasm
if grep -q "SPINE_VERSION" CMakeLists.txt; then
echo "FOUND_SPINE_VERSION_BASE=true"
echo "FOUND_SPINE_VERSION_BASE=true" >> $GITHUB_ENV
else
echo "FOUND_SPINE_VERSION_BASE=false"
echo "FOUND_SPINE_VERSION_BASE=false" >> $GITHUB_ENV
fi

- run: |
echo "EXT_VERSION=$(node ./engine/.github/workflows/get-native-external-version.js)" >> $GITHUB_ENV

Expand All @@ -116,41 +127,94 @@ jobs:
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp

- name: Build Spine WASM (BASE)
run: |
cd ./engine/native/cocos/editor-support/spine-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l

- name: Build Spine ASMJS (BASE)
run: |
cd ./engine/native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l
# - name: Build Spine 3.8 WASM (BASE)
# run: |
# cd ./engine/native/cocos/editor-support/spine-wasm
# rm -rf build-wasm
# mkdir build-wasm
# cd build-wasm
# emcmake cmake .. -GNinja
# ninja
# ls -l

# - name: Build Spine 3.8 ASMJS (BASE)
# run: |
# cd ./engine/native/cocos/editor-support/spine-wasm
# sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
# rm -rf build-asmjs
# mkdir build-asmjs
# cd build-asmjs
# emcmake cmake .. -GNinja
# ninja
# ls -l

- name: Copy files to external directory (BASE)
run: |
rm -rf dist
mkdir dist
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
echo "-------- Before replace spine wasm -----------"
ls -l ./engine/native/external/emscripten/spine/
cp -f ./dist/* ./engine/native/external/emscripten/spine/
echo "-------- After replace spine wasm ------------"
ls -l ./engine/native/external/emscripten/spine/
echo "-----------------------------------------------"
cd ./engine/native/external
git status
# - name: Copy Spine 3.8 files to external directory (BASE)
# run: |
# if [[ $FOUND_SPINE_VERSION_BASE ]]; then
# SPINE_VERSION="3.8"
# fi
# DIST_PATH="dist/3.8"
# rm -rf $DIST_PATH
# mkdir -p $DIST_PATH
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
# mkdir -p ./engine/native/external/emscripten/spine/$SPINE_VERSION
# echo "-------- Before replace spine wasm -----------"
# ls -l ./engine/native/external/emscripten/spine/$SPINE_VERSION
# cp -f ./$DIST_PATH/* ./engine/native/external/emscripten/spine/$SPINE_VERSION
# echo "-------- After replace spine wasm ------------"
# ls -l ./engine/native/external/emscripten/spine/$SPINE_VERSION
# echo "-----------------------------------------------"
# cd ./engine/native/external
# git status

# - name: Build Spine 4.2 WASM (BASE)
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
# run: |
# cd ./engine/native/cocos/editor-support/spine-wasm
# sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
# sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
# rm -rf build-wasm
# mkdir build-wasm
# cd build-wasm
# emcmake cmake .. -GNinja
# ninja
# ls -l

# - name: Build Spine 4.2 ASMJS (BASE)
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
# run: |
# cd ./engine/native/cocos/editor-support/spine-wasm
# sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
# sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
# rm -rf build-asmjs
# mkdir build-asmjs
# cd build-asmjs
# emcmake cmake .. -GNinja
# ninja
# ls -l

# - name: Copy Spine 4.2 files to external directory (BASE)
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
# run: |
# DIST_PATH="dist/4.2"
# rm -rf $DIST_PATH
# mkdir -p $DIST_PATH
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
# mkdir -p ./engine/native/external/emscripten/spine/4.2/
# echo "-------- Before replace spine wasm -----------"
# ls -l ./engine/native/external/emscripten/spine/4.2/
# cp -f ./$DIST_PATH/* ./engine/native/external/emscripten/spine/4.2/
# echo "-------- After replace spine wasm ------------"
# ls -l ./engine/native/external/emscripten/spine/4.2/
# echo "-----------------------------------------------"
# cd ./engine/native/external
# git status

- name: Build Base Declarations
working-directory: .
Expand Down Expand Up @@ -195,38 +259,83 @@ jobs:
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp

- name: Build Spine WASM (HEAD)
- name: Build Spine 3.8 WASM (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l

- name: Build Spine 3.8 ASMJS (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l

- name: Copy Spine 3.8 files to external directory (HEAD)
run: |
DIST_PATH="dist/3.8"
rm -rf $DIST_PATH
mkdir -p $DIST_PATH
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
echo "-------- Before replace spine wasm -----------"
mkdir -p ./engine-HEAD/native/external/emscripten/spine/3.8
ls -l ./engine-HEAD/native/external/emscripten/spine/3.8
cp -f ./$DIST_PATH/* ./engine-HEAD/native/external/emscripten/spine/3.8
echo "-------- After replace spine wasm ------------"
ls -l ./engine-HEAD/native/external/emscripten/spine/3.8
echo "-----------------------------------------------"
cd ./engine-HEAD/native/external
git status

- name: Build Spine 4.2 WASM (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
rm -rf build-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l

- name: Build Spine ASMJS (HEAD)
- name: Build Spine 4.2 ASMJS (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
rm -rf build-asmjs
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l

- name: Copy files to external directory (HEAD)
- name: Copy Spine 4.2 files to external directory (HEAD)
run: |
rm -rf dist
mkdir dist
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
DIST_PATH="dist/4.2"
rm -rf $DIST_PATH
mkdir -p $DIST_PATH
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
echo "-------- Before replace spine wasm -----------"
ls -l ./engine-HEAD/native/external/emscripten/spine/
cp -f ./dist/* ./engine-HEAD/native/external/emscripten/spine/
mkdir -p ./engine-HEAD/native/external/emscripten/spine/4.2/
ls -l ./engine-HEAD/native/external/emscripten/spine/4.2/
cp -f ./$DIST_PATH/* ./engine-HEAD/native/external/emscripten/spine/4.2/
echo "-------- After replace spine wasm ------------"
ls -l ./engine-HEAD/native/external/emscripten/spine/
ls -l ./engine-HEAD/native/external/emscripten/spine/4.2/
echo "-----------------------------------------------"
cd ./engine-HEAD/native/external
git status
Expand Down
Loading
Loading