From 6c063c607ee5a5ffc00a2fe64a6c32164699ceab Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Wed, 12 May 2021 14:46:02 +0200 Subject: [PATCH] Updated CMakeLists.txt to remove packaging steps for wasm compilation - Removed PACKAGE_DIR cmake option - Removed Workerfs, FORCE_FILESYSTEM=1 in wasm builds -- File system support is not needed any more (since model, shortlist and vocabs are being passed as bytes now) --- CMakeLists.txt | 2 -- wasm/CMakeLists.txt | 9 +-------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef64863..332aed1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,8 +42,6 @@ option(COMPILE_WASM "Compile for WASM" OFF) cmake_dependent_option(USE_WASM_COMPATIBLE_SOURCE "Use wasm compatible sources" OFF "NOT COMPILE_WASM" ON) option(COMPILE_TESTS "Compile bergamot-tests" OFF) -SET(PACKAGE_DIR "" CACHE STRING "Directory including all the files to be packaged (pre-loaded) in wasm builds") - # Set 3rd party submodule specific cmake options for this project SET(COMPILE_CUDA OFF CACHE BOOL "Compile GPU version") SET(USE_SENTENCEPIECE ON CACHE BOOL "Download and compile SentencePiece") diff --git a/wasm/CMakeLists.txt b/wasm/CMakeLists.txt index 4962da0..7feef75 100644 --- a/wasm/CMakeLists.txt +++ b/wasm/CMakeLists.txt @@ -14,14 +14,7 @@ target_include_directories(bergamot-translator-worker target_compile_definitions(bergamot-translator-worker PRIVATE WASM_BINDINGS) target_compile_options(bergamot-translator-worker PRIVATE ${WASM_COMPILE_FLAGS}) -set(LINKER_FLAGS "-g2 --bind -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING=1 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_DYNAMIC_EXECUTION=1 -s EXPORTED_RUNTIME_METHODS=[addOnPreMain]") -if (NOT PACKAGE_DIR STREQUAL "") - get_filename_component(REALPATH_PACKAGE_DIR ${PACKAGE_DIR} REALPATH BASE_DIR ${CMAKE_BINARY_DIR}) - set(LINKER_FLAGS "${LINKER_FLAGS} --preload-file ${REALPATH_PACKAGE_DIR}@/") -endif() - -# Enable worker file system -set(LINKER_FLAGS "${LINKER_FLAGS} -lworkerfs.js") +set(LINKER_FLAGS "-g2 --bind -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_DYNAMIC_EXECUTION=1 -s EXPORTED_RUNTIME_METHODS=[addOnPreMain]") # Avoid node.js-code in emscripten glue-code set(LINKER_FLAGS "${LINKER_FLAGS} -s ENVIRONMENT=web,worker")