added simple CMake project file
This commit is contained in:
parent
938b85eb58
commit
b7553ada41
|
@ -0,0 +1,60 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
# meta data
|
||||||
|
set(META_PROJECT_NAME dbus-soundrecorder)
|
||||||
|
set(META_APP_NAME "D-Bus Sound Recorder")
|
||||||
|
set(META_APP_AUTHOR "Martchus")
|
||||||
|
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||||
|
set(META APP_DESCRIPTION "Records sound from Pulse Audio with ffmpeg while watching D-Bus to determine tracks and meta information.")
|
||||||
|
set(META_VERSION_MAJOR 1)
|
||||||
|
set(META_VERSION_MINOR 1)
|
||||||
|
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} "*.cpp")
|
||||||
|
file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
|
||||||
|
file(GLOB_RECURSE DBUS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "org.*.xml")
|
||||||
|
|
||||||
|
# check required Qt 5 modules
|
||||||
|
find_package(Qt5Core REQUIRED)
|
||||||
|
find_package(Qt5DBus REQUIRED)
|
||||||
|
|
||||||
|
# enable moc
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
# generate DBus interfaces
|
||||||
|
qt5_add_dbus_interfaces(SRC_FILES ${DBUS_FILES})
|
||||||
|
add_definitions(-DCMAKE_BUILD)
|
||||||
|
|
||||||
|
# executable and linking
|
||||||
|
add_executable(${META_PROJECT_NAME} ${HEADER_FILES} ${SRC_FILES})
|
||||||
|
target_link_libraries(${META_PROJECT_NAME} c++utilities Qt5::Core Qt5::DBus)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
)
|
|
@ -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
|
|
@ -1,5 +1,4 @@
|
||||||
#dirs
|
#dirs
|
||||||
UI_DIR = ./gui
|
|
||||||
MOC_DIR = ./moc
|
MOC_DIR = ./moc
|
||||||
OBJECTS_DIR = ./obj
|
OBJECTS_DIR = ./obj
|
||||||
RCC_DIR = ./res
|
RCC_DIR = ./res
|
||||||
|
@ -18,6 +17,7 @@ CONFIG(debug, debug|release) {
|
||||||
TARGET = $${targetprefix}$${projectname}
|
TARGET = $${targetprefix}$${projectname}
|
||||||
}
|
}
|
||||||
# add defines
|
# add defines
|
||||||
|
DEFINES += "APP_METADATA_AVAIL"
|
||||||
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
|
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
|
||||||
DEFINES += "'APP_NAME=\"$${appname}\"'"
|
DEFINES += "'APP_NAME=\"$${appname}\"'"
|
||||||
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
|
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
|
||||||
|
|
5
main.cpp
5
main.cpp
|
@ -1,6 +1,11 @@
|
||||||
#include "playerwatcher.h"
|
#include "playerwatcher.h"
|
||||||
#include "ffmpeglauncher.h"
|
#include "ffmpeglauncher.h"
|
||||||
|
|
||||||
|
// include configuration from separate header file when building with CMake
|
||||||
|
#ifndef APP_METADATA_AVAIL
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <c++utilities/application/argumentparser.h>
|
#include <c++utilities/application/argumentparser.h>
|
||||||
#include <c++utilities/application/failure.h>
|
#include <c++utilities/application/failure.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#include "playerwatcher.h"
|
#include "playerwatcher.h"
|
||||||
|
|
||||||
#include "player_interface.h"
|
#ifdef CMAKE_BUILD
|
||||||
#include "properties_interface.h"
|
# include "playerinterface.h"
|
||||||
|
# include "propertiesinterface.h"
|
||||||
|
#else
|
||||||
|
# include "player_interface.h"
|
||||||
|
# include "properties_interface.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QDBusServiceWatcher>
|
#include <QDBusServiceWatcher>
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
|
|
Loading…
Reference in New Issue