mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[cpp] Docker build for GCC testing, minor GCC fixes
This commit is contained in:
parent
e162835c31
commit
f9fefee0c8
15
spine-c/Dockerfile
Normal file
15
spine-c/Dockerfile
Normal file
@ -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"]
|
||||||
28
spine-c/build-docker.sh
Executable file
28
spine-c/build-docker.sh
Executable file
@ -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 "$@"
|
||||||
@ -56,11 +56,32 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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) \
|
#define SPINE_OPAQUE_TYPE(name) \
|
||||||
typedef struct name##_wrapper { \
|
typedef struct name##_wrapper { \
|
||||||
char _dummy; \
|
|
||||||
} name##_wrapper; \
|
} name##_wrapper; \
|
||||||
typedef name##_wrapper *name;
|
typedef name##_wrapper *name;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef long long spine_property_id;
|
typedef long long spine_property_id;
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,6 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline Array<T> &setSize(size_t newSize, const T &defaultValue) {
|
inline Array<T> &setSize(size_t newSize, const T &defaultValue) {
|
||||||
assert(newSize >= 0);
|
|
||||||
size_t oldSize = _size;
|
size_t oldSize = _size;
|
||||||
_size = newSize;
|
_size = newSize;
|
||||||
if (_capacity < newSize) {
|
if (_capacity < newSize) {
|
||||||
|
|||||||
@ -133,7 +133,7 @@ void BonePose::updateWorldTransform(Skeleton &skeleton) {
|
|||||||
za *= s;
|
za *= s;
|
||||||
zc *= s;
|
zc *= s;
|
||||||
s = MathUtil::sqrt(za * za + zc * zc);
|
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);
|
r = MathUtil::Pi / 2 + MathUtil::atan2(zc, za);
|
||||||
float zb = MathUtil::cos(r) * s;
|
float zb = MathUtil::cos(r) * s;
|
||||||
float zd = MathUtil::sin(r) * s;
|
float zd = MathUtil::sin(r) * s;
|
||||||
@ -207,7 +207,7 @@ void BonePose::updateLocalTransform(Skeleton &skeleton) {
|
|||||||
pa *= s;
|
pa *= s;
|
||||||
pc *= s;
|
pc *= s;
|
||||||
s = MathUtil::sqrt(pa * pa + pc * pc);
|
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);
|
r = MathUtil::Pi / 2 + MathUtil::atan2(pc, pa);
|
||||||
pb = MathUtil::cos(r) * s;
|
pb = MathUtil::cos(r) * s;
|
||||||
pd = MathUtil::sin(r) * s;
|
pd = MathUtil::sin(r) * s;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user