Browse Source

Tweaks for usable carla libs as js modules

Signed-off-by: falkTX <falktx@falktx.com>
fix-audiofile-buffering
falkTX 1 year ago
parent
commit
3b101d03a8
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 28 additions and 4 deletions
  1. +2
    -2
      source/Makefile.mk
  2. +22
    -1
      source/backend/Makefile
  3. +4
    -1
      source/includes/CarlaDefines.h

+ 2
- 2
source/Makefile.mk View File

@@ -279,7 +279,7 @@ endif
ifeq ($(MACOS),true)
LIB_EXT = .dylib
else ifeq ($(WASM),true)
LIB_EXT = .wasm
LIB_EXT = .js
else ifeq ($(WINDOWS),true)
LIB_EXT = .dll
else
@@ -315,7 +315,7 @@ endif
ifeq ($(MACOS),true)
SHARED = -dynamiclib
else ifeq ($(WASM),true)
SHARED = -sSIDE_MODULE=1
SHARED = -sMAIN_MODULE=2
else
SHARED = -shared
endif


+ 22
- 1
source/backend/Makefile View File

@@ -118,6 +118,27 @@ endif

# ---------------------------------------------------------------------------------------------------------------------

ifeq ($(WASM),true)
STANDALONE_SHARED = -sMAIN_MODULE=1 -O3
STANDALONE_SHARED += -sALLOW_MEMORY_GROWTH
STANDALONE_SHARED += -sINITIAL_MEMORY=32Mb
STANDALONE_SHARED += -sSTACK_SIZE=2MB
STANDALONE_SHARED += -lidbfs.js
STANDALONE_SHARED += -sEXPORTED_RUNTIME_METHODS=IDBFS,FS,cwrap
STANDALONE_SHARED += -sMODULARIZE=1 -sEXPORT_NAME=CarlaStandalone
STANDALONE_SHARED += -sENVIRONMENT=web
STANDALONE_SHARED += -sEXPORTED_FUNCTIONS="['_malloc','_free']"
STANDALONE_SHARED += -sEXPORTED_RUNTIME_METHODS="['lengthBytesUTF8','stringToUTF8','UTF8ToString']"
# TESTING
# STANDALONE_SHARED += --use-preload-cache
# STANDALONE_SHARED += --use-preload-plugins
# STANDALONE_SHARED += --preload-file=../frontend/web/resources@/resources
else
STANDALONE_SHARED = $(SHARED)
endif

# ---------------------------------------------------------------------------------------------------------------------

all: $(TARGETS)
$(MAKE) -C utils

@@ -142,7 +163,7 @@ doxygen: CarlaBackend.doxygen
$(BINDIR)/libcarla_standalone2$(LIB_EXT): $(OBJS_standalone) $(STANDALONE_LIBS)
-@mkdir -p $(BINDIR)
@echo "Linking libcarla_standalone2$(LIB_EXT)"
$(SILENT)$(CXX) $(OBJS_standalone) $(BUILD_CXX_FLAGS) $(LIBS_START) $(STANDALONE_LIBS) $(LIBS_END) $(LINK_FLAGS) $(STANDALONE_LINK_FLAGS) $(SHARED) -o $@
$(SILENT)$(CXX) $(OBJS_standalone) $(BUILD_CXX_FLAGS) $(LIBS_START) $(STANDALONE_LIBS) $(LIBS_END) $(LINK_FLAGS) $(STANDALONE_LINK_FLAGS) $(STANDALONE_SHARED) -o $@

# ---------------------------------------------------------------------------------------------------------------------



+ 4
- 1
source/includes/CarlaDefines.h View File

@@ -297,9 +297,12 @@ private: \
#endif

/* Define CARLA_*_EXPORT */
#ifdef BUILD_BRIDGE
#if defined(BUILD_BRIDGE)
# define CARLA_API_EXPORT CARLA_EXTERN_C
# define CARLA_PLUGIN_EXPORT CARLA_EXTERN_C
#elif defined(CARLA_OS_WASM)
# define CARLA_API_EXPORT CARLA_EXTERN_C CARLA_API
# define CARLA_PLUGIN_EXPORT CARLA_EXTERN_C __attribute__ ((used))
#else
# define CARLA_API_EXPORT CARLA_EXTERN_C CARLA_API
# define CARLA_PLUGIN_EXPORT CARLA_EXTERN_C CARLA_VISIBLE_SYMBOL


Loading…
Cancel
Save