直播相关01-录制麦克风声音,QT上 .pro 将 linux,mac和windows上配置为三种可以共享, 在.pro文件中 message 的作用

一 QT 上的 .pro 文件 将 linux,mac和windows上配置设置为可以共享

1. 先来看文件夹布局

2. 再来看 QT 中的 .pro文件

.pro 文件的写法

复制代码
QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# 添加windows的配置,这里不管你是win32 还是 win64 ,都是统一使用 win32
win32 {

    FFMPEG_HOME = ../ffmpeg-6.0-full_build-shared
    SDL_HOME = ../SDL2-devel-2.0.14-mingw/SDL2-2.0.14/x86_64-w64-mingw32


#INCLUDEPATH += 的意思是再原先的INCLUDEPATH的基础上,再添加等号后面的值 $${SDL_HOME}的意思是从 SDL_HOME中取出值,也就是 ../sdl,
#连起来看,这句话的意思是,给原先的  INCLUDEPATH ,再加上 当前.pro文件的上一级目录下的/sdl/include
#INCLUDEPATH 的意思是添加 .h文件
INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


#LIBS 的意思是添加静态库和动态库的访问路径,
LIBS += -L$${SDL_HOME}/lib \
        -L$${FFMPEG_HOME}/lib \
            -lavcodec \
            -lavdevice \
            -lavfilter \
            -lavformat \
            -lavutil \
            -lpostproc \
            -lswscale \
            -lswresample \
            -lsdl2


# message()可以用来打印
message(11111111111)
message($${SDL_HOME})
message($${FFMPEG_HOME})
message($$(PATH))
}


mac {
    FFMPEG_HOME = /usr/local/Cellar/ffmpeg/4.3.2
    SDL_HOME = /usr/local/Cellar/SDL2-devel-2.0.14-mingw/SDL2-2.0.14/

    INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


    #LIBS 的意思是添加静态库和动态库的访问路径,
    LIBS += -L$${SDL_HOME}/lib \
            -L$${FFMPEG_HOME}/lib \
                -lavcodec \
                -lavdevice \
                -lavfilter \
                -lavformat \
                -lavutil \
                -lpostproc \
                -lswscale \
                -lswresample \
                -lsdl2
}

# 库文件路径
#mac:INCLUDEPATH += $${FFMPEG_HOME}/include

# 需要链接哪些库?默认是链接动态库
#mac:LIBS += -L $${FFMPEG_HOME}/lib \

message()方法可以在.pro文件中 打印相关信息

复制代码
# message()可以用来打印
message(11111111111)
message($${SDL_HOME})
message($${FFMPEG_HOME})
message($$(PATH))
可以看到message 打印相关的信息 是在 QT 的 "概要信息" 中的。

我们将信息分析如下:

复制代码
Project MESSAGE: 11111111111
Project MESSAGE: ../SDL2-devel-2.0.14-mingw/SDL2-2.0.14/x86_64-w64-mingw32
Project MESSAGE: ../ffmpeg-6.0-full_build-shared

/// PATH 信息,前三行为QT 安装的path,下来是 系统变量, 最后三行是Anminister的用户变量
Project MESSAGE: C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;
C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin;
C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;


D:\Ctool\ffmpeg-4.2.1-win32-shared\bin;
C:\Program Files (x86)\VMware\VMware Workstation\bin\;
D:\Ctool\yinshipin\ffmpeg-6.0-full_build-shared\bin;
C:\Program Files\Microsoft MPI\Bin\;
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\windows\system32;
C:\windows;
C:\windows\System32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;
C:\windows\System32\OpenSSH\;
C:\Program Files\dotnet\;
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;
C:\Program Files\IDM Computer Solutions\UltraEdit;
C:\Program Files\Git\cmd;
C:\Program Files\TortoiseGit\bin;
D:\Ctool\SDL2-devel-2.0.14-mingw\SDL2-2.0.14\x86_64-w64-mingw32\bin;
D:\Ctool\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\bin;
C:\Program Files\CMake\bin;
D:\Ctool\protobuf\protobuf-windows\bin;
D:\Ctool\protobuf\protobuf-windows\lib;
C:\Program Files\Java\jdk1.8.0_241\bin;
C:\Program Files\Microsoft VS Code\bin;
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64;
D:\Ctool\SDL2-devel-2.0.14-mingw\SDL2-2.0.14\x86_64-w64-mingw32\bin;
C:\Program Files\OpenSSL-Win64\bin;

C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
C:\Users\Administrator\.dotnet\tools;
C:\Program Files\JetBrains\CLion 2023.3.4\bin;

3.注意的问题

我们在这里 加载了 ffmpeg 库,加载了sdl的库,要注意的是:在加载多个第三方库的时候,INCLUDEPATH,LIBS时,只能写一个,不能写多个,否则build fail。

复制代码
INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


    #LIBS 的意思是添加静态库和动态库的访问路径,
    LIBS += -L$${SDL_HOME}/lib \
            -L$${FFMPEG_HOME}/lib \
                -lavcodec \
                -lavdevice \
                -lavfilter \
                -lavformat \
                -lavutil \
                -lpostproc \
                -lswscale \
                -lswresample \
                -lsdl2
相关推荐
Ulyanov3 小时前
AudioVision Pro:基于 PySide6 + sounddevice 的实时音频可视化播放器设计
python·算法·音视频
福大大架构师每日一题3 小时前
ComfyUI v0.34.0发布:视频、音频、三维、显存与合作节点全面更新
音视频
敲代码的嘎仔6 小时前
用 Redis 合并写 + DelayQueue 延迟检测,把视频播放进度写库频率降到 1/60
java·开发语言·数据库·redis·缓存·音视频·高并发
Xxtaoaooo7 小时前
AI 视频生成能不能真正跑通?MoneyPrinterTurbo 本地制作、远程访问与授权验证
人工智能·音视频·cpolar·ai视频·自动化短视频
bloxed8 小时前
“视频上看得见的洪水淹没预演”:视频数字孪生完整实践
音视频
angushine8 小时前
文本转视频
音视频
angushine9 小时前
文本转视频2
人工智能·音视频·语音识别
刘广睿10 小时前
给素材库加语音转写:Whisper 本地部署与批量字幕生成实践
人工智能·aigc·音视频·语音识别·效率工具
benbenAItalk19 小时前
数字人口播视频的批量生产实践:素材规范、任务编排与质量验收
java·前端·音视频
AI创界者1 天前
前沿多模态大模型 MiniMax-H3无审查 本地部署与深度实测指南
人工智能·aigc·音视频