Skip to content

Commit

Permalink
Made raylib work with emscripten by importing env.o lib when ARCH i…
Browse files Browse the repository at this point in the history
…s WASM. Also added raylib WASM lib, but that is for use with emcc after compilation of object file.
  • Loading branch information
karl-zylinski committed Dec 31, 2024
1 parent 597fba7 commit c4f7df9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vendor/raylib/raygui.odin
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ when ODIN_OS == .Windows {
"macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a",
}
}
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
// `env.o` is emscripten's internal environment object file. You will link
// `wasm/libraylib.a` later as part of your call to `emcc`.

// TODO: Does this actually need a `wasm/libraygui.a` file? We have to
// compile that one ourselves.
foreign import lib "env.o"
} else {
foreign import lib "system:raygui"
}
Expand Down
4 changes: 4 additions & 0 deletions vendor/raylib/raylib.odin
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ when ODIN_OS == .Windows {
"system:OpenGL.framework",
"system:IOKit.framework",
}
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
// `env.o` is emscripten's internal environment object file. You will link
// `wasm/libraylib.a` later as part of your call to `emcc`.
foreign import lib "env.o"
} else {
foreign import lib "system:raylib"
}
Expand Down
4 changes: 4 additions & 0 deletions vendor/raylib/rlgl/rlgl.odin
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ when ODIN_OS == .Windows {
"system:OpenGL.framework",
"system:IOKit.framework",
}
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
// `env.o` is emscripten's internal environment object file. You will link
// `wasm/libraylib.a` later as part of your call to `emcc`.
foreign import lib "env.o"
} else {
foreign import lib "system:raylib"
}
Expand Down
Binary file added vendor/raylib/wasm/libraylib.a
Binary file not shown.

0 comments on commit c4f7df9

Please sign in to comment.