Skip to content

Commit

Permalink
compiler: updated the compiler version info
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Jan 30, 2024
1 parent 2c05eaa commit d7515fb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 70 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ SET(COPYRIGHT_YEARS "2000-${CURRENTYEAR}")
SET(STELLARIUM_URL "https://stellarium.org/")
ADD_DEFINITIONS(-DSTELLARIUM_URL="${STELLARIUM_URL}")

# remembering the name and the version of compiler for StelLogger
SET(STELLARIUM_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
ADD_DEFINITIONS(-DSTELLARIUM_COMPILER="${STELLARIUM_COMPILER}")

# The line below is copied from src/gui/HelpDialog.cpp file
SET(STELLARIUM_COPYRIGHT "Copyright (C) ${COPYRIGHT_YEARS} ${PROJECT_NAME} Developers")
# The line below is copied from src/main.cpp file
Expand Down
3 changes: 1 addition & 2 deletions src/StelLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ void StelLogger::init(const QString& logFilePath)
writeLog(QString("Operating System: %1").arg(StelUtils::getOperatingSystemInfo()));

// write compiler version
QString compiler = StelUtils::getCompilerInfo();
writeLog(compiler.isEmpty() ? "Unknown compiler" : QString("Compiled using %1").arg(compiler));
writeLog(QString("Compiled using %1").arg(STELLARIUM_COMPILER));

// write Qt version
writeLog(QString("Qt runtime version: %1").arg(qVersion()));
Expand Down
65 changes: 0 additions & 65 deletions src/core/StelUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,71 +93,6 @@ QString getOperatingSystemInfo()
return OS;
}

QString getCompilerInfo()
{
QString compilerInfo = "";

#if defined __GNUC__ && !defined __clang__ && !defined __INTEL_COMPILER
#ifdef __MINGW32__
#define COMPILER "MinGW GCC"
#else
#define COMPILER "GCC"
#endif
compilerInfo = QString("%1 %2.%3.%4").arg(COMPILER).arg(__GNUC__).arg(__GNUC_MINOR__).arg(__GNUC_PATCHLEVEL__);
#elif defined __clang__
#ifdef Q_OS_MACOS
#define COMPILER "Clang (Apple)"
#else
#define COMPILER "Clang"
#endif
compilerInfo = QString("%1 %2.%3.%4").arg(COMPILER).arg(__clang_major__).arg(__clang_minor__).arg(__clang_patchlevel__);
#elif defined __INTEL_COMPILER
QString iccVer = QString::number(__INTEL_COMPILER);
int iccVL = iccVer.length();
compilerInfo = QString("%1 %2.%3.%4.%5").arg("Intel C/C++").arg(iccVer.mid(0, iccVL-2)).arg(iccVer.mid(iccVL-2,1)).arg(iccVer.mid(iccVL-1,1)).arg(__INTEL_COMPILER_BUILD_DATE);
#elif defined _MSC_VER
// Defines for _MSC_VER macro: https://docs.microsoft.com/ru-ru/cpp/preprocessor/predefined-macros?view=msvc-160
const QMap<int, QString> map = {
{1310, "MSVC++ 7.1 (Visual Studio 2003)" },
{1400, "MSVC++ 8.0 (Visual Studio 2005)" },
{1500, "MSVC++ 9.0 (Visual Studio 2008)" },
{1600, "MSVC++ 10.0 (Visual Studio 2010)" },
{1700, "MSVC++ 11.0 (Visual Studio 2012)" },
{1800, "MSVC++ 12.0 (Visual Studio 2013)" },
{1900, "MSVC++ 14.0 (Visual Studio 2015)" },
{1910, "MSVC++ 15.0 (Visual Studio 2017 RTW)" },
{1911, "MSVC++ 15.3 (Visual Studio 2017)" },
{1912, "MSVC++ 15.5 (Visual Studio 2017)" },
{1913, "MSVC++ 15.6 (Visual Studio 2017)" },
{1914, "MSVC++ 15.7 (Visual Studio 2017)" },
{1915, "MSVC++ 15.8 (Visual Studio 2017)" },
{1916, "MSVC++ 15.9 (Visual Studio 2017)" },
{1920, "MSVC++ 16.0 (Visual Studio 2019 RTW)" },
{1921, "MSVC++ 16.1 (Visual Studio 2019)" },
{1922, "MSVC++ 16.2 (Visual Studio 2019)" },
{1923, "MSVC++ 16.3 (Visual Studio 2019)" },
{1924, "MSVC++ 16.4 (Visual Studio 2019)" },
{1925, "MSVC++ 16.5 (Visual Studio 2019)" },
{1926, "MSVC++ 16.6 (Visual Studio 2019)" },
{1927, "MSVC++ 16.7 (Visual Studio 2019)" },
{1928, "MSVC++ 16.8, 16.9 (Visual Studio 2019)" },
{1929, "MSVC++ 16.10, 16.11 (Visual Studio 2019)" },
{1930, "MSVC++ 17.0 (Visual Studio 2022 RTW)" },
{1931, "MSVC++ 17.1 (Visual Studio 2022)" },
{1932, "MSVC++ 17.2 (Visual Studio 2022)" },
{1933, "MSVC++ 17.3 (Visual Studio 2022)" },
{1934, "MSVC++ 17.4 (Visual Studio 2022)" },
{1935, "MSVC++ 17.5 (Visual Studio 2022)" },
{1936, "MSVC++ 17.6 (Visual Studio 2022)" },
{1937, "MSVC++ 17.7 (Visual Studio 2022)" },
{1938, "MSVC++ 17.8 (Visual Studio 2022)" }
};
compilerInfo = map.value(_MSC_VER, "unknown MSVC++ version");
#endif

return compilerInfo;
}

double hmsStrToHours(const QString& s)
{
static const QRegularExpression reg("(\\d+)h(\\d+)m(\\d+)s");
Expand Down
3 changes: 0 additions & 3 deletions src/core/StelUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ namespace StelUtils
//! Return the name and the version of operating system, i.e. "macOS 12.5"
QString getOperatingSystemInfo();

//! Return the name and the version of compiler, which was used for building the planetarium, i.e. "GCC 9.3.0"
QString getCompilerInfo();

//! Return the user agent name, i.e. "Stellarium/0.15.0 (Linux)"
QString getUserAgentString();

Expand Down

0 comments on commit d7515fb

Please sign in to comment.