chore(core): address code review comments

This commit is contained in:
Eberhard Beilharz 2024-08-26 15:10:43 +07:00
parent 13f052f766
commit eb33c53b9c
No known key found for this signature in database
GPG key ID: E9140597606020D3
3 changed files with 13 additions and 67 deletions

View file

@ -135,18 +135,11 @@ mock_files = files(
)
if cpp_compiler.get_id() == 'emscripten'
host_links = ['--whole-archive', '-sALLOW_MEMORY_GROWTH=1', '-sMODULARIZE=1', '-sEXPORT_ES6', '-sENVIRONMENT=webview', '--emit-tsd', 'core-interface.d.ts', '-sERROR_ON_UNDEFINED_SYMBOLS=0']
host_links = ['--whole-archive', '-sALLOW_MEMORY_GROWTH=1', '-sMODULARIZE=1',
'-sEXPORT_ES6', '-sENVIRONMENT=webview',
'--emit-tsd', 'core-interface.d.ts', '-sERROR_ON_UNDEFINED_SYMBOLS=0']
if cpp_compiler.version().version_compare('>=3.1.44')
# emscripten 3.1.44 removes .asm object and so we need to export `wasmExports`
# #9375; https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3144---072523
links += ['-sEXPORTED_RUNTIME_METHODS=[\'UTF8ToString\',\'stringToNewUTF8\',\'wasmExports\']']
else
# emscripten < 3.1.44 does not include `wasmExports`
links += ['-sEXPORTED_RUNTIME_METHODS=[\'UTF8ToString\',\'stringToNewUTF8\']']
endif
links += [
links += ['-sEXPORTED_RUNTIME_METHODS=[\'UTF8ToString\',\'stringToNewUTF8\',\'wasmExports\']',
# Forcing inclusion of debug symbols
'-g', '-Wlimited-postlink-optimizations', '--bind']
endif
@ -188,13 +181,14 @@ if cpp_compiler.get_id() == 'emscripten'
objects: lib.extract_all_objects(recursive: false))
if get_option('buildtype') == 'release'
# TODO: #12888
# Split debug symbols into separate wasm file for release builds only
# as the release symbols will be uploaded to sentry
# custom_target('kmcmplib.wasm',
# custom_target('core.wasm',
# depends: host,
# input: host,
# output: 'kmcmplib.wasm',
# command: ['wasm-split', '@OUTDIR@/wasm-host.wasm', '-o', '@OUTPUT@', '--strip', '--debug-out=@OUTDIR@/kmcmplib.debug.wasm'],
# output: 'core.wasm',
# command: ['wasm-split', '@OUTDIR@/core.wasm', '-o', '@OUTPUT@', '--strip', '--debug-out=@OUTDIR@/core.debug.wasm'],
# build_by_default: true)
endif
endif

View file

@ -28,55 +28,7 @@ EMSCRIPTEN_KEEPALIVE km_core_attr const & tmp_wasm_attributes() {
return engine_attrs;
}
EMSCRIPTEN_BINDINGS(compiler_interface) {
// emscripten::class_<WasmCallbackInterface>("WasmCallbackInterface")
// .function("message", &WasmCallbackInterface::message, emscripten::pure_virtual())
// .function("loadFile", &WasmCallbackInterface::loadFile, emscripten::pure_virtual())
// .allow_subclass<WasmCallbackInterfaceWrapper>("WasmCallbackInterfaceWrapper")
// ;
// emscripten::class_<KMCMP_COMPILER_OPTIONS>("CompilerOptions")
// .constructor<>()
// .property("saveDebug", &KMCMP_COMPILER_OPTIONS::saveDebug)
// .property("compilerWarningsAsErrors", &KMCMP_COMPILER_OPTIONS::compilerWarningsAsErrors)
// .property("warnDeprecatedCode", &KMCMP_COMPILER_OPTIONS::warnDeprecatedCode)
// .property("shouldAddCompilerVersion", &KMCMP_COMPILER_OPTIONS::shouldAddCompilerVersion)
// .property("target", &KMCMP_COMPILER_OPTIONS::target)
// ;
// emscripten::class_<WASM_COMPILER_RESULT>("CompilerResult")
// .constructor<>()
// .property("result", &WASM_COMPILER_RESULT::result)
// .property("kmx", &WASM_COMPILER_RESULT::kmx)
// .property("kmxSize", &WASM_COMPILER_RESULT::kmxSize)
// .property("extra", &WASM_COMPILER_RESULT::extra)
// ;
// emscripten::class_<KMCMP_COMPILER_RESULT_MESSAGE>("CompilerResultMessage")
// .constructor<>()
// .property("errorCode", &KMCMP_COMPILER_RESULT_MESSAGE::errorCode)
// .property("lineNumber", &KMCMP_COMPILER_RESULT_MESSAGE::lineNumber)
// .property("columnNumber", &KMCMP_COMPILER_RESULT_MESSAGE::columnNumber)
// .property("filename", &KMCMP_COMPILER_RESULT_MESSAGE::filename)
// .property("parameters", &KMCMP_COMPILER_RESULT_MESSAGE::parameters)
// ;
// emscripten::class_<KMCMP_COMPILER_RESULT_EXTRA>("CompilerResultExtra")
// .constructor<>()
// .property("targets", &KMCMP_COMPILER_RESULT_EXTRA::targets)
// .property("kmnFilename", &KMCMP_COMPILER_RESULT_EXTRA::kmnFilename)
// .property("kvksFilename", &KMCMP_COMPILER_RESULT_EXTRA::kvksFilename)
// .property("displayMapFilename", &KMCMP_COMPILER_RESULT_EXTRA::displayMapFilename)
// .property("stores", &KMCMP_COMPILER_RESULT_EXTRA::stores)
// .property("groups", &KMCMP_COMPILER_RESULT_EXTRA::groups)
// ;
// emscripten::value_object<KMCMP_COMPILER_RESULT_EXTRA_STORE>("CompilerResultExtraStore")
// .field("storeType", &KMCMP_COMPILER_RESULT_EXTRA_STORE::storeType)
// .field("name", &KMCMP_COMPILER_RESULT_EXTRA_STORE::name)
// .field("line", &KMCMP_COMPILER_RESULT_EXTRA_STORE::line)
// ;
EMSCRIPTEN_BINDINGS(core_interface) {
emscripten::value_object<km_core_attr>("km_core_attr")
.field("max_context", &km_core_attr::max_context)

8
package-lock.json generated
View file

@ -404,7 +404,7 @@
"eventemitter3": "^5.0.0",
"restructure": "^3.0.1",
"sax": ">=0.6.0",
"semver": "^7.5.2",
"semver": "^7.5.4",
"xmlbuilder": "~11.0.0"
},
"devDependencies": {
@ -1153,7 +1153,7 @@
"@keymanapp/keyman-version": "*",
"@keymanapp/kmc-kmn": "*",
"@keymanapp/ldml-keyboard-constants": "*",
"semver": "^7.5.2"
"semver": "^7.5.4"
},
"devDependencies": {
"@keymanapp/developer-test-helpers": "*",
@ -1942,7 +1942,7 @@
"open": "^8.4.0",
"restructure": "^3.0.1",
"sax": ">=0.6.0",
"semver": "^7.5.2",
"semver": "^7.5.4",
"ws": "^8.17.1",
"xmlbuilder": "~11.0.0"
},
@ -14631,7 +14631,7 @@
"devDependencies": {
"@types/semver": "^7.1.0",
"@types/yargs": "^17.0.26",
"semver": "^7.5.2"
"semver": "^7.5.4"
}
},
"resources/build/version/node_modules/ansi-regex": {