Skip to content

Commit cac3383

Browse files
committed
[godot] Fix compile_commands.json generation on Ubuntu without X11
The setup.sh script was always trying to generate compile_commands.json for IDE integration, which triggered SCons platform auto-detection. On Ubuntu runners without X11 libraries (used for Android/Web builds), this caused the build to fail. Changes: - Only generate compile_commands.json in dev mode (CI uses dev=false) - Explicitly specify the platform parameter for SCons - On Linux, check if X11 libraries are available before attempting generation - Skip generation gracefully if X11 is not available This fixes the Android and Web template builds in GitHub Actions.
1 parent ad18e2e commit cac3383

File tree

1 file changed

+37
-21
lines changed

1 file changed

+37
-21
lines changed

spine-godot/build/setup.sh

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,47 @@ fi
7272

7373
popd
7474

75-
# Generate compile_commands.json for IDE integration
76-
echo "Generating compile_commands.json for IDE integration..."
77-
pushd ../godot > /dev/null
78-
79-
# Detect architecture for macOS
80-
arch=""
81-
if [[ "$OSTYPE" == "darwin"* ]]; then
82-
if [ `uname -m` == "arm64" ]; then
83-
arch="arch=arm64"
75+
# Generate compile_commands.json for IDE integration (only in dev mode)
76+
if [ $dev = "true" ]; then
77+
echo "Generating compile_commands.json for IDE integration..."
78+
pushd ../godot > /dev/null
79+
80+
# Detect architecture for macOS
81+
arch=""
82+
platform=""
83+
if [[ "$OSTYPE" == "darwin"* ]]; then
84+
if [ `uname -m` == "arm64" ]; then
85+
arch="arch=arm64"
86+
else
87+
arch="arch=x86_64"
88+
fi
89+
platform="platform=osx"
90+
elif [[ "$OSTYPE" == "msys"* ]] || [[ "$OSTYPE" == "win32"* ]]; then
91+
platform="platform=windows"
8492
else
85-
arch="arch=x86_64"
93+
# Linux - only generate if X11 dev libraries are available
94+
if pkg-config --exists x11 2>/dev/null; then
95+
platform="platform=x11"
96+
else
97+
echo "Skipping compile_commands.json generation (X11 libraries not available)"
98+
popd > /dev/null
99+
popd > /dev/null
100+
exit 0
101+
fi
86102
fi
87-
fi
88103

89-
# Generate compilation database without building
90-
scons compiledb=yes custom_modules="../spine_godot" opengl3=yes $arch compiledb
104+
# Generate compilation database without building
105+
scons compiledb=yes custom_modules="../spine_godot" opengl3=yes $platform $arch compiledb
91106

92-
# Copy to parent directory for easy IDE access
93-
if [ -f compile_commands.json ]; then
94-
cp compile_commands.json ..
95-
echo "compile_commands.json generated successfully and copied to spine-godot/"
96-
else
97-
echo "Warning: Failed to generate compile_commands.json"
98-
fi
107+
# Copy to parent directory for easy IDE access
108+
if [ -f compile_commands.json ]; then
109+
cp compile_commands.json ..
110+
echo "compile_commands.json generated successfully and copied to spine-godot/"
111+
else
112+
echo "Warning: Failed to generate compile_commands.json"
113+
fi
99114

100-
popd > /dev/null
115+
popd > /dev/null
116+
fi
101117

102118
popd > /dev/null

0 commit comments

Comments
 (0)