首页 > 其他分享 >get and build the qt in open source version

get and build the qt in open source version

时间:2024-02-03 13:44:37浏览次数:23  
标签:git qt get source qt5 build directory Qt

Getting the source code

First, cd into the directory where you want the "qt5" directory to live. Then, clone the top-level Qt 5 git repository:

$ git clone git://code.qt.io/qt/qt5.git

or (if you're behind a firewall and want to use the https protocol):

$ git clone https://code.qt.io/qt/qt5.git

This creates a local branch that tracks "origin/dev". If you plan to submit changes to Qt, stay on this branch. Otherwise, check out the target branch (see Branch Guidelines):

$ cd qt5
$ git checkout 5.12

For commercial-only modules and commercial-only branches of public modules, see Getting Commercial Qt Sources.

Getting the submodule source code

As described in the README.git, initialize the repository using the init-repository script, which clones the various sub-modules of Qt 5.

Relevant options for init-repository:

  • --module-subset=default,-qtwebengine : Consider skipping the web module (Qt WebEngine) by passing this option. It is quite big and takes a long time to compile (and is often a source of compile errors), so it is recommended to only download it if you intend to use it. You can always re-run init-repository later on to add it.
  • --branch : Check out the branch tips instead of the SHA1s of the latest successful integration build.
  • --codereview-username <Jira/Gerrit username> : If you plan to contribute to Qt, you may specify your codereview username (pay attention to capitalization!) so that the git remotes are properly set up. Note that it is recommended to adjust your ssh configuration instead.
$ cd qt5
$ perl init-repository

In order to build a specific release of Qt, you can checkout the desired tag:

$ cd qt5
$ git checkout 5.12.0
$ perl init-repository

Note: init-repository is currently unable to initialize tags that are too old. An alternative way to build a specific release or branch of Qt5 (although without linking of the gerrit account for code reviewing) is to use git submodule update --init in place of the init-repository script. That translates to:

$ git clone https://code.qt.io/qt/qt5.git                     # cloning the repo
$ cd qt5
$ git checkout v5.8.0                                         # checking out the specific release or branch
$ git submodule update --init --recursive                     # updating each submodule to match the supermodule

More information can be found in Get The Source.

Configuring and Building

The Qt5 build system should be fairly resilient against any "outside distractions" - it shouldn't matter whether you have other Qt versions in PATH, and QTDIR is entirely ignored. However, make sure that you have no qmake-specific environment variables like QMAKEPATH or QMAKEFEATURES set, and the qmake -query output does not refer to any other Qt versions ($HOME/.config/Qt/QMake.conf should be empty).

For more configure options, see Qt Configure Options.

Note: To build qdoc and Qt documentation in future you should set LLVM_INSTALL_DIR environment variable pointing to directory where LLVM is installed (it should be top level directory, the configuration scripts use relative path tracing from this directory). For example, in Linux with LLVM installed in isolated directory (/usr/llvm), at a bash prompt:

$ export LLVM_INSTALL_DIR=/usr/llvm

A build script called configure (or configure.bat for Windows) will be in the directory that you git cloned the source code into (~/qt5 if you followed the directions above). You will want to call that script from a different, parallel-level directory, because (unless you are using a Qt Autotest Environment) you do not want to build Qt in the directory that holds the source code. Instead, you should use a "shadow build," meaning you should not build into the source directory.

For Linux / macOS, to install in ~/qt5-build (an arbitrary name), assuming you are in ~:

$ mkdir qt5-build
$ cd qt5-build
$ ../qt5/configure -developer-build -opensource -nomake examples -nomake tests

For Windows, again assuming you are in ~:

$ mkdir qt5-build
$ cd qt5-build
$ ..\\qt5\configure -developer-build -opensource -nomake examples -nomake tests

The -developer-build option causes more symbols to be exported in order to allow more classes and functions to be unit tested than in a regular Qt build. It also defaults to a 'debug' build, and installs the binaries in the current directory, avoiding the need for 'make install'. '-opensource' sets the license to be GPL/LGPL. The -nomake examples and -nomake tests parameters make sure examples and tests aren't compiled by default. You can always decide to compile them later by hand.

Some Hints

  1. You can add -confirm-license to get rid of the question whether you agree to the license.
  2. On Windows, you might not be able to build if sh.exe is in your PATH (for example due to a git or msys installation). Such an error is indicated by qt5-src\qtbase\bin\qmake.exe: command not found and alike. In this case, make sure that sh.exe is not in your path. You will have to re-configure if your installation is already configured.
  3. If you are planning to make contributions with git, it is advised to configure and build the source in a separate directory so the binaries are not seen by git. This can be done by navigating to the desired build directory and calling configure/make in that directory. (But shadow builds are discouraged in Qt Autotest Environment.)
    1. Note: If you do a shadow build, follow the instructions above for creating a build directory that is parallel to the source directory. Do NOT make the build directory a subdirectory of the source tree. The build will probably fail in weird ways if the build directory is not exactly parallel to the source directory.

Now trigger the build from within the build directory by running:

$ make -j$(nproc)

For Windows (MSVC), choose one of the following, depending on your setup/environment:

$ nmake

or

$ jom

or

$ mingw32-make

Or only build a specific module, e.g. declarative, and modules it depends on:

$ make module-qtdeclarative



https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code

标签:git,qt,get,source,qt5,build,directory,Qt
From: https://www.cnblogs.com/fire909090/p/18004591

相关文章

  • 物联网浏览器(IoTBrowser)-MQTT协议集成和测试
    一、简介MQTT(消息队列遥测传输)是ISO标准(ISO/IECPRF20922)下基于发布/订阅范式的消息协议。它工作在TCP/IP协议族上,是为硬件性能低下的远程设备以及网络状况糟糕的情况下而设计的发布/订阅型消息协议,为此,它需要一个消息中间件。MQTT是一个基于客户端-服务器的消息发布/订......
  • Qt/C++音视频开发66-音频变速不变调/重采样/提高音量/变速变调/倍速播放/sonic库使用
    一、前言之前在做倍速这个功能的时候,发现快速播放会有滴滴滴的破音出现,正常1倍速没有这个问题,尽管这个破音间隔很短,要放大音量才能听到,但是总归是不完美的,后面发现,通过修改qaudiooutput的采样率,可以规避这个问题,破音不在出现了,但是音调变了,倍速越大变得越快,人声越发不清晰,变得尖......
  • 字符串构建问题——cf_921_C. Did We Get Everything Covered?
    目录问题概述思路想法参考代码include<bits/stdc++.h>defineFAST_IOios::sync_with_stdio(false),cin.tie(0),cout.tie(0)defineendl'\n'definepllpair<longlong,longlong>definepiipair<int,int>definevivectordefinevlvectordefinelllo......
  • QT 使用 QtCreator 格式化代码
    QtCreator本身默认支持代码格式化,具体格式化快捷键为:Ctrl+i。可以选择部分或全部选择后执行 Ctrl+i操作完成代码格式化。但只限于缩进格式化,不会对大括号位置、小括号前后空格、运算符前后空格等进行格式化操作,显然使用起来并不是那么的舒心。那么如何优雅的实现全......
  • Qt Creator配置clang-format格式化代码插件
    clang-format是一种格式化代码的插件,可用于格式化C/C++/Java/JavaScript/Objective-C/Protobuf/C#代码。而QtCreator的格式化代码的功能只支持非常简单的缩进纠正,本博客主要讲述如何在QtCreator上配置clang-format插件。打开Beautifier插件打开帮助->关于插件......
  • Qt Creator使用clang-format实现源代码格式化排版(Windows/macOS)
    本篇先针对Windows系统来描述,末尾再补充macOS1、clang官网下载clang-format.exeLLVMDownloadPage 下载最新版本Releases·llvm/llvm-project·GitHub方法1:完整版我们需要从官网下载完整的LLVM编译器,Pre-BuiltBinaries,Windows(64-bit),LLVM-9.0.0-win64.exe。安装时,请......
  • Qt 解决中报错xxx.h:4:10: ‘QMainWindow‘ file not found
    前言qt中这个报错非常无语,在一个目录下打开是正常的,然后copy项目到其他文件夹就找不到报错,大家的原因都不太相同,这里列出以下几种可能及解决方法。可能1.中文路径很有可能copy到了一个中文路径下的目录,然后导致出现问题。解决方式就是换到英文目录可能2.将.pr......
  • Qt按钮字体旋转
    #include"mainwindow.h"#include"ui_mainwindow.h"classRotatedButton:publicQPushButton{public:explicitRotatedButton(constQString&text,QWidget*parent=nullptr):QPushButton(text,parent){}b......
  • file_get_contents 避免出现按个 ssl -60 的报错 ,不进行数据验证 或者 使用php.ini 进
    1,使用不去验证数据$stream_opts=["ssl"=>["verify_peer"=>false,"verify_peer_name"=>false,]];$user_info=json_decode(file_get_contents($user_info_url,false,stream_context_create($stream_opts)));2,配置php.ini......
  • Qt 调试器常见异常
    1.变量无提示信息,解决办法:工具->选项->调试器->概要->选中《当调试时在主编辑器中启用工具提示》2.CDB断点调试,解决无法查看QString值。运行至断点时,程序卡死。解决办法:打开“工具->选项->调试器->CDB”,把“UsePythondumper”选项勾选去掉,保存即可。3.CDB调试速度慢,解决办法如......