diff --git a/spine-c/Dockerfile b/spine-c/Dockerfile new file mode 100644 index 000000000..0a00710e8 --- /dev/null +++ b/spine-c/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:24.04 + +# Install build dependencies for spine-c +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + ninja-build \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /workspace + +# Default command +CMD ["bash"] \ No newline at end of file diff --git a/spine-c/build-docker.sh b/spine-c/build-docker.sh new file mode 100755 index 000000000..055eb9f8d --- /dev/null +++ b/spine-c/build-docker.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +# Get to the script's directory +cd "$(dirname "$0")" + +# Build Docker image if it doesn't exist or if Dockerfile changed +IMAGE_NAME="spine-c-build" +if ! docker images | grep -q "$IMAGE_NAME" || [ Dockerfile -nt .docker-built ]; then + echo "Building Docker image for spine-c..." + docker build -t "$IMAGE_NAME" . + touch .docker-built +fi + +# Clean build directory to avoid platform conflicts +if [ -d "build" ]; then + echo "Cleaning build directory to avoid platform conflicts..." + rm -rf build +fi + +# Run the build in Docker +echo "Building spine-c in Docker container..." +docker run --rm \ + -v "$(cd .. && pwd)":/workspace \ + -w /workspace/spine-c \ + "$IMAGE_NAME" \ + ./build.sh "$@" \ No newline at end of file diff --git a/spine-c/src/base.h b/spine-c/src/base.h index 13005ecd8..1ef952567 100644 --- a/spine-c/src/base.h +++ b/spine-c/src/base.h @@ -56,11 +56,32 @@ #endif #endif -#define SPINE_OPAQUE_TYPE(name) \ - typedef struct name##_wrapper { \ - char _dummy; \ - } name##_wrapper; \ +#if defined(__clang__) +/* Clang needs to suppress both pedantic and C/C++ compatibility warnings */ +#define SPINE_OPAQUE_TYPE(name) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wpedantic\"") \ + _Pragma("clang diagnostic ignored \"-Wextern-c-compat\"") \ + typedef struct name##_wrapper { \ + } name##_wrapper; \ + _Pragma("clang diagnostic pop") \ typedef name##_wrapper *name; +#elif defined(__GNUC__) +/* GCC only needs to suppress pedantic warning */ +#define SPINE_OPAQUE_TYPE(name) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + typedef struct name##_wrapper { \ + } name##_wrapper; \ + _Pragma("GCC diagnostic pop") \ + typedef name##_wrapper *name; +#else +/* Other compilers - generic version */ +#define SPINE_OPAQUE_TYPE(name) \ + typedef struct name##_wrapper { \ + } name##_wrapper; \ + typedef name##_wrapper *name; +#endif typedef long long spine_property_id; diff --git a/spine-cpp/include/spine/Array.h b/spine-cpp/include/spine/Array.h index e19037db8..4f01d3431 100644 --- a/spine-cpp/include/spine/Array.h +++ b/spine-cpp/include/spine/Array.h @@ -80,7 +80,6 @@ namespace spine { } inline Array &setSize(size_t newSize, const T &defaultValue) { - assert(newSize >= 0); size_t oldSize = _size; _size = newSize; if (_capacity < newSize) { diff --git a/spine-cpp/src/spine/BonePose.cpp b/spine-cpp/src/spine/BonePose.cpp index f6ef56f1e..d065ac2bf 100644 --- a/spine-cpp/src/spine/BonePose.cpp +++ b/spine-cpp/src/spine/BonePose.cpp @@ -133,7 +133,7 @@ void BonePose::updateWorldTransform(Skeleton &skeleton) { za *= s; zc *= s; s = MathUtil::sqrt(za * za + zc * zc); - if (_inherit == Inherit_NoScale && (pa * pd - pb * pc < 0) != (skeleton.getScaleX() < 0 != skeleton.getScaleY() < 0)) s = -s; + if (_inherit == Inherit_NoScale && (pa * pd - pb * pc < 0) != ((skeleton.getScaleX() < 0) != (skeleton.getScaleY() < 0))) s = -s; r = MathUtil::Pi / 2 + MathUtil::atan2(zc, za); float zb = MathUtil::cos(r) * s; float zd = MathUtil::sin(r) * s; @@ -207,7 +207,7 @@ void BonePose::updateLocalTransform(Skeleton &skeleton) { pa *= s; pc *= s; s = MathUtil::sqrt(pa * pa + pc * pc); - if (_inherit == Inherit_NoScale && pid < 0 != (skeleton.getScaleX() < 0 != skeleton.getScaleY() < 0)) s = -s; + if (_inherit == Inherit_NoScale && (pid < 0) != ((skeleton.getScaleX() < 0) != (skeleton.getScaleY() < 0))) s = -s; r = MathUtil::Pi / 2 + MathUtil::atan2(pc, pa); pb = MathUtil::cos(r) * s; pd = MathUtil::sin(r) * s;