added simple CMake project file

This commit is contained in:
Martchus 2015-12-05 22:55:05 +01:00
parent 9e82fcbe64
commit c3417c5d2a
11 changed files with 105 additions and 16 deletions

70
CMakeLists.txt Normal file
View File

@ -0,0 +1,70 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# meta data
set(META_PROJECT_NAME tageditor)
set(META_APP_NAME "Tag Editor")
set(META_APP_AUTHOR "Martchus")
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META APP_DESCRIPTION "A tageditor with Qt GUI and command line interface. Supports MP4 (iTunes), ID3, Vorbis and Matroska.")
set(META_VERSION_MAJOR 1)
set(META_VERSION_MINOR 2)
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}\"")
# add configuration header
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
# add source and header files
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "application/*.cpp" "cli/*.cpp" "misc/*.cpp")
file(GLOB_RECURSE WIDGETS_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.cpp" "renamingutility/*.cpp" "resources/icons.qrc")
file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "application/*.h" "cli/*.h" "misc/*.h")
file(GLOB_RECURSE WIDGETS_HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.h" "renamingutility/*.cpp")
# enable only Qt Widgets GUI
add_definitions(-DGUI_QTWIDGETS -DMODEL_UNDO_SUPPORT)
# check required Qt 5 modules
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5WebKit REQUIRED)
# enable moc, uic and rcc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# executable and linking
add_executable(${META_PROJECT_NAME} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES})
target_link_libraries(${META_PROJECT_NAME} c++utilities qtutilities tagparser Qt5::Core Qt5::Widgets Qt5::WebKit)
# enable C++11
set_property(TARGET ${META_PROJECT_NAME} PROPERTY CXX_STANDARD 11)
# add install target
install(TARGETS ${META_PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
DESTINATION share/icons/hicolor/scalable/apps
)
install(FILES resources/desktop/applications/${META_PROJECT_NAME}.desktop
DESTINATION share/applications
)

View File

@ -7,6 +7,11 @@
#elif defined(GUI_QTQUICK)
#endif
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
# include <qtutilities/resources/qtconfigarguments.h>
#else

9
config.h.in Normal file
View File

@ -0,0 +1,9 @@
#ifndef APP_METADATA_AVAIL
#define APP_METADATA_AVAIL
#define PROJECT_NAME @META_PROJECT_NAME_STR@
#define APP_NAME @META_APP_NAME_STR@
#define APP_VERSION @META_APP_VERSION_STR@
#define APP_AUTHOR @META_APP_AUTHOR_STR@
#define APP_URL @META_APP_URL_STR@
#define APP_DESCRIPTION @META_APP_DESCRIPTION_STR@
#endif // APP_METADATA_AVAIL

View File

@ -1,5 +1,4 @@
#dirs
UI_DIR = ./gui
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
RCC_DIR = ./res
@ -18,6 +17,7 @@ CONFIG(debug, debug|release) {
TARGET = $${targetprefix}$${projectname}
}
# add defines
DEFINES += "APP_METADATA_AVAIL"
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
DEFINES += "'APP_NAME=\"$${appname}\"'"
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"

View File

@ -2,7 +2,7 @@
#include "./attachmentsmodel.h"
#include "gui/ui_attachmentsedit.h"
#include "ui_attachmentsedit.h"
#include <tagparser/mediafileinfo.h>
#include <tagparser/abstractattachment.h>

View File

@ -1,6 +1,6 @@
#include "./entertargetdialog.h"
#include "gui/ui_entertargetdialog.h"
#include "ui_entertargetdialog.h"
#include <tagparser/signature.h>
#include <tagparser/mediafileinfo.h>

View File

@ -3,6 +3,11 @@
#include "../application/settings.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#include <qtutilities/resources/qtconfigarguments.h>
#include <qtutilities/resources/resources.h>

View File

@ -10,7 +10,7 @@
#include "../misc/htmlinfo.h"
#include "../misc/utility.h"
#include "gui/ui_mainwindow.h"
#include "ui_mainwindow.h"
#include <tagparser/exceptions.h>
#include <tagparser/signature.h>

View File

@ -3,7 +3,7 @@
#include "../application/settings.h"
#include "../misc/utility.h"
#include "gui/ui_picturepreviewselection.h"
#include "ui_picturepreviewselection.h"
#include <tagparser/mediafileinfo.h>
#include <tagparser/tag.h>

View File

@ -6,7 +6,7 @@
#include "../renamingutility/filesystemitemmodel.h"
#include "../renamingutility/filteredfilesystemitemmodel.h"
#include "gui/ui_renamefilesdialog.h"
#include "ui_renamefilesdialog.h"
#include <qtutilities/misc/dialogutils.h>

View File

@ -1,16 +1,16 @@
#ifndef ID3V2OPTIONPAGE_H
#define ID3V2OPTIONPAGE_H
#include "gui/ui_filebrowsergeneraloptionpage.h"
#include "gui/ui_editorgeneraloptionpage.h"
#include "gui/ui_editortempoptionpage.h"
#include "gui/ui_editorfieldsoptionpage.h"
#include "gui/ui_editorautocorrectionoptionpage.h"
#include "gui/ui_infooptionpage.h"
#include "gui/ui_tagprocessinggeneraloptionpage.h"
#include "gui/ui_id3v1optionpage.h"
#include "gui/ui_id3v2optionpage.h"
#include "gui/ui_filelayout.h"
#include "ui_filebrowsergeneraloptionpage.h"
#include "ui_editorgeneraloptionpage.h"
#include "ui_editortempoptionpage.h"
#include "ui_editorfieldsoptionpage.h"
#include "ui_editorautocorrectionoptionpage.h"
#include "ui_infooptionpage.h"
#include "ui_tagprocessinggeneraloptionpage.h"
#include "ui_id3v1optionpage.h"
#include "ui_id3v2optionpage.h"
#include "ui_filelayout.h"
#include <qtutilities/settingsdialog/settingsdialog.h>
#include <qtutilities/settingsdialog/optionpage.h>