cmake编译C++工程到webassembly(windows)

一、安装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属性,根据个人使用的具体环境情况进行相应改动。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值