Skip to content

Conversation

@AlexandreK38
Copy link
Contributor

Describe your changes

Fix the wasm storage issue described in #3040 by removing EMSCRIPTEN_FETCH_PERSIST_FILE and only use memory.

Add 2 new options for WASM:
AX_WASM_ASSETS_PRELOAD_FILE: Whether enable to bundle the assets to a .data file and preload them into an IndexedDB cache at first launch (--preload-file), otherwise bundle them into the wasm file itself and don't use the IndexedDB at all (--embed-file)", default TRUE
AX_WASM_GENERATE_SYMBOL_FILE: Generate a symbol file for the built wasm file, default FALSE

# --preload-file
# refer to: https://emscripten.org/docs/porting/files/packaging_files.html
set(_WASM_ASSETS_LINKER_FILE "--preload-file")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better logic:

        if(AX_WASM_ASSETS_PRELOAD_FILE)
          # --preload-file
          # refer to: https://emscripten.org/docs/porting/files/packaging_files.html
          set(_WASM_ASSETS_LINKER_FILE "--preload-file")
        else()
          set(_WASM_ASSETS_LINKER_FILE "--embed-file")
        endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do this only once below the option(..)

@halx99 halx99 merged commit 9df65ac into axmolengine:release/2.x Jan 25, 2026
17 checks passed
@halx99 halx99 added this to the 2.11.3 milestone Jan 25, 2026
@halx99 halx99 added the enhancement New feature or request label Jan 25, 2026
@AlexandreK38
Copy link
Contributor Author

I didn't make the changes yet 😅

@halx99
Copy link
Collaborator

halx99 commented Jan 25, 2026

it works as excepted, so merge is ok

halx99 added a commit that referenced this pull request Jan 25, 2026
1. **AX_WASM_ASSETS_PRELOAD_FILE** (default: ON)
   - When enabled, bundles assets into a .data file and preloads them into IndexedDB cache on first launch (using `--preload-file`)
   - When disabled, embeds assets directly into the wasm file (using `--embed-file`) without IndexedDB usage
   - Provides flexibility for different deployment scenarios

2. **AX_WASM_GENERATE_SYMBOL_FILE** (default: OFF)
   - Enables generation of a symbol file for the built wasm, aiding in debugging and profiling

Additionally:
- Refactored WASM-related CMake configuration into a consolidated section
- Removed `EMSCRIPTEN_FETCH_PERSIST_FILE` from Downloader-wasm.cpp to prevent unnecessary file persistence
- Updated documentation in CMakeOptions.md with the new options
- Unified asset linking flags to use the configurable `AX_WASM_ASSETS_LINKER_FLAG`

Refer: #3049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants