forked from qt-creator/qt-creator
Qt4ProjectManager: Do not include windows.h in qtversionmanager.
Move 64bit-binary detection into Utils library.
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "winutils.h"
|
#include "winutils.h"
|
||||||
|
#include "qtcassert.h"
|
||||||
|
|
||||||
// Enable WinAPI Windows XP and later
|
// Enable WinAPI Windows XP and later
|
||||||
#define _WIN32_WINNT 0x0501
|
#define _WIN32_WINNT 0x0501
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QLibrary>
|
#include <QtCore/QLibrary>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
@@ -173,4 +175,23 @@ QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
|
|||||||
|| systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64;
|
|| systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT bool winIs64BitBinary(const QString &binaryIn)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(!binaryIn.isEmpty(), return false; )
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
# ifdef __GNUC__ // MinGW lacking some definitions/winbase.h
|
||||||
|
# define SCS_64BIT_BINARY 6
|
||||||
|
# endif
|
||||||
|
bool isAmd64 = false;
|
||||||
|
DWORD binaryType = 0;
|
||||||
|
const QString binary = QDir::toNativeSeparators(binaryIn);
|
||||||
|
bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(binary.utf16()), &binaryType) != 0;
|
||||||
|
if (success && binaryType == SCS_64BIT_BINARY)
|
||||||
|
isAmd64=true;
|
||||||
|
return isAmd64;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -58,5 +58,8 @@ QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid);
|
|||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem();
|
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem();
|
||||||
|
|
||||||
|
// Check for a 64bit binary.
|
||||||
|
QTCREATOR_UTILS_EXPORT bool winIs64BitBinary(const QString &binary);
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
#endif // WINUTILS_H
|
#endif // WINUTILS_H
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <help/helpmanager.h>
|
#include <help/helpmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/winutils.h>
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
@@ -61,10 +62,6 @@
|
|||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QDesktopServices>
|
#include <QtGui/QDesktopServices>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
@@ -1772,23 +1769,8 @@ QString QtVersion::examplesPath() const
|
|||||||
|
|
||||||
bool QtVersion::isQt64Bit() const
|
bool QtVersion::isQt64Bit() const
|
||||||
{
|
{
|
||||||
const QString make = qmakeCommand();
|
const QString qmake = qmakeCommand();
|
||||||
// qDebug() << make;
|
return qmake.isEmpty() ? false : Utils::winIs64BitBinary(qmake);
|
||||||
bool isAmd64 = false;
|
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
# ifdef __GNUC__ // MinGW lacking some definitions/winbase.h
|
|
||||||
# define SCS_64BIT_BINARY 6
|
|
||||||
# endif
|
|
||||||
DWORD binaryType = 0;
|
|
||||||
bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(make.utf16()), &binaryType) != 0;
|
|
||||||
if (success && binaryType == SCS_64BIT_BINARY)
|
|
||||||
isAmd64=true;
|
|
||||||
// qDebug() << "isAmd64:" << isAmd64 << binaryType;
|
|
||||||
return isAmd64;
|
|
||||||
#else
|
|
||||||
Q_UNUSED(isAmd64)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtVersion::buildDebuggingHelperLibrary(QFutureInterface<void> &future,
|
bool QtVersion::buildDebuggingHelperLibrary(QFutureInterface<void> &future,
|
||||||
|
|||||||
Reference in New Issue
Block a user