Qt for WebAssembly 环境搭建 - Windows新手入门
- 一、所需工具软件
- 1、安装Python
- 2、安装Git
- 2.1 注册Github账号
- 2.2 下载安装Git
- 2.2.1配置Git:
- 2.2.2 配置Git环境
- 2.2.3解决git@github.com: Permission denied (publickey)
- 3 安装em++编译器
- 二、Qt配置编译器
- 三、参考链接
一、所需工具软件
本文中用到的工具软件都安装在D:/WASM文件夹中
1、安装Python
下载安装Python,笔者这里是3.12.2版本,安装到D:/WASM/Python中,并添加目录到系统环境变量。
2、安装Git
2.1 注册Github账号
2.2 下载安装Git
下载安装Git到D:/WASM/Git文件夹,一路Next就可以。
2.2.1配置Git:
使用CMD、或者Git Bash:
Windows PowerShell
版权所有(C) Microsoft Corporation。保留所有权利。安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindowsPS C:\Users\> git
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>][--config-env=<name>=<envvar>] <command> [<args>]These are common Git commands used in various situations:start a working area (see also: git help tutorial)clone Clone a repository into a new directoryinit Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add Add file contents to the indexmv Move or rename a file, a directory, or a symlinkrestore Restore working tree filesrm Remove files from the working tree and from the indexexamine the history and state (see also: git help revisions)bisect Use binary search to find the commit that introduced a bugdiff Show changes between commits, commit and working tree, etcgrep Print lines matching a patternlog Show commit logsshow Show various types of objectsstatus Show the working tree statusgrow, mark and tweak your common historybranch List, create, or delete branchescommit Record changes to the repositorymerge Join two or more development histories togetherrebase Reapply commits on top of another base tipreset Reset current HEAD to the specified stateswitch Switch branchestag Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch Download objects and refs from another repositorypull Fetch from and integrate with another repository or a local branchpush Update remote refs along with associated objects'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
出现这么一堆就是安装好了Git。
2.2.2 配置Git环境
# 1配置用户名
git config --global user.name YourUserName
# 2配置邮箱
git config --global user.email YourEMail
# 3查看配置是否OK
git config --global --list
# 4生成ssh
ssh-keygen -t rsa
>> Generating public/private rsa key pair.
>> Enter file in which to save the key (C:\Users\china/.ssh/id_rsa):
>> 这里是产生rsa的目录,笔者这里是D:/WASM/rsa
>> 会成生id_rsa和id_rsa.pub两个文件,用笔记本打开id_rsa.pub,复制全部内容。
>> 粘贴到下面这个Key里面
# 5测试配置是否成功
ssh -T git@github.com
# 6正常是出现Success
2.2.3解决git@github.com: Permission denied (publickey)
参考文章https://blog.csdn.net/qq_40047019/article/details/122898308
# 1生成ssh key
ssh-keygen -t rsa -C "xx@example.com"
# 2
ssh -v git@github.com
# 3
ssh-agent -s
# 4
ssh-add ~/.ssh/id_rsa
# 失败的话
# 4.1
eval `ssh-agent -s`
# 4.2
ssh-add ~/.ssh/id_rsa
# 5
ssh -T git@github.com
3 安装em++编译器
使用CMD、PowerShell等
# 1进入D盘
d:
# 2从Git获取emsdk保存到D盘
git clone https://github.com/emscripten-core/emsdk.git
# 3进入emsdk文件夹
cd emsdk
# 4获取emsdk最新版
git pull
# 5查看可用版本和已安装版本
emsdk list
# 5.1如果没有安装Python,或者没有把Python添加到系统环境变量,在cmd中emsdk是没有反应的,在PowerShell中提示没有权限,所以一开始就要安装Python。
# 6安装emsdk
# 6.1安装最新版
emsdk install latest
# 6.2激活
emsdk activate latest
# 6.3Qt for WebAssembly有自己支持的版本,要对应安装
Qt 6.2-- 2.0.14
Qt 6.3-- 3.0.0
Qt 6.4-- 3.1.14
Qt 6.5-- 3.1.25
Qt 6.6-- 3.1.37
笔者用的是Qt6.6,所以安装3.1.37
emsdk install 3.1.37
emsdk activate 3.1.37
# 7再次查看已安装的组件
emsdk list
# 8激活环境变量
emsdk_env.bat
# 9查看em++版本
em++ --version
二、Qt配置编译器
三、参考链接
1、Qt官方
https://doc.qt.io/qt-6/wasm.html
2、Git下载
https://git-scm.com/downloads
3、emscripten官方
https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install
4、CSDN相关文章
https://blog.csdn.net/qq_45026254/article/details/107286026
https://blog.csdn.net/huangqqdy/article/details/83032408
https://blog.csdn.net/huangqqdy/article/details/83032408