summaryrefslogtreecommitdiffstats
path: root/libversion
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:28:16 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:34:17 (GMT)
commit10787eed95266bb1a13c892fe4cf5a695dac1559 (patch)
tree3267c7bc4580d4de7ec5797b5658038ad53e3941 /libversion
parent12843822b09f0aa3f426387986354d9e1303e41e (diff)
downloadDoxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.zip
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.gz
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.bz2
Refactoring
- Makes doxycfg library more self contained - renames _doxygen library to doxymain - Modernizes Debug implementation - Moves Doxygen::runningTime into Debug - Moves full version string to libversion - Removed mentioning of file version in messages (when FILE_VERSION_FILTER is used) - Move substitute functions into QCString
Diffstat (limited to 'libversion')
-rw-r--r--libversion/CMakeLists.txt1
-rw-r--r--libversion/doxyversion.cpp.in2
-rw-r--r--libversion/fullversion.cpp22
-rw-r--r--libversion/gitversion.cpp.in17
-rw-r--r--libversion/version.h13
5 files changed, 42 insertions, 13 deletions
diff --git a/libversion/CMakeLists.txt b/libversion/CMakeLists.txt
index 6952cea..009c236 100644
--- a/libversion/CMakeLists.txt
+++ b/libversion/CMakeLists.txt
@@ -19,6 +19,7 @@ include_directories(
add_library(doxygen_version STATIC
${POST_CONFIGURE_DOXYGEN_VERSION_FILE}
${POST_CONFIGURE_GIT_VERSION_FILE}
+ fullversion.cpp
)
add_dependencies( doxygen_version check_git_repository )
diff --git a/libversion/doxyversion.cpp.in b/libversion/doxyversion.cpp.in
index 614aa07..fcdac77 100644
--- a/libversion/doxyversion.cpp.in
+++ b/libversion/doxyversion.cpp.in
@@ -1,6 +1,6 @@
#include "version.h"
-char *getDoxygenVersion(void)
+const char *getDoxygenVersion(void)
{
static char versionString[] = "@DOXYGEN_VERSION@";
return versionString;
diff --git a/libversion/fullversion.cpp b/libversion/fullversion.cpp
new file mode 100644
index 0000000..dfc2b0d
--- /dev/null
+++ b/libversion/fullversion.cpp
@@ -0,0 +1,22 @@
+#include <string.h>
+#include <version.h>
+
+const char *getFullVersion(void)
+{
+#define BUF_SIZE 100
+ static char fullVersionString[BUF_SIZE];
+ static bool init = false;
+ if (!init)
+ {
+ strlcpy(fullVersionString,getDoxygenVersion(),BUF_SIZE);
+ if (strlen(getGitVersion())>0)
+ {
+ strlcat(fullVersionString," (",BUF_SIZE);
+ strlcat(fullVersionString,getGitVersion(),BUF_SIZE);
+ strlcat(fullVersionString,")",BUF_SIZE);
+ }
+ fullVersionString[BUF_SIZE-1]='\0';
+ init = true;
+ }
+ return fullVersionString;
+}
diff --git a/libversion/gitversion.cpp.in b/libversion/gitversion.cpp.in
index 164b50b..50ce1d2 100644
--- a/libversion/gitversion.cpp.in
+++ b/libversion/gitversion.cpp.in
@@ -6,11 +6,18 @@
* - No git information is present (no .git directory)
* in those cases clear the gitVersionString (would have string GIT-NOTFOUND).
*/
-char *getGitVersion(void)
+const char *getGitVersion(void)
{
- static char gitVersionString[100];
- strcpy(gitVersionString,"@GIT_HEAD_SHA1@");
- strcat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"");
- if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+#define BUF_SIZE 100
+ static char gitVersionString[BUF_SIZE];
+ static bool init = false;
+ if (!init)
+ {
+ strncpy(gitVersionString,"@GIT_HEAD_SHA1@",BUF_SIZE);
+ strncat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"",BUF_SIZE);
+ if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+ gitVersionString[BUF_SIZE-1]='\0';
+ init = true;
+ }
return gitVersionString;
}
diff --git a/libversion/version.h b/libversion/version.h
index 22a054d..212e8d4 100644
--- a/libversion/version.h
+++ b/libversion/version.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -17,6 +15,7 @@
#ifndef VERSION_H
#define VERSION_H
-char *getDoxygenVersion(void);
-char *getGitVersion(void);
+const char *getDoxygenVersion(void);
+const char *getGitVersion(void);
+const char *getFullVersion(void);
#endif