build #1

Merged
Synthasmagoria merged 24 commits from build into master 2026-09-15 13:38:54 +00:00
7 changed files with 9 additions and 17 deletions
Showing only changes of commit 8892592ae9 - Show all commits

AAAAAAAAAAAAA

Synthasmagoria 2026-09-01 23:24:03 +02:00

View file

@ -45,7 +45,7 @@ files="$OUT_DIR/$WASM_OBJ_NAME $RAYLIB_PATH/wasm/libraylib.a $RAYLIB_PATH/wasm/l
flags="-O0 -sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWASM_BIGINT -sWARN_ON_UNDEFINED_SYMBOLS=0 --shell-file $INDEX_TEMPLATE_PATH --preload-file src/assets"
# For debugging: Add `-g` to `emcc` (gives better error callstack in chrome)
emcc -g -o $OUT_DIR/index.html $files $flags
emcc -o $OUT_DIR/index.html $files $flags
rm -f $OUT_DIR/$WASM_OBJ_NAME

View file

@ -1,5 +1,3 @@
#+build !wasm32, !wasm64p32
package main
import game ".."

View file

@ -8,7 +8,7 @@ windows_library_dest="windows"
darwin_library_dest="darwin"
wasm_library_dest="wasm"
config_flags="\
CONFIG_FLAGS="\
-DSUPPORT_MODULE_RSHAPES=1 \
-DSUPPORT_MODULE_RTEXTURES=1 \
-DSUPPORT_MODULE_RTEXT=1 \
@ -78,10 +78,10 @@ config_flags="\
if [[ -v 1 ]]; then
if [ "$1" = "DEBUG" ]; then
MFLAGS="RAYLIB_BUILD_MODE=DEBUG"
MAKE_FLAGS="RAYLIB_BUILD_MODE=DEBUG"
CFLAGS="-g"
elif [ "$1" = "RELEASE" ]; then
MFLAGS="RAYLIB_BUILD_MODE=RELEASE"
MAKE_FLAGS="RAYLIB_BUILD_MODE=RELEASE"
CFLAGS="-Os"
else
echo "Usage: <script> <DEBUG/RELEASE>"
@ -101,7 +101,7 @@ source $emsdk_env
pushd raylib/src
echo "Compiling raylib static library for linux"
make --silent RAYLIB_CONFIG_FLAGS="$config_flags" $MFLAGS PLATFORM_OS=LINUX
make --silent RAYLIB_CONFIG_FLAGS="$CONFIG_FLAGS" $MAKE_FLAGS PLATFORM_OS=LINUX -B
mv libraylib.a "../../${linux_library_dest}"
make --silent clean
@ -111,7 +111,7 @@ make --silent clean
# make --silent clean
echo "Compiling raylib static library for web"
make --silent RAYLIB_CONFIG_FLAGS="$config_flags" $MFLAGS PLATFORM=PLATFORM_WEB
make --silent RAYLIB_CONFIG_FLAGS="$CONFIG_FLAGS" $MAKE_FLAGS PLATFORM=PLATFORM_WEB -B
mv libraylib.web.a libraylib.a
mv libraylib.a "../../${wasm_library_dest}"
make --silent clean
@ -124,7 +124,7 @@ ar rcs ../${linux_library_dest}/libraygui.a raygui.o
rm raygui.o
echo "Compiling raygui static library for web"
emcc -c -Os -x c -DRAYGUI_IMPLEMENTATION -DPLATFORM_WEB -I../raylib/src raygui.h -o raygui_wasm.o
emcc $CFLAGS -c -x c -DRAYGUI_IMPLEMENTATION -DPLATFORM_WEB -I../raylib/src raygui.h -o raygui_wasm.o
emar rcs ../${wasm_library_dest}/libraygui.a raygui_wasm.o
rm raygui_wasm.o
popd

View file

@ -34,7 +34,7 @@ shutdown :: proc() {
should_run :: proc() -> bool {
when ODIN_OS != .JS {
if program.window_should_close {
if rl.WindowShouldClose() {
return false
}
}

View file

@ -510,9 +510,6 @@ program_update :: proc() {
}
}
}
if rl.WindowShouldClose() {
program.window_should_close = true
}
case .Dialog:
ui_overlay_elements = program_build_dialog_ui(&program.ui_overlay_context, program.dialog_type)
if program.ui_overlay_queue_focus_first {
@ -552,9 +549,6 @@ program_update :: proc() {
program.animation.matrix_count = program.matrix_count
program.state = .Normal
}
if rl.WindowShouldClose() {
program.state = .Normal
}
}
clear(&program.mouse_draggables)

View file

@ -1,7 +1,6 @@
// Implementations of `read_entire_file` and `write_entire_file` using the libc
// stuff emscripten exposes. You can read the files that get bundled by
// `--preload-file assets` in `build_web` script.
#+build wasm32, wasm64p32
package game

View file

@ -20,6 +20,7 @@ import "core:fmt"
context.allocator = emscripten_allocator()
runtime.init_global_temporary_allocator(1*mem.Megabyte)
// TODO (synthas): Do this if it works nicely
// Since we now use js_wasm32 we should be able to remove this and use
// context.logger = log.create_console_logger(). However, that one produces
// extra newlines on web. So it's a bug in that core lib.