Skip to content

Commit

Permalink
Add Emscripten support to core library
Browse files Browse the repository at this point in the history
  • Loading branch information
mikke89 committed May 31, 2022
1 parent 486aa7d commit 5af6006
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Include/RmlUi/Core/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
#define RMLUI_BREAK
#endif
#elif defined (RMLUI_PLATFORM_MACOSX)
#define RMLUI_BREAK {__builtin_trap();} // namespace Rml
#define RMLUI_BREAK {__builtin_trap();}
#else
#define RMLUI_BREAK
#endif


Expand Down
4 changes: 4 additions & 0 deletions Include/RmlUi/Core/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#define RMLUI_PLATFORM_UNIX
#define RMLUI_PLATFORM_MACOSX
#define RMLUI_PLATFORM_NAME "macosx"
#elif defined __EMSCRIPTEN__
#define RMLUI_PLATFORM_UNIX
#define RMLUI_PLATFORM_EMSCRIPTEN
#define RMLUI_PLATFORM_NAME "emscripten"
#else
#define RMLUI_PLATFORM_UNIX
#define RMLUI_PLATFORM_LINUX
Expand Down
8 changes: 7 additions & 1 deletion Source/Core/SystemInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#ifdef RMLUI_PLATFORM_WIN32
#include <windows.h>
#else
#include <stdio.h>
#endif

namespace Rml {
Expand Down Expand Up @@ -70,7 +72,11 @@ bool SystemInterface::LogMessage(Log::Type logtype, const String& message)
#else
bool SystemInterface::LogMessage(Log::Type /*logtype*/, const String& message)
{
fprintf(stderr,"%s\n", message.c_str());
#ifdef RMLUI_PLATFORM_EMSCRIPTEN
puts(message.c_str());
#else
fprintf(stderr, "%s\n", message.c_str());
#endif
return true;
}
#endif
Expand Down

0 comments on commit 5af6006

Please sign in to comment.