Qt for WebAssembly 环境搭建 - Windows新手入门

一、所需工具软件1、安装Python2、安装Git2.1 注册Github账号2.2 下载安装Git2.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/PSWindows

PS C:\Users\> git

usage: git [-v | --version] [-h | --help] [-C ] [-c =]

[--exec-path[=]] [--html-path] [--man-path] [--info-path]

[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]

[--git-dir=] [--work-tree=] [--namespace=]

[--config-env==] []

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 directory

init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)

add Add file contents to the index

mv Move or rename a file, a directory, or a symlink

restore Restore working tree files

rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)

bisect Use binary search to find the commit that introduced a bug

diff Show changes between commits, commit and working tree, etc

grep Print lines matching a pattern

log Show commit logs

show Show various types of objects

status Show the working tree status

grow, mark and tweak your common history

branch List, create, or delete branches

commit Record changes to the repository

merge Join two or more development histories together

rebase Reapply commits on top of another base tip

reset Reset current HEAD to the specified state

switch Switch branches

tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)

fetch Download objects and refs from another repository

pull Fetch from and integrate with another repository or a local branch

push Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some

concept guides. See 'git help ' or 'git help '

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

精彩内容

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。