Add new variables lyx_build_date/time

These are now in version.cpp. The build machinery should therefore make sure
that version.cpp is recompiled at every compilation.

These variables are now referred to by the other places that made use of __DATE__ and __TIME__.
This commit is contained in:
Jean-Marc Lasgouttes 2014-11-25 18:41:33 +01:00
parent 4066fcac16
commit 8d6d21c6d9
6 changed files with 19 additions and 8 deletions

View File

@ -1150,7 +1150,7 @@ int parse_version(string const &, string const &, string &)
cout << to_utf8(_(" Git commit hash ")) cout << to_utf8(_(" Git commit hash "))
<< string(lyx_git_commit_hash).substr(0,8) << endl; << string(lyx_git_commit_hash).substr(0,8) << endl;
cout << to_utf8(bformat(_("Built on %1$s[[date]], %2$s[[time]]"), cout << to_utf8(bformat(_("Built on %1$s[[date]], %2$s[[time]]"),
from_ascii(__DATE__), from_ascii(__TIME__))) << endl; from_ascii(lyx_build_date), from_ascii(lyx_build_time))) << endl;
cout << lyx_version_info << endl; cout << lyx_version_info << endl;
exit(0); exit(0);
return 0; return 0;

View File

@ -147,7 +147,7 @@ static QString buildinfo()
out << qt_(" Git commit hash ") out << qt_(" Git commit hash ")
<< QString(lyx_git_commit_hash).left(8) << endl; << QString(lyx_git_commit_hash).left(8) << endl;
out << toqstr(bformat(_("Built on %1$s[[date]], %2$s[[time]]"), out << toqstr(bformat(_("Built on %1$s[[date]], %2$s[[time]]"),
from_ascii(__DATE__), from_ascii(__TIME__))) << endl; from_ascii(lyx_build_date), from_ascii(lyx_build_time))) << endl;
out << lyx_version_info << endl; out << lyx_version_info << endl;
return res; return res;

View File

@ -18,7 +18,8 @@ bin_PROGRAMS = tex2lyx
DEFAULT_INCLUDES = DEFAULT_INCLUDES =
AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src/tex2lyx \ AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src/tex2lyx \
-I$(top_srcdir)/src -I$(top_builddir) $(BOOST_INCLUDES) -I$(top_srcdir)/src -I$(top_builddir) -I$(top_builddir)/src \
$(BOOST_INCLUDES)
TEST_FILES = \ TEST_FILES = \
test/runtests.cmake \ test/runtests.cmake \

View File

@ -532,7 +532,7 @@ typedef int (*cmd_helper)(string const &, string const &);
int parse_help(string const &, string const &) int parse_help(string const &, string const &)
{ {
cerr << "Usage: tex2lyx [options] infile.tex [outfile.lyx]\n" cout << "Usage: tex2lyx [options] infile.tex [outfile.lyx]\n"
"Options:\n" "Options:\n"
"\t-c textclass Declare the textclass.\n" "\t-c textclass Declare the textclass.\n"
"\t-m mod1[,mod2...] Load the given modules.\n" "\t-m mod1[,mod2...] Load the given modules.\n"
@ -563,11 +563,12 @@ int parse_help(string const &, string const &)
int parse_version(string const &, string const &) int parse_version(string const &, string const &)
{ {
lyxerr << "tex2lyx " << lyx_version cout << "tex2lyx " << lyx_version
<< " (" << lyx_release_date << ")" << endl; << " (" << lyx_release_date << ")" << endl;
lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl; cout << "Built on " << lyx_build_date << ", " << lyx_build_time
<< endl;
lyxerr << lyx_version_info << endl; cout << lyx_version_info << endl;
exit(error_code); exit(error_code);
} }

View File

@ -29,6 +29,11 @@ extern char const * const lyx_git_commit_hash = LYX_GIT_COMMIT_HASH;
/// ///
extern char const * const lyx_release_date = LYX_DATE; extern char const * const lyx_release_date = LYX_DATE;
///
extern char const * const lyx_build_date = __DATE__;
///
extern char const * const lyx_build_time = __TIME__;
/// Package identifier (lyx[-<version-suffix>]) /// Package identifier (lyx[-<version-suffix>])
extern char const * const lyx_package = PACKAGE; extern char const * const lyx_package = PACKAGE;

View File

@ -23,6 +23,10 @@ extern const int lyx_version_minor;
extern char const * const lyx_git_commit_hash; extern char const * const lyx_git_commit_hash;
/// ///
extern char const * const lyx_release_date; extern char const * const lyx_release_date;
///
extern char const * const lyx_build_date;
///
extern char const * const lyx_build_time;
/// Package identifier (lyx[-<version-suffix>]) /// Package identifier (lyx[-<version-suffix>])
extern char const * const lyx_package; extern char const * const lyx_package;