Modified wasm cmake file to include version information in built artifacts

This commit is contained in:
Abhishek Aggarwal 2021-05-17 17:37:10 +02:00 committed by abhi-agg
parent c44868e1fd
commit 2e5880d3d4
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,10 @@ add_executable(bergamot-translator-worker
bindings/TranslationResultBindings.cpp
)
# Generate version file that can be included in the wasm artifacts
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/project_version.js.in
${CMAKE_CURRENT_SOURCE_DIR}/project_version.js @ONLY)
# This header inclusion needs to go away later as path to public headers of bergamot
# translator should be directly available from "bergamot-translator" target
target_include_directories(bergamot-translator-worker
@ -19,6 +23,9 @@ set(LINKER_FLAGS "-g2 --bind -s ASSERTIONS=0 -s DISABLE_EXCEPTION_CATCHING=1 -s
# Avoid node.js-code in emscripten glue-code
set(LINKER_FLAGS "${LINKER_FLAGS} -s ENVIRONMENT=web,worker")
# Append version information in the Javascript artifact
set(LINKER_FLAGS "${LINKER_FLAGS} --extern-pre-js ${CMAKE_CURRENT_SOURCE_DIR}/project_version.js")
set_target_properties(bergamot-translator-worker PROPERTIES
SUFFIX ".js"
LINK_FLAGS ${LINKER_FLAGS}

View File

@ -0,0 +1 @@
var BERGAMOT_VERSION_FULL = "@PROJECT_VERSION_STRING_FULL@";