Replies: 3 comments 4 replies
-
wasm-pack 支持 c/c++?支持的话 自定义一个toolchain进来,不支持的话 没啥用 |
Beta Was this translation helpful? Give feedback.
0 replies
-
感谢大神的回复!@waruqi wasm-pack 应该只支持rust。有没有可能像pybind11那样,用一个package和一个rule来实现编译wasm? |
Beta Was this translation helpful? Give feedback.
4 replies
-
对于这个问题我找到了一个折中的解决方案,就是用vscode的devcontainer,可以快速建立c++编译wasm的方案,我将我的配置贴到下方,供需要的朋友使用: # 项目结构
noah-next/
├─ .devcontainer/
│ ├─ devcontainer.json
│ ├─ Dockerfile
├─ src/
│ ├─ *.cpp
└─ xmake.lua // devcontainer.json
{
"name": "xmake-emsdk",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-vscode.cpptools-extension-pack"
]
}
},
"remoteUser": "xmake"
} # Dockerfile
FROM emscripten/emsdk:3.1.20
# 更改镜像为阿里镜像源
RUN rm -f /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list
RUN apt update
RUN apt install -y curl clang bash git grep unzip gzip sudo perl python3
RUN adduser xmake \
&& echo "xmake ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/xmake \
&& chmod 0440 /etc/sudoers.d/xmake
USER xmake
RUN curl -fsSL https://xmake.io/shget.text | bash \
&& sudo ln -s ~/.local/bin/xmake /usr/bin/xmake \
&& sudo ln -s ~/.local/bin/xrepo /usr/bin/xrepo
RUN git clone https://gitee.com/xmake-mirror/build-artifacts.git /home/xmake/.xmake/repositories/build-artifacts
RUN git clone https://gitee.com/tboox/xmake-repo.git /home/xmake/.xmake/repositories/xmake-repo
RUN npm i -g pnpm vscode安装扩展 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我认为目前用xmake来做wasm不是很方便,主要有以下几点原因
我认为比较好用的是rust的wasm-pack,用起来很方便,没有配置emsdk的问题,还可以针对web和node环境生成不同的文件。
提出来讨论一下,有没有可能在xmake上建立类似的wasm功能
Beta Was this translation helpful? Give feedback.
All reactions