Cleanup CMakeFiles.txt

- Renamed USE_WASM_COMPATIBLE_MARIAN to USE_WASM_COMPATIBLE_SOURCES
 - Removed COMPILE_THREAD_VARIANT cmake option and removed
   corresponding compile definition
 - Updated workflows and READMEs accordingly
This commit is contained in:
Abhishek Aggarwal 2021-02-26 14:16:51 +01:00
parent e1b74bccab
commit 4d4acf6b8b
5 changed files with 9 additions and 15 deletions

View File

@ -39,7 +39,7 @@ jobs:
-DUSE_FBGEMM=on \
-DUSE_SENTENCEPIECE=on \
-DUSE_STATIC_LIBS=off \
-DUSE_WASM_COMPATIBLE_MARIAN=off
-DUSE_WASM_COMPATIBLE_SOURCES=off
- name: Compile
working-directory: build

View File

@ -97,7 +97,7 @@ jobs:
-DUSE_FBGEMM=${{ matrix.cpu }} \
-DUSE_SENTENCEPIECE=on \
-DUSE_STATIC_LIBS=on \
-DUSE_WASM_COMPATIBLE_MARIAN=off
-DUSE_WASM_COMPATIBLE_SOURCES=off
- name: Compile
working-directory: build

View File

@ -13,16 +13,14 @@ include(CMakeDependentOption)
# Project specific cmake options
option(COMPILE_WASM "Compile for WASM" OFF)
option(USE_WASM_COMPATIBLE_MARIAN "Use wasm compatible marian backend" ON)
CMAKE_DEPENDENT_OPTION(COMPILE_THREAD_VARIANT "Compile the project with thread support" OFF
"USE_WASM_COMPATIBLE_MARIAN" ON)
option(USE_WASM_COMPATIBLE_SOURCES "Use wasm compatible sources" ON)
SET(PACKAGE_DIR "" CACHE STRING "Directory including all the files to be packaged (pre-loaded) in wasm builds")
# Set marian (3rd party submodule) cmake options to compile for this project
SET(COMPILE_CUDA OFF CACHE BOOL "Compile GPU version")
SET(USE_SENTENCEPIECE ON CACHE BOOL "Download and compile SentencePiece")
SET(USE_STATIC_LIBS ON CACHE BOOL "Link statically against non-system libs")
if (USE_WASM_COMPATIBLE_MARIAN)
if (USE_WASM_COMPATIBLE_SOURCES)
# If using wasm compatible marian then set following flags
SET(COMPILE_LIBRARY_ONLY ON CACHE BOOL "Build only the Marian library and exclude all executables.")
SET(USE_MKL OFF CACHE BOOL "Compile with MKL support")
@ -37,7 +35,7 @@ if (USE_WASM_COMPATIBLE_MARIAN)
endif()
# Set ssplit (3rd party submodule) cmake options to compile for this project
CMAKE_DEPENDENT_OPTION(USE_INTERNAL_PCRE2 "Use internal PCRE2 instead of system PCRE2" ON
"USE_WASM_COMPATIBLE_MARIAN" OFF)
"USE_WASM_COMPATIBLE_SOURCES" OFF)
# Documentation: https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
# Ensures the submodules are set correctly during a build.

View File

@ -10,7 +10,7 @@ $ git clone https://github.com/browsermt/bergamot-translator
$ cd bergamot-translator
$ mkdir build
$ cd build
$ cmake .. -DUSE_WASM_COMPATIBLE_MARIAN=off -DCMAKE_BUILD_TYPE=Release
$ cmake .. -DUSE_WASM_COMPATIBLE_SOURCES=off -DCMAKE_BUILD_TYPE=Release
$ make -j
```

View File

@ -1,5 +1,5 @@
if (NOT COMPILE_WASM)
set(SERVICE "service.cpp")
if (NOT USE_WASM_COMPATIBLE_SOURCES)
set(MULTITHREADED_SERVICE_SOURCE "service.cpp")
endif()
add_library(bergamot-translator STATIC
@ -13,7 +13,7 @@ add_library(bergamot-translator STATIC
multifactor_priority.cpp
request.cpp
service_base.cpp
${SERVICE}
${MULTITHREADED_SERVICE_SOURCE}
batcher.cpp
response.cpp
batch.cpp
@ -32,10 +32,6 @@ if(COMPILE_WASM)
target_compile_options(bergamot-translator PRIVATE ${WASM_COMPILE_FLAGS})
endif(COMPILE_WASM)
if (COMPILE_THREAD_VARIANT)
target_compile_definitions(bergamot-translator PRIVATE WITH_PTHREADS)
endif()
target_link_libraries(bergamot-translator marian ssplit)
target_include_directories(bergamot-translator