Emu/test_compile.sh

55 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Test compilation script - checks if code compiles without creating object files
# Uses -fsyntax-only flag to only check syntax without generating output
echo "Testing compilation of EQStreamFactory with std::condition_variable..."
# Compiler settings (matching makefile)
CC="g++"
DFLAGS="-DEQ2 -DLOGIN"
WFLAGS="-Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wcomment -Wcast-align -Wno-deprecated"
COPTS="$WFLAGS -march=native -pthread -pipe -DFX -D_GNU_SOURCE -DINVERSEXY $DFLAGS -I/usr/include/mysql -I/usr/local/include/boost -I/usr/include/lua5.4 -std=c++17"
# Test EQStreamFactory.cpp compilation
echo "Checking EQStreamFactory.cpp..."
$CC -fsyntax-only $COPTS source/common/EQStreamFactory.cpp 2>&1
if [ $? -eq 0 ]; then
echo "✓ EQStreamFactory.cpp compiles successfully"
else
echo "✗ EQStreamFactory.cpp compilation failed"
exit 1
fi
# Test EQStreamFactory.h inclusion
echo "Checking EQStreamFactory.h..."
echo '#include "source/common/EQStreamFactory.h"' | $CC -fsyntax-only $COPTS -x c++ - 2>&1
if [ $? -eq 0 ]; then
echo "✓ EQStreamFactory.h compiles successfully"
else
echo "✗ EQStreamFactory.h compilation failed"
exit 1
fi
# Test files that previously included Condition.h
echo "Checking dbcore.h..."
echo '#include "source/common/dbcore.h"' | $CC -fsyntax-only $COPTS -x c++ - 2>&1
if [ $? -eq 0 ]; then
echo "✓ dbcore.h compiles successfully"
else
echo "✗ dbcore.h compilation failed"
exit 1
fi
echo "Checking EQStream.h..."
echo '#include "source/common/EQStream.h"' | $CC -fsyntax-only $COPTS -x c++ - 2>&1
if [ $? -eq 0 ]; then
echo "✓ EQStream.h compiles successfully"
else
echo "✗ EQStream.h compilation failed"
exit 1
fi
echo ""
echo "All compilation tests passed! The Condition class has been successfully replaced with std::condition_variable."
echo "Note: Condition.h and Condition.cpp files can now be safely removed from the project."