improved project files

This commit is contained in:
Martchus 2015-12-08 08:38:26 +01:00
parent 736f8fc9a7
commit d9c197dcf2
6 changed files with 364 additions and 121 deletions

View File

@ -1,53 +1,243 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# add project files
set(HEADER_FILES
exceptions.h
mp4/mp4atom.h
mp4/mp4container.h
mp4/mp4ids.h
mp4/mp4tag.h
mp4/mp4tagfield.h
mp4/mp4track.h
mp4/mpeg4descriptor.h
# aac/aaccodebook.h
# aac/aacframe.h
abstractattachment.h
abstractchapter.h
abstractcontainer.h
abstracttrack.h
adts/adtsframe.h
adts/adtsstream.h
# avc/avcconfiguration.h
# avc/avcinfo.h
avi/bitmapinfoheader.h
backuphelper.h
basicfileinfo.h
caseinsensitivecomparer.h
mpegaudio/mpegaudioframe.h
mpegaudio/mpegaudioframestream.h
nestingsupportingtag.h
notification.h
ogg/oggcontainer.h
ogg/oggiterator.h
ogg/oggpage.h
ogg/oggstream.h
positioninset.h
signature.h
size.h
statusprovider.h
tag.h
tagtarget.h
tagvalue.h
vorbis/vorbiscomment.h
vorbis/vorbiscommentfield.h
vorbis/vorbiscommentids.h
vorbis/vorbisidentificationheader.h
vorbis/vorbispackagetypes.h
wav/waveaudiostream.h
fieldbasedtag.h
genericcontainer.h
genericfileelement.h
generictagfield.h
id3/id3genres.h
id3/id3v1tag.h
id3/id3v2frame.h
id3/id3v2frameids.h
id3/id3v2tag.h
localeawarestring.h
margin.h
matroska/matroskaid.h
matroska/ebmlelement.h
matroska/ebmlid.h
matroska/matroskaattachment.h
matroska/matroskachapter.h
matroska/matroskacodecid.h
matroska/matroskacontainer.h
matroska/matroskacues.h
matroska/matroskaeditionentry.h
matroska/matroskaseekinfo.h
matroska/matroskatag.h
matroska/matroskatagfield.h
matroska/matroskatagid.h
matroska/matroskatrack.h
mediafileinfo.h
mediaformat.h
)
set(SRC_FILES
mp4/mp4atom.cpp
mp4/mp4container.cpp
mp4/mp4ids.cpp
mp4/mp4tag.cpp
mp4/mp4tagfield.cpp
mp4/mp4track.cpp
mp4/mpeg4descriptor.cpp
# aac/aaccodebook.cpp
# aac/aacframe.cpp
abstractattachment.cpp
abstractchapter.cpp
abstractcontainer.cpp
abstracttrack.cpp
adts/adtsframe.cpp
adts/adtsstream.cpp
# avc/avcconfiguration.cpp
# avc/avcinfo.cpp
avi/bitmapinfoheader.cpp
backuphelper.cpp
basicfileinfo.cpp
exceptions.cpp
mpegaudio/mpegaudioframe.cpp
mpegaudio/mpegaudioframestream.cpp
notification.cpp
ogg/oggcontainer.cpp
ogg/oggiterator.cpp
ogg/oggpage.cpp
ogg/oggstream.cpp
signature.cpp
statusprovider.cpp
tag.cpp
tagtarget.cpp
tagvalue.cpp
vorbis/vorbiscomment.cpp
vorbis/vorbiscommentfield.cpp
vorbis/vorbiscommentids.cpp
vorbis/vorbisidentificationheader.cpp
wav/waveaudiostream.cpp
id3/id3genres.cpp
id3/id3v1tag.cpp
id3/id3v2frame.cpp
id3/id3v2frameids.cpp
id3/id3v2tag.cpp
localeawarestring.cpp
matroska/ebmlelement.cpp
matroska/matroskaattachment.cpp
matroska/matroskachapter.cpp
matroska/matroskacodecid.cpp
matroska/matroskacontainer.cpp
matroska/matroskacues.cpp
matroska/matroskaeditionentry.cpp
matroska/matroskaid.cpp
matroska/matroskaseekinfo.cpp
matroska/matroskatag.cpp
matroska/matroskatagfield.cpp
matroska/matroskatagid.cpp
matroska/matroskatrack.cpp
mediafileinfo.cpp
mediaformat.cpp
)
# meta data
set(META_PROJECT_NAME tagparser)
set(META_APP_NAME "Tag Parser")
set(META_APP_AUTHOR "Martchus")
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis and Matroska tags.")
set(META_VERSION_MAJOR 3)
set(META_APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis and Matroska tags.")
set(META_VERSION_MAJOR 4)
set(META_VERSION_MINOR 0)
set(META_VERSION_PATCH 0)
# define project
project(${META_PROJECT_NAME})
# stringification of meta data
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
set(META_APP_URL_STR "\"${META_APP_URL}\"")
set(APP_DESCRIPTION_STR "\"${APP_DESCRIPTION}\"")
set(META_APP_VERSION_STR "\"${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}\"")
set(META_APP_DESCRIPTION_STR "\"${META_APP_DESCRIPTION}\"")
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
set(META_APP_VERSION_STR "\"${META_APP_VERSION}\"")
# define project
project(${META_PROJECT_NAME})
# add configuration header
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
configure_file(
"${PROJECT_SOURCE_DIR}/resources/config.h.in"
"${PROJECT_BINARY_DIR}/resources/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
# add source and header files
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp" "*.c")
file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
# add windows resource file
if(MINGW)
# creation windows icon from png with ffmpeg if available
find_program(FFMPEG_BIN ffmpeg avconv)
if(FFMPEG_BIN)
set(PNG_ICON_PATH "${PROJECT_SOURCE_DIR}/resources/icons/hicolor/128x128/apps/${META_PROJECT_NAME}.png")
if(EXISTS ${PNG_ICON_PATH})
set(WINDOWS_ICON_PATH "${PROJECT_BINARY_DIR}/${META_PROJECT_NAME}.ico")
set(WINDOWS_ICON_RC_ENTRY "IDI_ICON1 ICON DISCARDABLE \"${WINDOWS_ICON_PATH}\"")
add_custom_command(
OUTPUT "${WINDOWS_ICON_PATH}"
COMMAND ${FFMPEG_BIN} -y -i "${PNG_ICON_PATH}" -vf crop=iw-20:ih-20:10:10,scale=64:64 "${WINDOWS_ICON_PATH}"
)
endif()
endif(FFMPEG_BIN)
# create windows rc file from template
set(WINDOWS_EXT "dll")
configure_file(
"${PROJECT_SOURCE_DIR}/resources/windows.rc.in"
"${PROJECT_BINARY_DIR}/resources/windows.rc"
)
# set windres as resource compiler
set(RES_FILES "${PROJECT_BINARY_DIR}/resources/windows.rc")
set(CMAKE_RC_COMPILER_INIT windres)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
enable_language(RC)
endif(MINGW)
# remove library prefix when building with mingw-w64 (just for consistancy with qmake)
if(MINGW)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif(MINGW)
# executable and linking
add_library(${META_PROJECT_NAME} SHARED ${HEADER_FILES} ${SRC_FILES})
target_link_libraries(${META_PROJECT_NAME} c++utilities)
set_target_properties(${META_PROJECT_NAME} PROPERTIES VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH} SOVERSION ${META_VERSION_MAJOR})
# enable C++11
set_property(TARGET ${META_PROJECT_NAME} PROPERTY CXX_STANDARD 11)
add_library(${META_PROJECT_NAME} SHARED ${HEADER_FILES} ${SRC_FILES} ${RES_FILES} ${WINDOWS_ICON_PATH})
target_link_libraries(${META_PROJECT_NAME} c++utilities z)
set_target_properties(${META_PROJECT_NAME} PROPERTIES
VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}
SOVERSION ${META_VERSION_MAJOR}
CXX_STANDARD 11
)
# add install target
install(TARGETS ${META_PROJECT_NAME}
RUNTIME DESTINATION bin
COMPONENT binary
LIBRARY DESTINATION lib
COMPONENT binary
ARCHIVE DESTINATION lib
COMPONENT binary
)
foreach(HEADER_FILE ${HEADER_FILES})
get_filename_component(HEADER_DIR ${HEADER_FILE} DIRECTORY)
install(FILES ${HEADER_FILE} DESTINATION include/${META_PROJECT_NAME}/${HEADER_DIR})
install(
FILES ${HEADER_FILE}
DESTINATION include/${META_PROJECT_NAME}/${HEADER_DIR}
COMPONENT header
)
endforeach()
add_custom_target(install-binary
DEPENDS ${META_PROJECT_NAME}
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
add_custom_target(install-header
DEPENDS ${META_PROJECT_NAME}
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=header -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
add_custom_target(install-mingw-w64
DEPENDS install-binary install-header
)
add_custom_target(install-binary-strip
DEPENDS ${META_PROJECT_NAME}
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
add_custom_target(install-mingw-w64-strip
DEPENDS install-binary-strip install-header
)

View File

@ -1,28 +1,12 @@
#dirs
# specify build directories for moc, object and rcc files
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
RCC_DIR = ./res
# compiler flags
# compiler flags: enable C++11
QMAKE_CXXFLAGS += -std=c++11
QMAKE_LFLAGS += -std=c++11
# prefix
targetprefix = $$(TARGET_PREFIX)
message("Using target prefix \"$${targetprefix}\".")
# print install root
message("Using install root \"$$(INSTALL_ROOT)\".")
# target
CONFIG(debug, debug|release) {
TARGET = $${targetprefix}$${projectname}d
} else {
TARGET = $${targetprefix}$${projectname}
}
# add defines
DEFINES += "APP_METADATA_AVAIL"
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
DEFINES += "'APP_NAME=\"$${appname}\"'"
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
DEFINES += "'APP_URL=\"$${appurl}\"'"
DEFINES += "'APP_VERSION=\"$${VERSION}\"'"
# variables to check target architecture
win32-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
win32-g++-32:QMAKE_TARGET.arch = x86
@ -30,7 +14,30 @@ win32-g++-64:QMAKE_TARGET.arch = x86_64
linux-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
linux-g++-32:QMAKE_TARGET.arch = x86
linux-g++-64:QMAKE_TARGET.arch = x86_64
# configuration
# determine and print target prefix
targetprefix = $$(TARGET_PREFIX)
message("Using target prefix \"$${targetprefix}\".")
# print install root
message("Using install root \"$$(INSTALL_ROOT)\".")
# set target
CONFIG(debug, debug|release) {
TARGET = $${targetprefix}$${projectname}d
} else {
TARGET = $${targetprefix}$${projectname}
}
# add defines for meta data
DEFINES += "APP_METADATA_AVAIL"
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
DEFINES += "'APP_NAME=\"$${appname}\"'"
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
DEFINES += "'APP_URL=\"$${appurl}\"'"
DEFINES += "'APP_VERSION=\"$${VERSION}\"'"
# configure Qt modules and defines
mobile {
DEFINES += CONFIG_MOBILE
} else:desktop {
@ -61,7 +68,7 @@ no-gui {
}
guiqtquick {
message("Configured for Qt Quick GUI support.")
greaterThan(QT_MAJOR_VERSION, 4): QT += quick
QT += quick
CONFIG(debug, debug|release) {
CONFIG += qml_debug
}
@ -69,11 +76,12 @@ guiqtquick {
}
guiqtwidgets {
message("Configured for Qt widgets GUI support.")
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += widgets
DEFINES += GUI_QTWIDGETS
DEFINES += MODEL_UNDO_SUPPORT
}
# Windows stuff: configuration for cross compliation with mingw-w64
# configuration for cross compliation with mingw-w64
win32 {
QMAKE_TARGET_PRODUCT = "$${appname}"
QMAKE_TARGET_COPYRIGHT = "by $${appauthor}"

View File

@ -11,7 +11,7 @@
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#include "resources/config.h"
#endif
#include <c++utilities/conversion/stringconversion.h>

40
resources/windows.rc.in Normal file
View File

@ -0,0 +1,40 @@
# if defined(UNDER_CE)
# include <winbase.h>
# else
# include <windows.h>
# endif
@WINDOWS_ICON_RC_ENTRY@
VS_VERSION_INFO VERSIONINFO
FILEVERSION @META_VERSION_MAJOR@,@META_VERSION_MINOR@,@META_VERSION_PATCH@,0
PRODUCTVERSION @META_VERSION_MAJOR@,@META_VERSION_MINOR@,@META_VERSION_PATCH@,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "@META_APP_AUTHOR@\0"
VALUE "FileDescription", "@META_APP_DESCRIPTION@.\0"
VALUE "FileVersion", "@META_APP_VERSION@\0"
VALUE "LegalCopyright", "by @META_APP_AUTHOR@\0"
VALUE "OriginalFilename", "@META_PROJECT_NAME@.@WINDOWS_EXT@\0"
VALUE "ProductName", "@META_APP_NAME@\0"
VALUE "ProductVersion", "@META_APP_VERSION@\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1200
END
END
/* End of Version info */

View File

@ -1,9 +1,10 @@
# meta data
projectname = tagparser
appname = "Tag Parser"
appauthor = Martchus
appurl = "https://github.com/$${appauthor}/$${projectname}"
QMAKE_TARGET_DESCRIPTION = "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis and Matroska tags."
VERSION = 3.0.0
VERSION = 4.0.0
# include ../../common.pri when building as part of a subdirs project; otherwise include general.pri
!include(../../common.pri) {
@ -12,70 +13,20 @@ VERSION = 3.0.0
}
}
# basic configuration: shared library, no Qt
TEMPLATE = lib
CONFIG -= qt
CONFIG += shared
# add defines for configuration
underconstruction {
DEFINES += UNDER_CONSTRUCTION
}
forcefullparsedefault {
DEFINES += FORCE_FULL_PARSE_DEFAULT
}
SOURCES += \
abstractcontainer.cpp \
abstracttrack.cpp \
backuphelper.cpp \
basicfileinfo.cpp \
exceptions.cpp \
id3/id3genres.cpp \
id3/id3v1tag.cpp \
id3/id3v2frame.cpp \
id3/id3v2frameids.cpp \
id3/id3v2tag.cpp \
matroska/ebmlelement.cpp \
matroska/matroskacodecid.cpp \
matroska/matroskacontainer.cpp \
matroska/matroskaid.cpp \
matroska/matroskatag.cpp \
matroska/matroskatagfield.cpp \
matroska/matroskatagid.cpp \
matroska/matroskatrack.cpp \
matroska/matroskaseekinfo.cpp \
matroska/matroskacues.cpp \
mediafileinfo.cpp \
mp4/mp4atom.cpp \
mp4/mp4container.cpp \
mp4/mp4ids.cpp \
mp4/mp4tag.cpp \
mp4/mp4tagfield.cpp \
mp4/mp4track.cpp \
mpegaudio/mpegaudioframe.cpp \
mpegaudio/mpegaudioframestream.cpp \
notification.cpp \
signature.cpp \
statusprovider.cpp \
tag.cpp \
tagtarget.cpp \
tagvalue.cpp \
wav/waveaudiostream.cpp \
ogg/oggpage.cpp \
vorbis/vorbiscomment.cpp \
vorbis/vorbiscommentfield.cpp \
ogg/oggstream.cpp \
ogg/oggcontainer.cpp \
vorbis/vorbisidentificationheader.cpp \
ogg/oggiterator.cpp \
vorbis/vorbiscommentids.cpp \
abstractchapter.cpp \
matroska/matroskaeditionentry.cpp \
matroska/matroskachapter.cpp \
abstractattachment.cpp \
matroska/matroskaattachment.cpp \
mediaformat.cpp \
mp4/mpeg4descriptor.cpp \
avi/bitmapinfoheader.cpp \
adts/adtsframe.cpp \
adts/adtsstream.cpp
# add project files
HEADERS += \
abstractcontainer.h \
abstracttrack.h \
@ -144,35 +95,90 @@ HEADERS += \
adts/adtsstream.h \
caseinsensitivecomparer.h
underconstruction {
SOURCES += \
aac/aacframe.cpp \
aac/aaccodebook.cpp \
avc/avcinfo.cpp \
avc/avcconfiguration.cpp
abstractcontainer.cpp \
abstracttrack.cpp \
backuphelper.cpp \
basicfileinfo.cpp \
exceptions.cpp \
id3/id3genres.cpp \
id3/id3v1tag.cpp \
id3/id3v2frame.cpp \
id3/id3v2frameids.cpp \
id3/id3v2tag.cpp \
matroska/ebmlelement.cpp \
matroska/matroskacodecid.cpp \
matroska/matroskacontainer.cpp \
matroska/matroskaid.cpp \
matroska/matroskatag.cpp \
matroska/matroskatagfield.cpp \
matroska/matroskatagid.cpp \
matroska/matroskatrack.cpp \
matroska/matroskaseekinfo.cpp \
matroska/matroskacues.cpp \
mediafileinfo.cpp \
mp4/mp4atom.cpp \
mp4/mp4container.cpp \
mp4/mp4ids.cpp \
mp4/mp4tag.cpp \
mp4/mp4tagfield.cpp \
mp4/mp4track.cpp \
mpegaudio/mpegaudioframe.cpp \
mpegaudio/mpegaudioframestream.cpp \
notification.cpp \
signature.cpp \
statusprovider.cpp \
tag.cpp \
tagtarget.cpp \
tagvalue.cpp \
wav/waveaudiostream.cpp \
ogg/oggpage.cpp \
vorbis/vorbiscomment.cpp \
vorbis/vorbiscommentfield.cpp \
ogg/oggstream.cpp \
ogg/oggcontainer.cpp \
vorbis/vorbisidentificationheader.cpp \
ogg/oggiterator.cpp \
vorbis/vorbiscommentids.cpp \
abstractchapter.cpp \
matroska/matroskaeditionentry.cpp \
matroska/matroskachapter.cpp \
abstractattachment.cpp \
matroska/matroskaattachment.cpp \
mediaformat.cpp \
mp4/mpeg4descriptor.cpp \
avi/bitmapinfoheader.cpp \
adts/adtsframe.cpp \
adts/adtsstream.cpp
underconstruction {
HEADERS += \
aac/aacframe.h \
aac/aaccodebook.h \
avc/avcinfo.h \
avc/avcconfiguration.h
}
LIBS += -lz
CONFIG(debug, debug|release) {
LIBS += -lc++utilitiesd
} else {
LIBS += -lc++utilities
}
forcefullparsedefault {
DEFINES += FORCE_FULL_PARSE_DEFAULT
SOURCES += \
aac/aacframe.cpp \
aac/aaccodebook.cpp \
avc/avcinfo.cpp \
avc/avcconfiguration.cpp
}
OTHER_FILES += \
README.md \
LICENSE
LICENSE \
CMakeLists.txt \
resources/config.h.in \
resources/windows.rc.in
# add libs
CONFIG(debug, debug|release) {
LIBS += -lc++utilitiesd
} else {
LIBS += -lc++utilities
}
LIBS += -lz
# installs
mingw-w64-install {
@ -192,4 +198,3 @@ for(dir, $$list(./ avc adts id3 matroska mp4 mpegaudio ogg vorbis wav avi)) {
inc_$${dir}.files = $${dir}/*.h
INSTALLS += inc_$${dir}
}