Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define SIMGRID_VERSION_STRING, and add option --version to get version information...
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Nov 2013 17:26:50 +0000 (18:26 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Nov 2013 20:43:36 +0000 (21:43 +0100)
CMakeLists.txt
ChangeLog
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/PrintArgs.cmake
include/simgrid_config.h.in
src/simgrid/sg_config.c

index 6adbbd2..e124fa9 100644 (file)
@@ -45,19 +45,25 @@ set(CMAKE_Fortran_LINK_FLAGS "" CACHE TYPE INTERNAL FORCE)
 # 3.7.{0,1} -> release 3.7, 3.7.1
 # 3.8.{0,1} -> release 3.8, 3.8.1
 # 3.9.0 -> release 3.9
-
 # 3.9.90 -> release 3.10pre1
 # 3.10.0 -> release 3.10
 
 set(SIMGRID_VERSION_MAJOR "3")
 set(SIMGRID_VERSION_MINOR "9")
 set(SIMGRID_VERSION_PATCH "90")
+set(SIMGRID_VERSION_EXTRA "") # Extra words to add to version string (e.g. -rc1)
+
+set(SIMGRID_VERSION_DATE  "2013") # Year for copyright information
 
 if(${SIMGRID_VERSION_PATCH} EQUAL "0")
   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}")
 else()
   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
 endif()
+
+set(SIMGRID_VERSION_STRING
+  "SimGrid version ${release_version}${SIMGRID_VERSION_EXTRA}\\nCopyright (c) ${SIMGRID_VERSION_DATE}. The Simgrid Team.")
+
 set(libsimgrid_version "${release_version}")
 set(libsimgrid-java_version "${release_version}")
 set(GCC_NEED_VERSION "4.0")
index b631506..854568d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,9 @@ SimGrid (3.10pre1) unstable; urgency=low
    Unfortunately, calling exit may cause SimGrid to segfault, which is quite
    annoying when scripting around the simulator. Adding a
    --cfg=clean_atexit:no allows to circumvent this issue.
+ * New command line option --version, to get SimGrid version information.
+   Packagers may want to add extra words to SIMGRID_VERSION_EXTRA defined in
+   CMakeLists.txt.
 
 -- Mon Oct 7 2013 Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
index 846f9ea..eaf6c29 100644 (file)
@@ -511,12 +511,20 @@ if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/ AND NOT WIN32)
     string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
     message(STATUS "Git date: ${GIT_DATE}")
     string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
-    STRING(REPLACE " +0000" "" GIT_DATE "${GIT_DATE}")
-    STRING(REPLACE " " "~" GIT_DATE "${GIT_DATE}")
-    STRING(REPLACE ":" "-" GIT_DATE "${GIT_DATE}")
   endif()
 endif()
 
+if(release)
+  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nRelease build")
+else()
+  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nDevelopment build")
+endif()
+if(GIT_VERSION)
+  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} at commit ${GIT_VERSION}")
+endif()
+if(GIT_DATE)
+  set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} (${GIT_DATE})")
+endif()
 #--------------------------------------------------------------------------------------------------
 
 set(makecontext_CPPFLAGS_2 "")
index d15127a..200f671 100644 (file)
@@ -74,9 +74,9 @@ message("\nConfiguration of package `simgrid':")
 message("        BUILDNAME ...........: ${BUILDNAME}")
 message("        SITE ................: ${SITE}")
 if(release)
-  message("        Release .............: simgrid-${release_version} (release build)")
+  message("        Release .............: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (release build)")
 else()
-  message("        Release .............: simgrid-${release_version} (development build)")
+  message("        Release .............: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (development build)")
 endif()
 message("")
 message("        Compiler: C .........: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})")
index fb08c29..789464f 100644 (file)
@@ -22,6 +22,8 @@ SG_BEGIN_DECL()
 #define SIMGRID_VERSION_MINOR @SIMGRID_VERSION_MINOR@
 #define SIMGRID_VERSION_PATCH @SIMGRID_VERSION_PATCH@
 
+#define SIMGRID_VERSION_STRING "@SIMGRID_VERSION_STRING@"
+
 /* Version X.Y.Z will get version number XYZ: all digits concatenated without dots
  * (with Y and Z must be on two positions)*/
 
index 0f88330..b812c87 100644 (file)
@@ -55,6 +55,9 @@ static void sg_config_cmd_line(int *argc, char **argv)
 
       xbt_cfg_set_parse(_sg_cfg_set, opt);
       XBT_DEBUG("Did apply '%s' as config setting", opt);
+    } else if (!strcmp(argv[i], "--version")) {
+      printf("%s\n", SIMGRID_VERSION_STRING);
+      shall_exit = 1;
     } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) {
       printf
           ("Description of the configuration accepted by this simulator:\n");
@@ -72,6 +75,8 @@ static void sg_config_cmd_line(int *argc, char **argv)
 "\n"
 "You can also use --help-logs and --help-log-categories to see the details of logging output.\n"
 "\n"
+"You can also use --version to get SimGrid version information.\n"
+"\n"
         );
       shall_exit = 1;
     } else if (!strcmp(argv[i], "--help-models")) {