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 Oct 13, 2022
1 parent 0099c59 commit 7ed3de1
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ ipch/
*.VC.db*
*.tds
*.*codeanalysis*
*.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
4 changes: 4 additions & 0 deletions ACE/ace/Timer_Queue_T.inl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// -*- C++ -*-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL

#include "ace/Guard_T.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

template <class TYPE, class FUNCTOR> ACE_INLINE FUNCTOR &
ACE_Timer_Queue_Upcall_Base<TYPE, FUNCTOR>::upcall_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
2 changes: 1 addition & 1 deletion ACE/ace/os_include/sys/os_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef double ACE_timer_t;
#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8
typedef off_t ACE_LOFF_T;
#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \
(defined (ACE_OPENVMS) && defined (_LARGEFILE))
(defined (ACE_OPENVMS) && defined (_LARGEFILE)) || defined (ACE_EMSCRIPTEN)
typedef off_t ACE_LOFF_T;
#elif defined (AIX) || defined (HPUX) || 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 7ed3de1

Please sign in to comment.