emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3.02k stars 688 forks source link

Define STANDALONE_WASM at compile time as well as link time #1261

Closed martijneken closed 1 year ago

martijneken commented 1 year ago

This fixes libraries using conditional dependencies, such as Abseil: https://github.com/search?q=repo%3Aabseil%2Fabseil-cpp+standalone_wasm&type=code

walkingeyerobot commented 1 year ago

Thanks for the PR. This is correct given the current state of the world. However, after talking to some of the other maintainers, I don't think emscripten wants to commit to STANDALONE_WASM being detected like this, and I was a bit too quick to add that #ifdef to absl. Instead, I'm going to remove the #ifdef that checks for STANDALONE_WASM from absl and improve their code so that it continues to work with JS contexts via EM_JS but also doesn't crash if being built for standalone mode.