Skip to content

Commit

Permalink
Experimental WebAssembly Support Using emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
iguessthislldo committed Apr 18, 2023
1 parent ab3b192 commit 8876bc7
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ ipch/
*.*codeanalysis*
read.lock
fileList.bin

*.js
*.wasm
2 changes: 2 additions & 0 deletions ACE/ace/Notification_Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "ace/Intrusive_List.h"
#include "ace/Intrusive_List_Node.h"
#include "ace/Unbounded_Queue.h"
#include "ace/Synch_Traits.h"
#include "ace/Thread_Mutex.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down
3 changes: 3 additions & 0 deletions ACE/ace/Timer_Queue_T.inl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// -*- C++ -*-

#include "ace/Guard_T.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

template <class TYPE, class FUNCTOR> ACE_INLINE FUNCTOR &
Expand Down
51 changes: 51 additions & 0 deletions ACE/ace/config-emscripten.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef ACE_CONFIG_EMSCRIPTEN_H
#define ACE_CONFIG_EMSCRIPTEN_H

#define ACE_EMSCRIPTEN

#define ACE_HAS_CPP11

// Threading
#define ACE_MT_SAFE 1
#define ACE_HAS_THREADS 1
#define ACE_HAS_PTHREADS
#define ACE_HAS_PTHREADS_UNIX98_EXT
#define ACE_HAS_THREAD_SPECIFIC_STORAGE

// Basic Types
#define ACE_HAS_SSIZE_T
#define ACE_HAS_WCHAR

// Time
#define ACE_HAS_POSIX_TIME
#define ACE_LACKS_TIMESPEC_T
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY

// Everything else
#define ACE_HAS_UCONTEXT_T
#define ACE_HAS_MSG
#define ACE_HAS_CPU_SET_T
#define ACE_LACKS_ISCTYPE
#define ACE_HAS_STRBUF_T
#define ACE_HAS_SOCKLEN_T
#define ACE_LACKS_AUTO_PTR
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
#define ACE_HAS_3_PARAM_WCSTOK
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSNICMP
#define ACE_HAS_DIRENT
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG

#include "config-posix.h"
#include "config-g++-common.h"

// Not supported? https://github.com/emscripten-core/emscripten/issues/18050
#ifdef ACE_HAS_AIO_CALLS
# undef ACE_HAS_AIO_CALLS
#endif

#endif
3 changes: 2 additions & 1 deletion ACE/ace/os_include/sys/os_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ typedef double ACE_timer_t;

#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8
typedef off_t ACE_LOFF_T;
#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__)
#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \
defined (ACE_EMSCRIPTEN)
typedef off_t ACE_LOFF_T;
#elif defined (__QNX__)
typedef off64_t ACE_LOFF_T;
Expand Down
23 changes: 23 additions & 0 deletions ACE/include/makeinclude/platform_emscripten.GNU
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ACE_PLATFORM_CONFIG ?= config-emscripten.h
EXEEXT = .js

debug ?= 1
optimize ?= 1
threads ?= 1
inline ?= 1
static_libs_only = 1

CROSS_COMPILE := THIS_VALUE_SHOULD_NOT_BE_USED
override_cross_compile = 1
CC = emcc
CXX = em++
AR = emar
LD = emcc

ifeq ($(threads),1)
FLAGS_C_CC += -pthread
SOFLAGS += -pthread
LIBS += -lrt
endif

include $(ACE_ROOT)/include/makeinclude/platform_clang_common.GNU

0 comments on commit 8876bc7

Please sign in to comment.