[p4] Adding a Changelist # to C++ code...?

Veronica Merryfield veronica.merryfield at shaw.ca
Thu Feb 21 12:06:52 PST 2008


The header file need only be included by one source file in the build,  
that being the one that displays the info at run time. I think that  
was what Robert wanted to do.

A simple script could build a very minimal include file and could even  
build a string for display.

Vrnc

On 21-Feb-08, at 9:51 AM, Peter Weldon wrote:

> On 2/21/08, Troughton, Robert <rtroughton at midway.com> wrote:
>>
>> This sounds good. Is there a way to have it automatically generate  
>> that
>> header file, though?
>
>
> No p4 does not have a c++ header output option.
>
> My question, really, is how to use this to create a header... I  
> guess I
>> could write a little app which takes the output from this and parses
>> it...? But is there a better way?
>
>
> If you want a header file you will need a script. A header file is  
> not ideal
> though as it will cause a recompile of all dependent files and a  
> relink for
> ever change regardless of whether any code was touched by the change  
> e.g. a
> data file is updated but no code.
>
> Perhaps an alternative is to dump the changelist data to a file and  
> read the
> file at runtime. The data can be dumped out using the -ztag option  
> for easy
> parsing or if you already have the code to read python or ruby  
> marshalled
> data with -G (python marshalling) or -R (ruby marshalling).
> Either way if your build system uses timestamp based dependency  
> checking
> preserving the existing file if it has not changed will prevent any  
> unneeded
> rebuilds:
> - Generate the changelist header file / data file in a temp location
> - Compare it to the existing file, replace existing file with new  
> file if
> they differ
>
> Placing perforce commands within the build script always has the  
> down side
> that should the server not be available or is very busy everyone  
> attempting
> to build is affected. You don't want the builds to break or be  
> unresponsive
> because the server is unavailable.
>
> Capturing the changelist data when the sync is performed as opposed  
> to when
> the build is performed is a good solution that does not have this  
> problem,
> but does not accommodate ad hoc syncing easily.
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user




More information about the perforce-user mailing list