Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wasm support #754

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add wasm support #754

wants to merge 1 commit into from

Conversation

eagleoflqj
Copy link
Contributor

@eagleoflqj eagleoflqj commented Dec 20, 2022

做了个网站,纯前端wasm转换繁简https://my-opencc.vercel.app/ 支持全部14个json配置
代码:https://github.com/LibreService/my_opencc
想把wasm构建部分合并到上游

https://github.com/oyyd/wasm-opencc 的区别:

  • 使用wasm而非asm.js
  • 仅改动最外层CMakeLists.txtMakefile;wasm-opencc的改动比较大,基本没法合并
  • 依赖最新的emscripten工具链

@eagleoflqj eagleoflqj marked this pull request as draft December 20, 2022 00:47
@eagleoflqj
Copy link
Contributor Author

It seems when emscripten env is activated, make cannot execute cmake due to the same reason with emscripten-core/emsdk#616, so I have to put these in a separate script inside wasm/.

@septs
Copy link

septs commented Dec 26, 2022

如果能吧 node.js bindings 切换到 wasm 实现,那就更好了

add_subdirectory(test)
if (NOT EMSCRIPTEN)
add_subdirectory(doc)
add_subdirectory(data)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那 txt 转 ocd2 的工作如何在编译时进行?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasm/build.sh里,先本地编译,然后把ocd2产物共享给wasm

@eagleoflqj
Copy link
Contributor Author

如果能吧 node.js bindings 切换到 wasm 实现,那就更好了

可行,就是wasm速度会比native慢一些,不一定划算
给web用肯定是wasm最快

@septs
Copy link

septs commented Dec 26, 2022

如果能吧 node.js bindings 切换到 wasm 实现,那就更好了

可行,就是wasm速度会比native慢一些,不一定划算 给web用肯定是wasm最快

等等作者( @BYVoid )的意见吧,我只是觉得 wasm 免除编译带来的优势更大(指开箱即用)

@ayaka14732
Copy link
Collaborator

有沒有想過用 https://github.com/nk2028/opencc-js

@eagleoflqj
Copy link
Contributor Author

有沒有想過用 https://github.com/nk2028/opencc-js

my opencc算是我做my rime的一个中间产物,所以用C++版opencc是个刚需

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants