summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/CMakeLists.txt2
-rw-r--r--include/module.h1
-rw-r--r--include/modules.h3
-rw-r--r--include/services.h13
-rw-r--r--include/version.cpp1
-rw-r--r--src/main.cpp11
-rw-r--r--src/modules.cpp5
7 files changed, 22 insertions, 14 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index caef56a19..e7df5cfad 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -6,7 +6,7 @@ set_target_properties(version PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLA
# Modify version.h from the above executable, with dependencies to the given headers, version.cpp, and all source files in the main Anope build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
COMMAND version ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_SOURCE_DIR}/version.h
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp ${SRC_SRCS}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp ${SRC_SRCS}
)
# Add version to list of files for CPack to ignore
get_target_property(version_BINARY version LOCATION)
diff --git a/include/module.h b/include/module.h
index f1d3ec221..468d2307f 100644
--- a/include/module.h
+++ b/include/module.h
@@ -5,6 +5,5 @@
#include "commands.h"
#include "language.h"
#include "modules.h"
-#include "version.h"
#endif // MODULE_H
diff --git a/include/modules.h b/include/modules.h
index 5fd36d6ac..502093081 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -17,7 +17,6 @@
#include <stdio.h>
#include "timers.h"
#include "hashcomp.h"
-#include "version.h"
#include "commands.h"
/* Cross OS compatibility macros */
@@ -291,7 +290,7 @@ class CoreExport Module
* compiled against
* @return The version
*/
- Version GetVersion() { return Version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD); }
+ Version GetVersion();
/**
* Allow a module to add a set of language strings to anope
diff --git a/include/services.h b/include/services.h
index b234e438a..34041df2f 100644
--- a/include/services.h
+++ b/include/services.h
@@ -16,7 +16,6 @@
/*************************************************************************/
-#include "version.h"
#include "sysconf.h"
#define BUFSIZE 1024
@@ -364,7 +363,7 @@ inline const std::string stringify(const T &x)
if (!(stream << x))
throw CoreException("Stringify fail");
-
+
return stream.str();
}
@@ -1055,15 +1054,9 @@ class CoreExport Anope
private:
static const char * const compiled;
public:
- static inline const std::string Version()
- {
- return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA " (" + stringify(VERSION_BUILD) + ")";
- }
+ static std::string Version();
- static inline const std::string Build()
- {
- return "build #" + stringify(BUILD) + ", compiled " + compiled;
- }
+ static std::string Build();
/** Check whether two strings match.
* @param str The string to check against the pattern (e.g. foobar)
diff --git a/include/version.cpp b/include/version.cpp
index e9b04b939..7b7d3314c 100644
--- a/include/version.cpp
+++ b/include/version.cpp
@@ -9,6 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
+#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
diff --git a/src/main.cpp b/src/main.cpp
index c00b3a8f0..e1b3c1ee3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@
#include "services.h"
#include "timers.h"
#include "modules.h"
+#include "version.h"
// getrlimit.
#ifndef _WIN32
@@ -570,3 +571,13 @@ int main(int ac, char **av, char **envp)
return 0;
}
+
+inline std::string Anope::Version()
+{
+ return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA + " (" + stringify(VERSION_BUILD) + ")";
+}
+
+inline std::string Anope::Build()
+{
+ return std::string("build #") + stringify(BUILD) + ", compiled " + compiled;
+}
diff --git a/src/modules.cpp b/src/modules.cpp
index c32544aa4..fda941e50 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -407,3 +407,8 @@ void ModuleRunTimeDirCleanUp()
#endif
Alog(LOG_DEBUG) << "Module run time directory has been cleaned out";
}
+
+Version Module::GetVersion()
+{
+ return Version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
+}