Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: add Spine 4.1 runtime and build target support

esengine464e80d58177
diff --git a/.gitmodules b/.gitmodules
index 7a0f163d3..936a2135c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -23,3 +23,7 @@
[submodule "third_party/box2d"]
path = third_party/box2d
url = https://github.com/erincatto/box2d.git
+[submodule "third_party/spine-runtimes-4.1"]
+ path = third_party/spine-runtimes-4.1
+ url = https://github.com/EsotericSoftware/spine-runtimes.git
+ branch = 4.1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd51e030c..4960f1e47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -352,6 +352,26 @@ html,body{width:100%;height:100%;overflow:hidden;background:#1a1a1a}
)
endif()
+ # Spine 4.1 standalone module (spine-c)
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes-4.1")
+ file(GLOB_RECURSE SPINE41_MODULE_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes-4.1/spine-c/spine-c/src/spine/*.c"
+ )
+ add_executable(spine_module_41
+ src/esengine/bindings/SpineModuleEntry.cpp
+ ${SPINE41_MODULE_SOURCES}
+ )
+ target_include_directories(spine_module_41 PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes-4.1/spine-c/spine-c/include
+ )
+ target_compile_definitions(spine_module_41 PRIVATE ES_SPINE_41)
+ es_apply_spine_module_settings(spine_module_41)
+ set_target_properties(spine_module_41 PROPERTIES
+ OUTPUT_NAME "spine41"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdk"
+ )
+ endif()
+
# Spine 3.8 standalone module (spine-c)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/spine-runtimes-3.8")
file(GLOB_RECURSE SPINE38_MODULE_SOURCES
diff --git a/build-tools/build.config.js b/build-tools/build.config.js
index 473006a40..b11718819 100644
--- a/build-tools/build.config.js
+++ b/build-tools/build.config.js
@@ -92,6 +92,15 @@ export default {
'sdk/spine38.wasm': 'wasm/web/spine38.wasm',
},
},
+ spine41: {
+ buildDir: 'build-web',
+ cmakeFlags: ['-DES_BUILD_WEB=ON', '-DES_BUILD_TESTS=OFF'],
+ targets: ['spine_module_41'],
+ outputs: {
+ 'sdk/spine41.js': 'wasm/web/spine41.js',
+ 'sdk/spine41.wasm': 'wasm/web/spine41.wasm',
+ },
+ },
},
sdk: {
diff --git a/build-tools/cli.js b/build-tools/cli.js
index f4859dbe8..ce8f87f42 100644
--- a/build-tools/cli.js
+++ b/build-tools/cli.js
@@ -40,7 +40,7 @@ program
const isDebug = options.debug && !options.release;
const targets = options.target === 'all'
- ? ['web', 'wechat', 'playable', 'spine', 'spine38', 'physics']
+ ? ['web', 'wechat', 'playable', 'spine', 'spine38', 'spine41', 'physics']
: [options.target];
if (options.clean) {
diff --git a/third_party/spine-runtimes-4.1 b/third_party/spine-runtimes-4.1
new file mode 160000
index 000000000..cf041d5c3
--- /dev/null
+++ b/third_party/spine-runtimes-4.1
@@ -0,0 +1 @@
+Subproject commit cf041d5c38779bec8d12b074104dcd8f860b9ef2