O3
This commit is contained in:
parent
7b73c86113
commit
6db338d79b
3 changed files with 22 additions and 6 deletions
12
compile.sh
12
compile.sh
|
|
@ -7,15 +7,23 @@ if [ "$1" = "--debug" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OPTIMIZE_FLAG=""
|
||||||
|
if [ "$1" = "--optimize" ]; then
|
||||||
|
OPTIMIZE_FLAG="-O3"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Usage: ./compile.sh [--debug] <sui_source.sui> [output_name]"
|
echo "Usage: ./compile.sh [--debug] [--optimize] <sui_source.sui> [output_name]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --debug Generate debug printf statements in the C output"
|
echo " --debug Generate debug printf statements in the C output"
|
||||||
|
echo " --optimize Compile with -O3 optimization"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " ./compile.sh tests/structs.sui"
|
echo " ./compile.sh tests/structs.sui"
|
||||||
echo " ./compile.sh --debug tests/structs.sui"
|
echo " ./compile.sh --debug tests/structs.sui"
|
||||||
|
echo " ./compile.sh --optimize tests/structs.sui"
|
||||||
echo " ./compile.sh tests/structs.sui my_program"
|
echo " ./compile.sh tests/structs.sui my_program"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -59,7 +67,7 @@ ODE_LIBS=$(pkg-config --libs ode 2>/dev/null || echo "-lode -lm")
|
||||||
|
|
||||||
# Compile C to executable with raylib and ODE support
|
# Compile C to executable with raylib and ODE support
|
||||||
echo "Compiling C code and linking with libsuicmez, raylib, and ODE..."
|
echo "Compiling C code and linking with libsuicmez, raylib, and ODE..."
|
||||||
gcc "$C_FILE" libsuicmez/libsuicmez.c libsuicmez/suicmez_gc.c $RAYLIB_CFLAGS $RAYLIB_LIBS $ODE_CFLAGS $ODE_LIBS -lm -o "$OUTPUT_BINARY" || exit 1
|
gcc $OPTIMIZE_FLAG "$C_FILE" libsuicmez/libsuicmez.c libsuicmez/suicmez_gc.c $RAYLIB_CFLAGS $RAYLIB_LIBS $ODE_CFLAGS $ODE_LIBS -lm -o "$OUTPUT_BINARY" || exit 1
|
||||||
|
|
||||||
echo "✓ Successfully created: $OUTPUT_BINARY"
|
echo "✓ Successfully created: $OUTPUT_BINARY"
|
||||||
echo " Run with: ./$OUTPUT_BINARY"
|
echo " Run with: ./$OUTPUT_BINARY"
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,23 @@ if [ "$1" = "--debug" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OPTIMIZE_FLAG=""
|
||||||
|
if [ "$1" = "--optimize" ]; then
|
||||||
|
OPTIMIZE_FLAG="-O3"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Usage: ./compile_and_run.sh [--debug] <sui_source.sui> [program_args...]"
|
echo "Usage: ./compile_and_run.sh [--debug] [--optimize] <sui_source.sui> [program_args...]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --debug Generate debug printf statements in the C output"
|
echo " --debug Generate debug printf statements in the C output"
|
||||||
|
echo " --optimize Compile with -O3 optimization"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " ./compile_and_run.sh tests/structs.sui"
|
echo " ./compile_and_run.sh tests/structs.sui"
|
||||||
echo " ./compile_and_run.sh --debug tests/structs.sui"
|
echo " ./compile_and_run.sh --debug tests/structs.sui"
|
||||||
|
echo " ./compile_and_run.sh --optimize tests/structs.sui"
|
||||||
echo " ./compile_and_run.sh tests/myprogram.sui arg1 arg2"
|
echo " ./compile_and_run.sh tests/myprogram.sui arg1 arg2"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -70,7 +78,7 @@ RAYLIB_LIBS=$(pkg-config --libs raylib 2>/dev/null || echo "-lraylib -lm")
|
||||||
ODE_CFLAGS=$(pkg-config --cflags ode 2>/dev/null || echo "-I/usr/include")
|
ODE_CFLAGS=$(pkg-config --cflags ode 2>/dev/null || echo "-I/usr/include")
|
||||||
ODE_LIBS=$(pkg-config --libs ode 2>/dev/null || echo "-lode -lm")
|
ODE_LIBS=$(pkg-config --libs ode 2>/dev/null || echo "-lode -lm")
|
||||||
|
|
||||||
if ! gcc "$C_FILE" libsuicmez/libsuicmez.c libsuicmez/suicmez_gc.c $RAYLIB_CFLAGS $RAYLIB_LIBS $ODE_CFLAGS $ODE_LIBS -lm -o "$OUTPUT_BINARY" 2>&1; then
|
if ! gcc $OPTIMIZE_FLAG "$C_FILE" libsuicmez/libsuicmez.c libsuicmez/suicmez_gc.c $RAYLIB_CFLAGS $RAYLIB_LIBS $ODE_CFLAGS $ODE_LIBS -lm -o "$OUTPUT_BINARY" 2>&1; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "✗ C compilation failed"
|
echo "✗ C compilation failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
BIN
tests/fps_game.o
BIN
tests/fps_game.o
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue