From 5066bd97c0d960b20c33c1fe33a51bead7a3e91e Mon Sep 17 00:00:00 2001 From: lordmulder Date: Thu, 7 Apr 2011 22:40:47 +0200 Subject: [PATCH] Improved compiler detection. Partly borrowed from MPC-HC project. --- src/Config.h | 2 +- src/Dialog_About.cpp | 15 +++++++++++++-- src/Global.cpp | 44 +++++++++++++++++++++++++++++++++++--------- src/Global.h | 6 ++++-- src/Targetver.h | 1 - 5 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/Config.h b/src/Config.h index 93409833..23fcf915 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 2 -#define VER_LAMEXP_BUILD 421 +#define VER_LAMEXP_BUILD 423 #define VER_LAMEXP_SUFFIX Alpha-1 /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index bc8de226..8cea3503 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -75,14 +75,25 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta QMessageBox(parent), m_settings(settings) { - const QString versionStr = QString().sprintf("Version %d.%02d %s, Build %d [%s]", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData()); + const QString versionStr = QString().sprintf + ( + "Version %d.%02d %s, Build %d [%s], %s, Qt v%s", + lamexp_version_major(), + lamexp_version_minor(), + lamexp_version_release(), + lamexp_version_build(), + lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), + lamexp_version_compiler(), + qVersion() + ); QString aboutText; aboutText += QString("

%1

").arg(tr("LameXP − Audio Encoder Front-end")); aboutText += QString("Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
").arg(max(lamexp_version_date().year(),QDate::currentDate().year())); - aboutText += lamexp_version_demo() ? QString("%1, %2

").arg(versionStr, tr("DEMO VERSION")) : QString("%1

").arg(versionStr); + aboutText += QString("%1

").arg(versionStr); aboutText += QString("%1
").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))); + aboutText += lamexp_version_demo() ? QString("%1
").arg(tr("Note: This demo (pre-release) version of LameXP will expire at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))) : QString(); aboutText += "

"; aboutText += "This program is free software; you can redistribute it and/or
"; aboutText += "modify it under the terms of the GNU General Public License
"; diff --git a/src/Global.cpp b/src/Global.cpp index 5bc9a9bc..0affe873 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -115,19 +115,45 @@ static const char *g_lamexp_version_raw_date = __DATE__; //Console attached flag static bool g_lamexp_console_attached = false; -//Compiler version -#if _MSC_VER == 1400 - static const char *g_lamexp_version_compiler = "MSVC 8.0"; -#else - #if _MSC_VER == 1500 - static const char *g_lamexp_version_compiler = "MSVC 9.0"; +//Compiler detection +//The following code was borrowed from MPC-HC project: http://mpc-hc.sf.net/ +#if defined(__INTEL_COMPILER) + #if (__INTEL_COMPILER >= 1200) + static const char *g_lamexp_version_compiler = "ICL 12.x"; + #elif (__INTEL_COMPILER >= 1100) + static const char *g_lamexp_version_compiler = = "ICL 11.x"; + #elif (__INTEL_COMPILER >= 1000) + static const char *g_lamexp_version_compiler = = "ICL 10.x"; #else - #if _MSC_VER == 1600 - static const char *g_lamexp_version_compiler = "MSVC 10.0"; + #error Compiler is not supported! + #endif +#elif defined(_MSC_VER) + #if (_MSC_VER == 1600) + #if (_MSC_FULL_VER >= 160040219) + static const char *g_lamexp_version_compiler = "MSVC 2010-SP1"; #else - static const char *g_lamexp_version_compiler = "UNKNOWN"; + static const char *g_lamexp_version_compiler = "MSVC 2010"; + #endif + #elif (_MSC_VER == 1500) + #if (_MSC_FULL_VER >= 150030729) + static const char *g_lamexp_version_compiler = "MSVC 2008-SP1"; + #else + static const char *g_lamexp_version_compiler = "MSVC 2008"; + #endif + #else + #error Compiler is not supported! + #endif + + // Note: /arch:SSE and /arch:SSE2 are only available for the x86 platform + #if !defined(_M_X64) && defined(_M_IX86_FP) + #if (_M_IX86_FP == 1) + LAMEXP_COMPILER_WARNING("SSE instruction set is enabled!") + #elif (_M_IX86_FP == 2) + LAMEXP_COMPILER_WARNING("SSE2 instruction set is enabled!") #endif #endif +#else + #error Compiler is not supported! #endif //Official web-site URL diff --git a/src/Global.h b/src/Global.h index 20188f66..88abdc08 100644 --- a/src/Global.h +++ b/src/Global.h @@ -161,6 +161,8 @@ SIZE_T lamexp_dbg_private_bytes(void); #endif //Check for CPU-compatibility options -#if _M_IX86_FP != 0 -#error We should not enabled SSE or SSE2 in release builds! +#if !defined(_M_X64) && defined(_M_IX86_FP) + #if (_M_IX86_FP != 0) + #error We should not enabled SSE or SSE2 in release builds! + #endif #endif diff --git a/src/Targetver.h b/src/Targetver.h index 3e433ae9..fc44dd70 100644 --- a/src/Targetver.h +++ b/src/Targetver.h @@ -32,4 +32,3 @@ #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows 2000. #define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows. #endif -