Commit e52f5a72 authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2093 from dogmaphobic/gitVersion

Some work for iOS
parents af824e20 a2ebe500
......@@ -18,7 +18,6 @@
# -------------------------------------------------
include(QGCCommon.pri)
include(git_version.pri)
TARGET = qgroundcontrol
TEMPLATE = app
......@@ -447,7 +446,7 @@ SOURCES += src/QmlControls/QmlTestWidget.cc
!MobileBuild {
INCLUDEPATH += \
src/qgcunittest
src/qgcunittest
HEADERS += \
src/FactSystem/FactSystemTestBase.h \
......
......@@ -69,6 +69,16 @@ MobileBuild {
DEFINES += __mobile__
}
# set the QGC version from git
exists ($$PWD/.git) {
GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
} else {
GIT_DESCRIBE = None
}
DEFINES += GIT_VERSION=\"\\\"$$GIT_DESCRIBE\\\"\"
# Installer configuration
installer {
......@@ -161,11 +171,11 @@ MacBuild {
}
LinuxBuild {
DEFINES += __STDC_LIMIT_MACROS
DEFINES += __STDC_LIMIT_MACROS
}
WindowsBuild {
DEFINES += __STDC_LIMIT_MACROS
DEFINES += __STDC_LIMIT_MACROS
}
#
......@@ -177,14 +187,14 @@ WindowsBuild {
#
MacBuild | LinuxBuild {
QMAKE_CXXFLAGS_WARN_ON += -Wall
QMAKE_CXXFLAGS_WARN_ON += -Wall
WarningsAsErrorsOn {
QMAKE_CXXFLAGS_WARN_ON += -Werror
}
}
WindowsBuild {
QMAKE_CXXFLAGS_WARN_ON += /W3 \
QMAKE_CXXFLAGS_WARN_ON += /W3 \
/wd4996 \ # silence warnings about deprecated strcpy and whatnot
/wd4005 \ # silence warnings about macro redefinition
/wd4290 \ # ignore exception specifications
......@@ -200,14 +210,14 @@ WindowsBuild {
ReleaseBuild {
DEFINES += QT_NO_DEBUG
WindowsBuild {
# Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure)
QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_CFLAGS_LTCG = -GL
# Turn on debugging information so we can collect good crash dumps from release builds
QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /DEBUG
WindowsBuild {
# Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure)
QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_CFLAGS_LTCG = -GL
# Turn on debugging information so we can collect good crash dumps from release builds
QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /DEBUG
}
}
......
# set the QGC version from git
exists ($$PWD/.git) {
GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
WindowsBuild {
QGC_GIT_VER = echo extern \"C\" { const char *git_version() { return \"$$GIT_DESCRIBE\"; } } > git_version.cpp
LIBS += git_version.obj
} else {
QGC_GIT_VER = echo \"extern \\\"C\\\" { const char *git_version() { return \\\"$$GIT_DESCRIBE\\\"; } }\" > git_version.cpp
LIBS += git_version.o
}
}
WindowsBuild {
LIBS += git_version.obj
} else {
LIBS += git_version.o
}
CONFIG(debug) {
GIT_VERSION_CXXFLAGS = $$QMAKE_CXXFLAGS_DEBUG
} else {
GIT_VERSION_CXXFLAGS = $$QMAKE_CXXFLAGS_RELEASE
}
MacBuild {
QMAKE_PRE_LINK += $$QGC_GIT_VER && $$QMAKE_CXX -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET -c $$GIT_VERSION_CXXFLAGS git_version.cpp
} else {
QMAKE_PRE_LINK += $$QGC_GIT_VER && $$QMAKE_CXX -c $$GIT_VERSION_CXXFLAGS git_version.cpp
}
......@@ -22,8 +22,6 @@ CONFIG += ordered
SUBDIRS = ./QGCLocationPlugin.pro
SUBDIRS += ./QGCApplication.pro
include(git_version.pri)
QGCApplication.depends = QGCLocationPlugin
message(Qt version $$[QT_VERSION])
......
......@@ -95,6 +95,7 @@ bool GAudioOutput::say(const QString& inText, int severity)
if (!muted) {
#if defined __android__
#if defined QGC_SPEECH_ENABLED
Q_UNUSED(severity);
static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"};
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
......
......@@ -41,7 +41,6 @@
#include "VideoStreaming.h"
#include "git_version.h"
#include "QGC.h"
#include "QGCApplication.h"
#include "MainWindow.h"
......@@ -169,7 +168,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
: QApplication(argc, argv)
, _runningUnitTests(unitTesting)
, _styleIsDark(true)
, _fakeMobile(false)
, _fakeMobile(false)
#ifdef QT_DEBUG
, _testHighDPI(false)
#endif
......@@ -181,36 +180,36 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifndef __android__
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
// Parse command line options
bool fClearSettingsOptions = false; // Clear stored settings
bool logging = false; // Turn on logging
QString loggingOptions;
CmdLineOpt_t rgCmdLineOptions[] = {
{ "--clear-settings", &fClearSettingsOptions, NULL },
{ "--logging", &logging, &loggingOptions },
{ "--fake-mobile", &_fakeMobile, NULL },
{ "--fake-mobile", &_fakeMobile, NULL },
#ifdef QT_DEBUG
{ "--test-high-dpi", &_testHighDPI, NULL },
#endif
// Add additional command line option flags here
};
ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false);
#ifdef __mobile__
QLoggingCategory::setFilterRules(QStringLiteral("*Log.debug=false"));
#else
QString filterRules;
// Turn off bogus ssl warning
filterRules += "qt.network.ssl.warning=false\n";
if (logging) {
QStringList logList = loggingOptions.split(",");
if (logList[0] == "full") {
filterRules += "*Log.debug=true\n";
for(int i=1; i<logList.count(); i++) {
......@@ -262,7 +261,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
}
}
}
qDebug() << "Filter rules" << filterRules;
QLoggingCategory::setFilterRules(filterRules);
#endif
......@@ -271,7 +270,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
_missingParamsDelayedDisplayTimer.setSingleShot(true);
_missingParamsDelayedDisplayTimer.setInterval(_missingParamsDelayedDisplayTimerTimeout);
connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay);
// Set application information
if (_runningUnitTests) {
// We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app
......@@ -283,7 +282,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
setOrganizationName(QGC_ORG_NAME);
setOrganizationDomain(QGC_ORG_DOMAIN);
QString versionString(git_version());
QString versionString(GIT_VERSION);
// stable versions are on tags (v1.2.3)
// development versions are full git describe versions (v1.2.3-18-g879e8b3)
if (versionString.length() > 8) {
......@@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void)
QSettings settings;
// Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only");
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only");
qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only");
......@@ -362,12 +361,12 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<FirmwareUpgradeController> ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
qmlRegisterType<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController");
#endif
// Register Qml Singletons
qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory);
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
qmlRegisterSingletonType<MavlinkQmlSingleton> ("QGroundControl.Mavlink", 1, 0, "Mavlink", mavlinkQmlSingletonFactory);
// Show user an upgrade message if the settings version has been bumped up
bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) {
......@@ -398,7 +397,7 @@ void QGCApplication::_initCommon(void)
savedFilesLocation.clear();
}
}
if (savedFilesLocation.isEmpty()) {
// No location set (or invalid). Create a default one in Documents standard location.
......@@ -581,7 +580,7 @@ void QGCApplication::_createSingletons(void)
FlightMapSettings* flightMapSettings = FlightMapSettings::_createSingleton();
Q_UNUSED(flightMapSettings);
Q_ASSERT(flightMapSettings);
// No dependencies
HomePositionManager* homePositionManager = HomePositionManager::_createSingleton();
Q_UNUSED(homePositionManager);
......@@ -591,28 +590,28 @@ void QGCApplication::_createSingletons(void)
FirmwarePlugin* firmwarePlugin = GenericFirmwarePlugin::_createSingleton();
Q_UNUSED(firmwarePlugin);
Q_ASSERT(firmwarePlugin);
// No dependencies
firmwarePlugin = PX4FirmwarePlugin::_createSingleton();
firmwarePlugin = ArduCopterFirmwarePlugin::_createSingleton();
firmwarePlugin = ArduPlaneFirmwarePlugin::_createSingleton();
firmwarePlugin = ArduRoverFirmwarePlugin::_createSingleton();
// No dependencies
FirmwarePluginManager* firmwarePluginManager = FirmwarePluginManager::_createSingleton();
Q_UNUSED(firmwarePluginManager);
Q_ASSERT(firmwarePluginManager);
// No dependencies
MultiVehicleManager* multiVehicleManager = MultiVehicleManager::_createSingleton();
Q_UNUSED(multiVehicleManager);
Q_ASSERT(multiVehicleManager);
// No dependencies
JoystickManager* joystickManager = JoystickManager::_createSingleton();
Q_UNUSED(joystickManager);
Q_ASSERT(joystickManager);
// No dependencies
GAudioOutput* audio = GAudioOutput::_createSingleton();
Q_UNUSED(audio);
......@@ -706,7 +705,7 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile)
qgcApp()->mavlinkLogFilesLocation(),
tr("Flight Data Log Files (*.mavlink)"),
"mavlink");
if (!saveFilename.isEmpty()) {
// if file exsits already, try to remove it first to overwrite it
if(QFile::exists(saveFilename) && !QFile::remove(saveFilename)){
......@@ -762,7 +761,7 @@ void QGCApplication::_loadCurrentStyle(void)
success = false;
}
}
setStyleSheet(styles);
if (!success) {
......@@ -786,7 +785,7 @@ void QGCApplication::reportMissingParameter(int componentId, const QString& name
void QGCApplication::_missingParamsDisplay(void)
{
Q_ASSERT(_missingParams.count());
QString params;
foreach (QString name, _missingParams) {
if (params.isEmpty()) {
......@@ -796,7 +795,7 @@ void QGCApplication::_missingParamsDisplay(void)
}
}
_missingParams.clear();
QGCMessageBox::critical(
"Missing Parameters",
QString("Parameters missing from firmware: %1.\n\n"
......
......@@ -30,7 +30,7 @@ This file is part of the QGROUNDCONTROL project
#ifndef GLUTILS_H
#define GLUTILS_H
#ifdef __android__
#ifdef __mobile__
#include <QOpenGLFunctions>
#define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions()
#define QOpenGLFunctionsDef QOpenGLFunctions
......
extern "C" {
const char *git_version();
}
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