Commit 5d736f17 authored by Linus Jahn's avatar Linus Jahn Committed by GitHub

Pass version and name variables from cmake to C++ (#43)

New global variables in C++ are:
	APPLICATION_NAME
	APPLICATION_DISPLAY_NAME
	APPLICATION_ID
	VERSION_STRING
parent 8b3e7a53
......@@ -3,13 +3,17 @@ set(QT_MIN_VERSION "5.5.0")
project(kaidan)
# application name
set(APPLICATION_ID "harbour.kaidan")
set(APPLICATION_NAME "kaidan")
set(APPLICATION_DISPLAY_NAME "Kaidan")
# Version
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
# Version string
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if(VERSION_EXTRA)
set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
......@@ -56,3 +60,12 @@ target_link_libraries(${PROJECT_NAME}
${SWIFTEN_LIBRARY}
${Boost_LIBRARY}
)
# Pass variables to C++
target_compile_definitions(${PROJECT_NAME} PRIVATE
APPLICATION_ID="${APPLICATION_ID}"
APPLICATION_NAME="${APPLICATION_NAME}"
APPLICATION_DISPLAY_NAME="${APPLICATION_DISPLAY_NAME}"
VERSION_STRING="${VERSION_STRING}"
)
......@@ -41,7 +41,7 @@ void Kaidan::mainConnect(const QString &jid, const QString &pass){
tracer = new Swift::ClientXMLTracer(client);
softwareVersionResponder = new Swift::SoftwareVersionResponder(client->getIQRouter());
softwareVersionResponder->setVersion("Kaidan", "0.1");
softwareVersionResponder->setVersion(APPLICATION_DISPLAY_NAME, VERSION_STRING);
softwareVersionResponder->start();
client->addPayloadParserFactory(&echoPayloadParserFactory);
......
// Qt
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QQmlContext>
#include <QtQml>
// Swiften
#include "Swiften/EventLoop/Qt/QtEventLoop.h"
// Kaidan
#include "Kaidan.h"
#include "RosterController.h"
#include "RosterItem.h"
int main(int argc, char *argv[])
{
qmlRegisterType<RosterController>( "harbour.kaidan", 1, 0, "RosterController");
qmlRegisterType<RosterItem>( "harbour.kaidan", 1, 0, "RosterItem");
qmlRegisterType<RosterController>(APPLICATION_ID, 1, 0, "RosterController");
qmlRegisterType<RosterItem>(APPLICATION_ID, 1, 0, "RosterItem");
QGuiApplication app(argc, argv);
QGuiApplication::setApplicationName(APPLICATION_NAME);
QGuiApplication::setApplicationDisplayName(APPLICATION_DISPLAY_NAME);
QGuiApplication::setApplicationVersion(VERSION_STRING);
QtEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment