Pārlūkot izejas kodu

add get_compiler(), get_build_date()

David Rose 20 gadi atpakaļ
vecāks
revīzija
f0e16bfb8f

+ 35 - 0
dtool/src/dtoolutil/pandaSystem.cxx

@@ -131,6 +131,41 @@ string PandaSystem::
 get_distributor() {
 get_distributor() {
   return PANDA_DISTRIBUTOR;
   return PANDA_DISTRIBUTOR;
 }
 }
+  
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_compiler
+//       Access: Published, Static
+//  Description: Returns a string representing the compiler that was
+//               used to generate this version of Panda, if it is
+//               available, or "unknown" if it is not.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_compiler() {
+#ifdef COMPILER
+  // MSVC defines this macro.
+  return COMPILER;
+
+#elif defined(__GNUC__)
+  // GCC defines this one.
+  return "GCC " __VERSION__;
+
+#else
+  // For other compilers, you're on your own.
+  return "unknown";
+#endif
+}
+  
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_build_date
+//       Access: Published, Static
+//  Description: Returns a string representing the date and time at
+//               which this version of Panda (or at least dtool) was
+//               compiled, if available.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_build_date() {
+  return __DATE__ " " __TIME__;
+}
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PandaSystem::has_system
 //     Function: PandaSystem::has_system

+ 2 - 0
dtool/src/dtoolutil/pandaSystem.h

@@ -43,6 +43,8 @@ PUBLISHED:
   static bool is_official_version();
   static bool is_official_version();
   
   
   static string get_distributor();
   static string get_distributor();
+  static string get_compiler();
+  static string get_build_date();
 
 
   bool has_system(const string &system) const;
   bool has_system(const string &system) const;
   int get_num_systems() const;
   int get_num_systems() const;