diff --git a/src/detection/version/version.c b/src/detection/version/version.c index 4a8eb420c..202c10ca2 100644 --- a/src/detection/version/version.c +++ b/src/detection/version/version.c @@ -20,6 +20,9 @@ #define FF_ARCHITECTURE "unknown" #endif +#define FF_STR_INDIR(x) #x +#define FF_STR(x) FF_STR_INDIR(x) + void ffDetectVersion(FFVersionResult* version) { version->projectName = FASTFETCH_PROJECT_NAME; @@ -27,6 +30,16 @@ void ffDetectVersion(FFVersionResult* version) version->version = FASTFETCH_PROJECT_VERSION; version->versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK; version->cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE; + version->compileTime = __DATE__ ", " __TIME__; + #ifdef __clang__ + version->compiler = "clang " FF_STR(__clang_major__) "." FF_STR(__clang_minor__) "." FF_STR(__clang_patchlevel__); + #elif defined(__GNUC__) + version->compiler = "gcc " FF_STR(__GNUC__) "." FF_STR(__GNUC_MINOR__) "." FF_STR(__GNUC_PATCHLEVEL__); + #elif defined(_MSC_VER) + version->compiler = "msvc " FF_STR(_MSC_VER); + #else + version->compiler = "unknown"; + #endif #ifndef NDEBUG version->debugMode = true; #else diff --git a/src/detection/version/version.h b/src/detection/version/version.h index bdb11aa3a..4cb7b9ac6 100644 --- a/src/detection/version/version.h +++ b/src/detection/version/version.h @@ -12,6 +12,8 @@ typedef struct FFVersionResult const char* version; const char* versionTweak; const char* cmakeBuiltType; + const char* compileTime; + const char* compiler; bool debugMode; } FFVersionResult; diff --git a/src/fastfetch.c b/src/fastfetch.c index fd7dd8249..eafb1de61 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -459,7 +459,9 @@ static inline void printCommandHelp(const char* command) "Version tweak", "Build type (debug or release)", "Architecture", - "CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)" + "CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)", + "Date time when compiling", + "Compiler used" ); } else if(ffStrEqualsIgnCase(command, "vulkan-format")) diff --git a/src/modules/version/version.c b/src/modules/version/version.c index 34b8e0642..54781eb62 100644 --- a/src/modules/version/version.c +++ b/src/modules/version/version.c @@ -4,7 +4,7 @@ #include "modules/version/version.h" #include "util/stringUtils.h" -#define FF_VERSION_NUM_FORMAT_ARGS 6 +#define FF_VERSION_NUM_FORMAT_ARGS 8 void ffPrintVersion(FFVersionOptions* options) { @@ -25,6 +25,8 @@ void ffPrintVersion(FFVersionOptions* options) {FF_FORMAT_ARG_TYPE_STRING, result.debugMode ? "debug" : "release"}, {FF_FORMAT_ARG_TYPE_STRING, result.architecture}, {FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType}, + {FF_FORMAT_ARG_TYPE_STRING, result.compileTime}, + {FF_FORMAT_ARG_TYPE_STRING, result.compiler}, }); } } @@ -78,5 +80,7 @@ void ffGenerateVersionJson(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut yyjson_mut_obj_add_str(doc, obj, "version", result.version); yyjson_mut_obj_add_str(doc, obj, "versionTweak", result.versionTweak); yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result.cmakeBuiltType); + yyjson_mut_obj_add_str(doc, obj, "compileTime", result.compileTime); + yyjson_mut_obj_add_str(doc, obj, "compiler", result.compiler); yyjson_mut_obj_add_bool(doc, obj, "debugMode", result.debugMode); }