OSDN Git Service

Improved compiler detection. Partly borrowed from MPC-HC project.
authorlordmulder <mulder2@gmx.de>
Thu, 7 Apr 2011 20:40:47 +0000 (22:40 +0200)
committerlordmulder <mulder2@gmx.de>
Thu, 7 Apr 2011 20:40:47 +0000 (22:40 +0200)
src/Config.h
src/Dialog_About.cpp
src/Global.cpp
src/Global.h
src/Targetver.h

index 9340983..23fcf91 100644 (file)
@@ -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
 
 /*
index bc8de22..8cea350 100644 (file)
@@ -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("<h2>%1</h2>").arg(tr("LameXP &minus; Audio Encoder Front-end"));
        aboutText += QString("<b>Copyright (C) 2004-%1 LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.</b><br>").arg(max(lamexp_version_date().year(),QDate::currentDate().year()));
-       aboutText += lamexp_version_demo() ? QString("<b>%1, %2</b><br><br>").arg(versionStr, tr("DEMO VERSION")) : QString("<b>%1</b><br><br>").arg(versionStr);
+       aboutText += QString("<b>%1</b><br><br>").arg(versionStr);
        aboutText += QString("<nobr>%1</nobr><br>").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url())));
+       aboutText += lamexp_version_demo() ? QString("<nobr><font color=\"darkred\">%1</font></nobr><br>").arg(tr("Note: This demo (pre-release) version of LameXP will expire at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))) : QString();
        aboutText += "<hr><br>";
        aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
        aboutText += "modify it under the terms of the GNU General Public License<br>";
index 5bc9a9b..0affe87 100644 (file)
@@ -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
index 20188f6..88abdc0 100644 (file)
@@ -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
index 3e433ae..fc44dd7 100644 (file)
@@ -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
-