electronicarts / EASTL

EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.
BSD 3-Clause "New" or "Revised" License
8.26k stars 944 forks source link

emscripten support? #520

Open julhe opened 1 year ago

julhe commented 1 year ago

Currently, building for emscripten fails with:

/SourceExternal/EASTL/test/packages/EABase/include/Common\EABase/config/eaplatform.h:623:3: error: Unknown platform
        #error Unknown platform
         ^
/SourceExternal/EASTL/test/packages/EABase/include/Common\EABase/config/eaplatform.h:624:3: error: Unknown processor
        #error Unknown processor
         ^
/SourceExternal/EASTL/test/packages/EABase/include/Common\EABase/config/eaplatform.h:625:3: error: Unknown endianness
        #error Unknown endianness

Is support ever planed or is it ouside the scope of this project?

jhopkins-ea commented 1 year ago

Hi. No, this isn't planned for EABase or EASTL.

SirNate0 commented 1 month ago

I think it basically supports it as is (no real testing done, but it compiles and tuple-vector worked fine). I just added the following to eaplatform.h

--- a/eastl/EABase/config/eaplatform.h
+++ b/eastl/EABase/config/eaplatform.h
@@ -619,6 +619,16 @@
 // __sun is defined by the GCC compiler.
 // __i386 is defined by the Sun and GCC compilers.
 // __sparc is defined by the Sun and GCC compilers.
+
+#elif defined(__EMSCRIPTEN__) || defined(__wasm__) || defined(__wasm32__) || defined(__wasm64__)
+       #define EA_PROCESSOR_EMSCRIPTEN 1
+       #define EA_SYSTEM_LITTLE_ENDIAN 1
+       #define EA_PLATFORM_DESCRIPTION "Emscripten WASM"
+       #define EA_PLATFORM_POSIX 1
+       #define EASTL_DEBUG_BREAK_OVERRIDE 1 // disable it
+
 #else
        #error Unknown platform
        #error Unknown processor