# My step by step guides for SDL3 to build for Android and WebAssembly

**URL:** <https://discourse.libsdl.org/t/my-step-by-step-guides-for-sdl3-to-build-for-android-and-webassembly/50766>\
**Category:** SDL Development\
**Created:** [April 30, 2024, 11:39am UTC](https://discourse.libsdl.org/t/my-step-by-step-guides-for-sdl3-to-build-for-android-and-webassembly/50766 "2024-04-30T11:39:33Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![8Observer8](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/8/bbe5ce/32.png) [@8Observer8](https://discourse.libsdl.org/u/8Observer8)\
**Post date:** [July 3, 2024, 12:06am UTC](https://discourse.libsdl.org/t/my-step-by-step-guides-for-sdl3-to-build-for-android-and-webassembly/50766/20 "2024-07-03T00:06:17Z")

</div>

**Loading textures for WASM**

Add it to the `CMakeLists.txt` file:

```plaintext
if(CMAKE_SYSTEM_NAME MATCHES Emscripten)
	set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "")
    target_link_options("${EXECUTABLE_NAME}" PRIVATE "SHELL:--embed-file ${CMAKE_CURRENT_SOURCE_DIR}/src/box.jpg@/box.jpg")
    set_property(TARGET "${EXECUTABLE_NAME}" APPEND PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/box.jpg")
endif()

```

Header only library to load textures: [stb\_image.h](https://github.com/nothings/stb/blob/master/stb_image.h) Place it in the `src` folder.

```cpp
// i.e. it should look like this:
#include ...
#include ...
#include ...
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

```

```cpp
int h_image, w_image, cnt;
const char *texturePath = "./box.jpg";
unsigned char *data = stbi_load(texturePath, &w_image, &h_image, &cnt, 0);
std::cout << "w_image: " << w_image << std::endl;

```

Useful links from **maarten** : [Discord](https://discord.com/channels/405784877305298944/1062483238695739522/1257844752347299984)

---

_[View the full topic](https://discourse.libsdl.org/t/my-step-by-step-guides-for-sdl3-to-build-for-android-and-webassembly/50766)._
