使用CMAKE 配置TagLIb QT5 编译使用TagLib

TagLib Qt
0 102
suoniao 2021-01-20
需要:0索币

需要使用TagLib读取媒体信息, 记录下编译过程

使用的文件,

  • 使用Taglib库版本 1.6.3
  • QT版本 5.12.3 x32 MinGW
  • CMAKE版本 3.9.0

全程参考: https://www.joelverhagen.com/blog/2010/11/how-to-compile-taglib-on-windows/

使用CMAKE 配置TagLIb

tagLib解压后如下:

image

配置环境变量
选择mingw的bin路径,如下图
image.png

打开Cmake,在Cmake中选择对应目录
如下图是我的选择,基于taglib的解压目录
image.png

之后点击Configure按钮,选择如下
image.png

再次点击Configure如下,勾选图中 WITH_ASF, WITH_MP4
image.png

选择上图中Generate,

在Qt Creator中编译 taglib

之前在终端下编译,,编译成功,但用起来报错,换Qt Creator中ok,应该配置有问题,不深究.
使用的pro文件见文末附件
在QtCreator中设置如下工程

点击QMake 选择Release版本进行编译


image.png

编译完成后就在对应目录找到.a 和.dll文件


image.png

之后添加头文件和库文件到你需要使用的工程中即可,添加方式参考如下:


image.png

之后就可以在QT中正常使用 taglib

pro文件参考

TEMPLATE = lib

INCLUDEPATH += D:/Libraries/taglib-1.6.3
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/ape
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/asf
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/flac
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mp4
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mpc
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mpeg
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/ogg
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/riff
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/toolkit
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/trueaudio
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/wavpack
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v1
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/ogg/flac
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/ogg/speex
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/ogg/vorbis
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/riff/aiff
INCLUDEPATH += D:/Libraries/taglib-1.6.3/taglib/riff/wav

HEADERS += D:/Libraries/taglib-1.6.3/taglib/audioproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/fileref.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/tag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/taglib_export.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/tagunion.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ape/apefooter.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ape/apeitem.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ape/apetag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/asf/asfattribute.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/asf/asffile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/asf/asfproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/asf/asftag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/flac/flacfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/flac/flacproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4atom.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4coverart.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4file.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4item.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4properties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4tag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpc/mpcfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpc/mpcproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegheader.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/xingheader.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v1/id3v1genres.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v1/id3v1tag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2extendedheader.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2footer.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2frame.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2framefactory.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2header.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2synchdata.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2tag.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/attachedpictureframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/commentsframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/popularimeterframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/privateframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/relativevolumeframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/textidentificationframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/unknownframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/urllinkframe.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/oggfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/oggpage.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/oggpageheader.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/xiphcomment.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/flac/oggflacfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/speex/speexfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/speex/speexproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/vorbis/vorbisfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/ogg/vorbis/vorbisproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/riff/rifffile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/riff/aiff/aifffile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/riff/aiff/aiffproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/riff/wav/wavfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/riff/wav/wavproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/taglib.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tbytevector.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tbytevectorlist.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tdebug.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tlist.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tmap.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tstring.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/tstringlist.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/toolkit/unicode.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/trueaudio/trueaudiofile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/trueaudio/trueaudioproperties.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/wavpack/wavpackfile.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib/wavpack/wavpackproperties.h

SOURCES += D:/Libraries/taglib-1.6.3/taglib/audioproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/fileref.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/tag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/tagunion.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ape/apefooter.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ape/apeitem.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ape/apetag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/asf/asfattribute.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/asf/asffile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/asf/asfproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/asf/asftag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/flac/flacfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/flac/flacproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4atom.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4coverart.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4file.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4item.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4properties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mp4/mp4tag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpc/mpcfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpc/mpcproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegheader.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/mpegproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/xingheader.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v1/id3v1genres.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v1/id3v1tag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2extendedheader.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2footer.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2frame.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2framefactory.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2header.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2synchdata.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/id3v2tag.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/commentsframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/popularimeterframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/privateframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/unknownframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/mpeg/id3v2/frames/urllinkframe.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/oggfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/oggpage.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/oggpageheader.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/xiphcomment.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/flac/oggflacfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/speex/speexfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/speex/speexproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/vorbis/vorbisfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/ogg/vorbis/vorbisproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/riff/rifffile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/riff/aiff/aifffile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/riff/aiff/aiffproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/riff/wav/wavfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/riff/wav/wavproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tbytevector.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tbytevectorlist.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tdebug.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tstring.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/tstringlist.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/toolkit/unicode.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/trueaudio/trueaudiofile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/trueaudio/trueaudioproperties.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/wavpack/wavpackfile.cpp
SOURCES += D:/Libraries/taglib-1.6.3/taglib/wavpack/wavpackproperties.cpp

HEADERS += D:/Libraries/taglib-1.6.3/config.h
HEADERS += D:/Libraries/taglib-1.6.3/taglib_config.h

DEFINES += MAKE_TAGLIB_LIB
DEFINES += WITH_ASF
DEFINES += WITH_MP4

QT -= gui

CONFIG(debug, debug|release) {
    DEFINES += _DEBUG
    DESTDIR = ../taglib-debug
    OBJECTS_DIR = ./debug-o
} else {
    DESTDIR = ../taglib-release
    OBJECTS_DIR = ./release-o
}

win32 {
    CONFIG += dll
}


作者:WH韩非子
链接:https://www.jianshu.com/p/d4dab36a3da2
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
回帖
  • 消灭零回复
广告位招租 100元/月 广告位招租 100元/月
相关主题
QT程序闪退错误捕获教程利用DbgHelp 错误调试技术 0
使用CMAKE 配置TagLIb QT5 编译使用TagLib 0
QT实现Excel文件转CSV文件利用QAxObject库 0
QT实现Excel转PDF利用QAxObject库 0
Qt利用QAxWidget读取excel文件 0
Qt条件变量QWaitCondition使用教程 0
Qtcreator cannot open output file debug/suoniao.exe:Permission denied 0
Qt的对象树模型 Qt内存泄漏的原因分析 0
Qt有关QdateTime方法详解 0
Qt基础教程值QByteArray字节容器的使用详解 0
Qt读取打印机设备列表QPrinterInfo类实现 0
Qt利用QFile和QTextStream实现文件的读和写 0
Qt利用map映射读取超大文件 0
Qt高频率读取串口或者写入串口导致运行程序内存占用不断提升 0
QT实现HTTP协议 出现failed to load resource : net :: ERR_CONNECTION_RESET 0
C++相关视频教程合辑 0
C++界面库 Qt嵌入式开发从入门到精通 1604 0
c++就业班13期完整教程 2339 0
就业班C++培训完整版教程移动打车项目安全传输平台项目2504 0
C语言和C++就业班15期培训教程2502 0
相关主题
索鸟快传2.1.0版本发布 0
golang网络数据读取timeout的处理 – 以SetReadDeadline为例 0
索鸟网广告位招租 0
golang利用通道chan实现一个通用的TCP连接池 0
frpc和frps的交互流程详解了解了frp是如何进行TCP代理的 0
golang实现内存池 go语言字节池byte pool实现代码 0
golang网络编程之基于TCP协议实现长连接 golang心跳检测 0
国产光刻机产业链最新核心材料ArF 193nm光刻胶通过用户认证 0
javascript数组相关函数length属性、delete关键字、pop()栈方法、shift() 0
Qt为我们提供了几个可以用于线程Sleep的函数msleep和usleep 0
QT程序闪退错误捕获教程利用DbgHelp 错误调试技术 0
简单快速修改Qtcreator项目工程的名称 0
golang 的interface接口类型断言 0
golang类型断言type的使用 0
golang依赖包管理 mod使用教程 0
golang表单验证库validator 0
如何使用Go语言实现一个简单的异步任务框架呢?生产者消费者模型 0
内网穿透反向代理工具frp实现TCP协议代理源码分析 0
内网穿透反向代理库frp的实现原理分析一 0
什么是socks5?socks5 是一个简单的代理协议 0