1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 23:56:39 +02:00

Fix version system so it doesn't cause the entire build tree to get rebuilt just because version.h gets regenerated, thanks to Adam for initial patch.

This commit is contained in:
Naram Qashat
2010-06-28 01:28:51 -04:00
parent 2e4099e9f2
commit 85b07a94d7
7 changed files with 22 additions and 14 deletions
+1 -1
View File
@@ -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)
-1
View File
@@ -5,6 +5,5 @@
#include "commands.h"
#include "language.h"
#include "modules.h"
#include "version.h"
#endif // MODULE_H
+1 -2
View File
@@ -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
+3 -10
View File
@@ -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)
+1
View File
@@ -9,6 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
+11
View File
@@ -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;
}
+5
View File
@@ -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);
}