Minor fixes for linux build

refs #36
- Fixed compiler error in context.cpp (is not used anymore, but was still annoying)
- GCC was complaining about the template definitons in blackgui. Removing typename fixed it.
- Fixed a bug in qmake. Unfortunately qmake mkspec was just linux-g++ (not linux-g++-64), so added this case.
- Fixed a PRE_TARGETDEPS bug
- QMake has strange behaviour with DBUS_ADAPTORS: include the header somewhere, otherwise it won't be generated.

refs #81
This commit is contained in:
Roland Winklmeier
2013-11-27 23:17:42 +01:00
committed by Mathew Sutcliffe
parent 7410d6aeb2
commit f24d16019f
5 changed files with 41 additions and 24 deletions

View File

@@ -17,7 +17,7 @@ WITH_SAMPLES = ON
equals(WITH_BLACKMISC, ON) {
SUBDIRS += src/blackmisc
SUBDIRS += src/blackmisc_cpp2xml
#SUBDIRS += src/blackmisc_cpp2xml
}
equals(WITH_BLACKCORE, ON) {

View File

@@ -44,6 +44,18 @@ win32-g++ {
}
}
linux-g++ {
GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64)
contains(GCC64,[enabled]) {
LIBS *= -L$$EXTERNALDIR/linux64/lib
message("64 bit")
}
else {
LIBS *= -L$$EXTERNALDIR/linux32/lib
message("32 bit")
}
}
linux-g++-32 {
LIBS *= -L$$EXTERNALDIR/linux32/lib
}

View File

@@ -0,0 +1,10 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// These two header files are not really needed here. But if they are not
// included "somewhere", they are not generated -> compiler error!
// Possible solution: Generate them once and put them in git.
#include "contextnetwork_adaptor.h"
#include "contextsettings_adaptor.h"

View File

@@ -15,7 +15,8 @@ namespace BlackGui
/*
* Column count
*/
template <typename ObjectType, typename ListType> int CListModelBase<ObjectType, ListType>::columnCount(const QModelIndex & /** modelIndex **/) const
template <typename ObjectType, typename ListType>
int CListModelBase<ObjectType, ListType>::columnCount(const QModelIndex & /** modelIndex **/) const
{
int c = this->m_columns.size();
return c;
@@ -24,7 +25,8 @@ namespace BlackGui
/*
* Row count
*/
template <typename ObjectType, typename ListType> int CListModelBase<ObjectType, ListType>::rowCount(const QModelIndex & /** parent */) const
template <typename ObjectType, typename ListType>
int CListModelBase<ObjectType, ListType>::rowCount(const QModelIndex & /** parent */) const
{
return this->m_list.size();
}
@@ -32,7 +34,8 @@ namespace BlackGui
/*
* Column to property index
*/
template <typename ObjectType, typename ListType> int CListModelBase<ObjectType, ListType>::columnToPropertyIndex(int column) const
template <typename ObjectType, typename ListType>
int CListModelBase<ObjectType, ListType>::columnToPropertyIndex(int column) const
{
return this->m_columns.columnToPropertyIndex(column);
}
@@ -40,7 +43,8 @@ namespace BlackGui
/*
* Header data
*/
template <typename ObjectType, typename ListType> QVariant CListModelBase<ObjectType, ListType>::headerData(int section, Qt::Orientation orientation, int role) const
template <typename ObjectType, typename ListType> QVariant
CListModelBase<ObjectType, ListType>::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
{
@@ -55,7 +59,8 @@ namespace BlackGui
/*
* Data
*/
template <typename ObjectType, typename ListType> QVariant CListModelBase<ObjectType, ListType>::data(const QModelIndex &index, int role) const
template <typename ObjectType, typename ListType>
QVariant CListModelBase<ObjectType, ListType>::data(const QModelIndex &index, int role) const
{
// checks
if (index.row() < 0 || index.row() >= this->m_list.size() ||
@@ -81,7 +86,8 @@ namespace BlackGui
/*
* Update
*/
template <typename ObjectType, typename ListType> int CListModelBase<ObjectType, ListType>::update(const ListType &list)
template <typename ObjectType, typename ListType>
int CListModelBase<ObjectType, ListType>::update(const ListType &list)
{
ListType copyList = (list.size() > 1 && this->hasValidSortColumn() ?
this->sortListByColumn(list, this->m_sortedColumn, this->m_sortOrder) :

View File

@@ -6,6 +6,9 @@
#include "blackmisc/debug.h"
#include "blackmisc/context.h"
#include <QFileInfo>
#include <QCoreApplication>
#include <stdexcept>
#ifdef Q_OS_WIN
#include <Windows.h>
@@ -57,23 +60,9 @@ namespace BlackMisc
void CApplicationContext::setDefaultApplicationName()
{
#ifdef Q_OS_WIN
//! By default, we use the executables name.
if (getApplicationName().isEmpty())
{
WCHAR name[1024];
int size = GetModuleFileName(NULL, name, 1023);
QString applicationPath = QString::fromWCharArray(name, size);
setApplicationName(QFileInfo(applicationPath).fileName());
}
#else
//! Todo: Check if there a corresponding API in Linux and Mac
//! For the time being, set it to unknown.
if (m_context.getApplicationName().isEmpty())
{
m_context.setApplicationName("<Unknown>");
}
#endif
// This part was not working before on linux.
// This class is depricated, but as long as it is not removed, if fixed it anyway.
setApplicationName(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
}
} // namespace BlackMisc