Skip to content

Commit

Permalink
[v3.8.5] Don't export spine enums in c++ since they're defined in spi…
Browse files Browse the repository at this point in the history
…ne-core.js. (#17759)
  • Loading branch information
dumganhar authored Oct 22, 2024
1 parent 3e17c0b commit 1fa8897
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 110 deletions.
4 changes: 3 additions & 1 deletion native/cocos/editor-support/spine-wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_BUILD_TYPE "MinSizeRel")

set(BUILD_WASM 1)

set(APP_NAME "spine" CACHE STRING "Project Name")
project(${APP_NAME}_wasm)

Expand All @@ -21,7 +23,7 @@ file(GLOB COCOS_ADAPTER_SRC "./*.cpp")
add_executable(${APP_NAME} ${SPINE_CORE_SRC} ${COCOS_ADAPTER_SRC} )
#add_executable(${APP_NAME} ${COCOS_ADAPTER_SRC})

set(EMS_LINK_FLAGS "-O3 -s WASM=1 -s INITIAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s DYNAMIC_EXECUTION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 \
set(EMS_LINK_FLAGS "-O3 -s WASM=${BUILD_WASM} -s INITIAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s DYNAMIC_EXECUTION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-flto --no-entry --bind -s USE_ES6_IMPORT_META=0 -s EXPORT_ES6=1 -s MODULARIZE=1 -s EXPORT_NAME='spineWasm' \
-s ENVIRONMENT=web -s FILESYSTEM=0 -s NO_EXIT_RUNTIME=1 -s LLD_REPORT_UNDEFINED \
-s MIN_SAFARI_VERSION=110000 \
Expand Down
109 changes: 0 additions & 109 deletions native/cocos/editor-support/spine-wasm/spine-type-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,119 +313,10 @@ EMSCRIPTEN_BINDINGS(spine) {
std::string stdStr(obj.buffer(), obj.length());
return stdStr; }), allow_raw_pointers());

enum_<TimelineType>("TimelineType")
.value("rotate", TimelineType_Rotate)
.value("translate", TimelineType_Translate)
.value("scale", TimelineType_Scale)
.value("shear", TimelineType_Shear)
.value("attachment", TimelineType_Attachment)
.value("color", TimelineType_Color)
.value("deform", TimelineType_Deform)
.value("event", TimelineType_Event)
.value("drawOrder", TimelineType_DrawOrder)
.value("ikConstraint", TimelineType_IkConstraint)
.value("transformConstraint", TimelineType_TransformConstraint)
.value("pathConstraintPosition", TimelineType_PathConstraintPosition)
.value("pathConstraintSpacing", TimelineType_PathConstraintSpacing)
.value("pathConstraintMix", TimelineType_PathConstraintMix)
.value("twoColor", TimelineType_TwoColor);

enum_<MixDirection>("MixDirection")
.value("mixIn", MixDirection_In)
.value("mixOut", MixDirection_Out);

enum_<MixBlend>("MixBlend")
.value("setup", MixBlend_Setup)
.value("first", MixBlend_First)
.value("replace", MixBlend_Replace)
.value("add", MixBlend_Add);

enum_<BlendMode>("BlendMode")
.value("Normal", BlendMode_Normal)
.value("Additive", BlendMode_Additive)
.value("Multiply", BlendMode_Multiply)
.value("Screen", BlendMode_Screen);

enum_<EventType>("EventType")
.value("start", EventType_Start)
.value("interrupt", EventType_Interrupt)
.value("end", EventType_End)
.value("dispose", EventType_Dispose)
.value("complete", EventType_Complete)
.value("event", EventType_Event);

enum_<TransformMode>("TransformMode")
.value("Normal", TransformMode_Normal)
.value("OnlyTranslation", TransformMode_OnlyTranslation)
.value("NoRotationOrReflection", TransformMode_NoRotationOrReflection)
.value("NoScale", TransformMode_NoScale)
.value("NoScaleOrReflection", TransformMode_NoScaleOrReflection);

enum_<PositionMode>("PositionMode")
.value("Fixed", PositionMode_Fixed)
.value("Percent", PositionMode_Percent);

enum_<SpacingMode>("SpacingMode")
.value("Length", SpacingMode_Length)
.value("Fixed", SpacingMode_Fixed)
.value("Percent", SpacingMode_Percent);

enum_<RotateMode>("RotateMode")
.value("Tangent", RotateMode_Tangent)
.value("Chain", RotateMode_Chain)
.value("ChainScale", RotateMode_ChainScale);

enum_<TextureFilter>("TextureFilter")
.value("Unknown", TextureFilter_Unknown)
.value("Nearest", TextureFilter_Nearest)
.value("Linear", TextureFilter_Linear)
.value("MipMap", TextureFilter_MipMap)
.value("MipMapNearestNearest", TextureFilter_MipMapNearestNearest)
.value("MipMapLinearNearest", TextureFilter_MipMapLinearNearest)
.value("MipMapNearestLinear", TextureFilter_MipMapNearestLinear)
.value("MipMapLinearLinear", TextureFilter_MipMapLinearLinear);

enum_<TextureWrap>("TextureWrap")
.value("MirroredRepeat", TextureWrap_MirroredRepeat)
.value("ClampToEdge", TextureWrap_ClampToEdge)
.value("Repeat", TextureWrap_Repeat);

enum_<AttachmentType>("AttachmentType")
.value("Region", AttachmentType_Region)
.value("BoundingBox", AttachmentType_Boundingbox)
.value("Mesh", AttachmentType_Mesh)
.value("LinkedMesh", AttachmentType_Linkedmesh)
.value("Path", AttachmentType_Path)
.value("Point", AttachmentType_Point)
.value("Clipping", AttachmentType_Clipping);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

class_<MathUtil>("MathUtils")
.class_property("PI", &MathUtil::Pi)
.class_property("PI2", &MathUtil::Pi_2)
.class_property("radDeg", &MathUtil::Rad_Deg)
.class_property("degreesToRadians", &MathUtil::Rad_Deg)
.class_property("degRad", &MathUtil::Deg_Rad)
.class_property("degreesToRadians", &MathUtil::Deg_Rad)
.class_function("abs", &MathUtil::abs)
.class_function("signum", &MathUtil::sign)
.class_function("clamp", &MathUtil::clamp)
.class_function("fmod", &MathUtil::fmod)
.class_function("atan2", &MathUtil::atan2)
.class_function("cos", &MathUtil::cos)
.class_function("sin", &MathUtil::sin)
.class_function("sqrt", &MathUtil::sqrt)
.class_function("acos", &MathUtil::acos)
.class_function("sinDeg", &MathUtil::sinDeg)
.class_function("cosDeg", &MathUtil::cosDeg)
.class_function("isNan", &MathUtil::isNan)
.class_function("random", &MathUtil::random)
.class_function("randomTriangular", select_overload<float(float, float)>(&MathUtil::randomTriangular))
.class_function("randomTriangularWith", select_overload<float(float, float, float)>(&MathUtil::randomTriangular))
.class_function("pow", &MathUtil::pow);

class_<Color>("Color")
.constructor<>()
.constructor<float, float, float, float>()
Expand Down

0 comments on commit 1fa8897

Please sign in to comment.