Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / simgrid / sg_version.cpp
1 /* Copyright (c) 2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5 #include "simgrid/config.h"
6 #include "simgrid/version.h"
7 #include "xbt/base.h"
8 #include "xbt/log.h"
9 #include "xbt/misc.h"
10 #include "xbt/sysdep.h"
11
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_version, surf, "About the versioning of SimGrid");
13
14 void sg_version_check(int lib_version_major, int lib_version_minor, int lib_version_patch)
15 {
16   if ((lib_version_major != SIMGRID_VERSION_MAJOR) || (lib_version_minor != SIMGRID_VERSION_MINOR)) {
17     fprintf(stderr,
18             "FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, "
19             "and then linked against SimGrid %d.%d.%d. Please fix this.\n",
20             lib_version_major, lib_version_minor, lib_version_patch, SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR,
21             SIMGRID_VERSION_PATCH);
22     abort();
23   }
24   if (lib_version_patch != SIMGRID_VERSION_PATCH) {
25     if (SIMGRID_VERSION_PATCH > 89 || lib_version_patch > 89) {
26       fprintf(
27           stderr,
28           "FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, "
29           "and then linked against SimGrid %d.%d.%d. \n"
30           "One of them is a development version, and should not be mixed with the stable release. Please fix this.\n",
31           lib_version_major, lib_version_minor, lib_version_patch, SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR,
32           SIMGRID_VERSION_PATCH);
33       abort();
34     }
35     fprintf(stderr,
36             "Warning: Your program was compiled with SimGrid version %d.%d.%d, "
37             "and then linked against SimGrid %d.%d.%d. Proceeding anyway.\n",
38             lib_version_major, lib_version_minor, lib_version_patch, SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR,
39             SIMGRID_VERSION_PATCH);
40   }
41 }
42
43 void sg_version_get(int* ver_major, int* ver_minor, int* ver_patch)
44 {
45   *ver_major = SIMGRID_VERSION_MAJOR;
46   *ver_minor = SIMGRID_VERSION_MINOR;
47   *ver_patch = SIMGRID_VERSION_PATCH;
48 }
49
50 void sg_version()
51 {
52   XBT_HELP("This program was linked against %s (git: %s), found in %s.", SIMGRID_VERSION_STRING, SIMGRID_GIT_VERSION,
53            SIMGRID_INSTALL_PREFIX);
54
55 #if SIMGRID_HAVE_MC
56   XBT_HELP("   Model-checking support compiled in.");
57 #else
58   XBT_HELP("   Model-checking support disabled at compilation.");
59 #endif
60
61 #if SIMGRID_HAVE_NS3
62   XBT_HELP("   ns-3 support compiled in.");
63 #else
64   XBT_HELP("   ns-3 support disabled at compilation.");
65 #endif
66
67 #if SIMGRID_HAVE_JEDULE
68   XBT_HELP("   Jedule support compiled in.");
69 #else
70   XBT_HELP("   Jedule support disabled at compilation.");
71 #endif
72
73 #if SIMGRID_HAVE_LUA
74   XBT_HELP("   Lua support compiled in.");
75 #else
76   XBT_HELP("   Lua support disabled at compilation.");
77 #endif
78
79 #if SIMGRID_HAVE_MALLOCATOR
80   XBT_HELP("   Mallocator support compiled in.");
81 #else
82   XBT_HELP("   Mallocator support disabled at compilation.");
83 #endif
84
85   XBT_HELP("\nTo cite SimGrid in a publication, please use:\n"
86            "   Henri Casanova, Arnaud Giersch, Arnaud Legrand, Martin Quinson, Frédéric Suter. \n"
87            "   Versatile, Scalable, and Accurate Simulation of Distributed Applications and Platforms. \n"
88            "   Journal of Parallel and Distributed Computing, Elsevier, 2014, 74 (10), pp.2899-2917.\n"
89            "The pdf file and a BibTeX entry for LaTeX users can be found at http://hal.inria.fr/hal-01017319");
90 }