一、安装webassembly开发环境
参考:https://www.jianshu.com/p/fdf74aad806b
二、使用Cmake工具。
1、设置工程目录和生成目标目录
2、点击configure按钮。弹出的对话框配置如下:

3、点击Next之后,如下:

这个工具链文件就在第一步安装的开发环境中,文件名为Emscripten.cmake,在这个文件中有以下使用说明:
# To use this toolchain file with CMake, invoke CMake with the following command
# line parameters:
# cmake -DCMAKE_TOOLCHAIN_FILE=<EmscriptenRoot>/cmake/Modules/Platform/Emscripten.cmake
# -DCMAKE_BUILD_TYPE=<Debug|RelWithDebInfo|Release|MinSizeRel>
# -G "Unix Makefiles" (Linux and OSX)
# -G "MinGW Makefiles" (Windows)
# <path/to/CMakeLists.txt> # Note, pass in here ONLY the path to the file, not the filename 'CMakeLists.txt' itself.
# After that, build the generated Makefile with the command 'make'. On Windows,
# you may download and use 'mingw32-make' instead.
4、再次点击configure按钮,此时会提示CMAKE_MAKE_PROGRAM未配置。
![]()
我使用的是QT的mingw32-make.exe
5、再次点击configure按钮。如果有失败,按提示进行相应的修改
6、点击Generate按钮,生成工程
三、编译
打开cmd, 将工作目录定位到生成的目标目录,输入C:/Qt/Qt5.14.2/Tools/mingw730_32/bin/mingw32-make.exe回车,开始编译。
其中C:/Qt/Qt5.14.2/Tools/mingw730_32/bin/mingw32-make.exe就是配置的CMAKE_MAKE_PROGRAM属性,根据个人使用的具体环境情况进行相应改动。


6274

被折叠的 条评论
为什么被折叠?



