Skip to main content
gamedev.net
🔒 Locked

executable version (compile vs link time)

Started by zfvesoljc Dec 8, 2011 at 2:38 PM 5 replies 1.2k views
Original Post
zfvesoljc
zfvesoljc
is there a way to generic portable solution to versioning of an exec file?
ie: like creating a string buffer filled with __DATE__ and __TIME__ macros, and stuffing them "somewhere", so that whenever the exe is relinked (not compiled!) it gets updated?
ApochPiQ
ApochPiQ
I don't know of anything that isn't compiler or build-process dependent.

What's the problem you need to solve?
zfvesoljc
zfvesoljc
well, if I do something like:

class TVersion {
public:
static char formatbuffer[1024];
int major;
int minor;
const char *date;
const char *time;
public:
TVersion(int vmajor, int vminor)
{
major = vmajor;
minor = vminor;
date = __DATE__;
time = __TIME__;
//
sprintf( formatbuffer, "%d.%d.%s.%s", major, minor, date, time );
}
};

main.cpp:

TVersion gVersion( 1, 1 );
pVersion = &gVersion


pVersion is "latest" only when full rebuild is on, or when it is being force recompiled. What I would like is to trigger recompile of this obj, for any modified file in the solution, which has effect on target exec. This is basically the file creation time, but from "code"

makes sense?
EdmundM
EdmundM
I have seen an addon for visual studio once, which would do the job. It was used to edit a resource-file that holds the file-data automatically on every build.
Antheus
Antheus
"date /T >> foo.exe"
zfvesoljc
zfvesoljc

"date /T >> foo.exe"


good one
SiCrane
SiCrane
I'd just add a pre-build step to touch the cpp file.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.