M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8

how_to_build_qt_creator_for_macos_arm64_a_guide/
https://www.cnblogs.com/wqcwood/p/15138983.html
Installing Clang for QDoc

1. Install Xcode

google一下吧

2. Install Homebrew

google一下吧

3. Install other

Get Qt build dependencies (using homebrew)

brew install pcre2 harfbuzz freetype

Get Qt Creator dependencies (using homebrew)

brew install cmake ninja python
brew install --build-from-source llvm

4. Get Qt5.15.5 source code

qt-everywhere-opensource-src-5.15.5.tar.xz
unzip it !
for me is : ~/Downloads/qt-everywhere-src-5.15.5

5. Install Clang for QDoc

check llvm is install

llvm-config

M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第1张图片

find llvm install path

which llvm-config

out: /opt/homebrew/opt/llvm/bin/llvm-config

Specify Clang location manually

$ export LLVM_INSTALL_DIR=/opt/homebrew/opt/llvm

6. Build Qt for mac

open terminal and chang dir to ~/Downloads/qt-everywhere-src-5.15.5
then

./configure -debug-and-release -prefix ./out QMAKE_APPLE_DEVICE_ARCHS=arm64 -skip qt3d -skip qtvirtualkeyboard

skip qt3d skip qtvirtualkeyboard because of build error! https://bugreports.qt.io/browse/QTBUG-98826

then choose open source, and choose yes.
check QDoc is config yes to install.!!!
then

make

If error occurred!:
M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第2张图片
open qiosurfacegraphicsbuffer.h then include :

#include 
#include 

M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第3张图片
make again and make install

make 
make install

If there are other errors, please follow the prompts and solve them one by one!!!
if build success,you will find lib in path:

~/Downloads/qt-everywhere-src-5.15.5/out
check bin/qdoc has build succeeed. it will build qt doc for qt assistant

make docs

make docs
make install_docs

out->bin:
M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第4张图片

7. Install Qt creator use Homebrew

Use homebrew (You can also use brew to install qt, but is newest. Not Qt5~)

brew install Qt Creator

M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第5张图片

8 Config Qt Creator

You will found .qch will be auto detected.if not you can add by youself.
M1 macOS Qt环境搭建 + Qt5.15源码编译 + Homebrew QtCreator 8_第6张图片
config Qt Version

find you qmake path ,and set it

config kits

open examples maybe get some trouble. x86_64 set in .pro

QMAKE_APPLE_DEVICE_ARCHS=arm64

debug into Qt source see:

click me

zhuang bi jie shu.

你可能感兴趣的:(Qt,qt,macos)