-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemcc.sh
More file actions
executable file
·34 lines (28 loc) · 850 Bytes
/
Copy pathemcc.sh
File metadata and controls
executable file
·34 lines (28 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Define source files
SOURCE_FILES="src/main.c src/gameState.c src/player.c src/ball.c src/brick.c src/collisions.c src/colors.c src/window.c"
# Define output file
OUTPUT="index.html"
# Define raylib paths
RAYLIB_INCLUDE_PATH="$HOME/raylib/src" # Path to raylib.h
RAYLIB_LIBRARY_PATH="$HOME/raylib/build-web/raylib" # Path to libraylib.a
# Compiler flags
EMCC_FLAGS=(
-o "$OUTPUT"
-s USE_GLFW=3
-s FULL_ES2=1
-s ASYNCIFY=1
-s "EXPORTED_FUNCTIONS=['_main']"
-s "EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']"
-I"$RAYLIB_INCLUDE_PATH"
-L"$RAYLIB_LIBRARY_PATH"
-lraylib
)
# Compile the project
emcc $SOURCE_FILES "${EMCC_FLAGS[@]}"
# Print completion message
if [ $? -eq 0 ]; then
echo "Compilation successful! Open $OUTPUT in a browser to run the game."
else
echo "Compilation failed!"
fi