| Index: buildtool/buildtool.cpp |
| — | — | @@ -17,10 +17,63 @@ |
| 18 | 18 |
|
| 19 | 19 | #include <cstdio>
|
| 20 | 20 | #include <iostream>
|
| | 21 | +#include <windows.h>
|
| 21 | 22 | #include "../common/releasever.h"
|
| 22 | 23 |
|
| 23 | 24 | using namespace std;
|
| 24 | 25 |
|
| | 26 | +int GetSVNRev(char *path)
|
| | 27 | +{
|
| | 28 | + char pathbase[FILENAME_MAX+1];
|
| | 29 | + char pathin[FILENAME_MAX+1];
|
| | 30 | + char pathout[FILENAME_MAX+1];
|
| | 31 | + char command[1024];
|
| | 32 | + strncpy(pathbase,path,FILENAME_MAX);
|
| | 33 | + strncpy(pathin,path,FILENAME_MAX);
|
| | 34 | + strncpy(pathout,path,FILENAME_MAX);
|
| | 35 | + pathbase[strlen(pathbase)-7] = 0;
|
| | 36 | + strncat(pathin,"\\rev.in",FILENAME_MAX-strlen(pathin));
|
| | 37 | + strncat(pathout,"\\rev",FILENAME_MAX-strlen(pathin));
|
| | 38 | + strcpy(command,"subwcrev ");
|
| | 39 | + strcat(command,pathbase);
|
| | 40 | + strcat(command," ");
|
| | 41 | + strcat(command,pathin);
|
| | 42 | + strcat(command," ");
|
| | 43 | + strcat(command,pathout);
|
| | 44 | + STARTUPINFOA startinfo;
|
| | 45 | + ZeroMemory(&startinfo,sizeof(STARTUPINFOA));
|
| | 46 | + startinfo.cb = sizeof(STARTUPINFO);
|
| | 47 | + PROCESS_INFORMATION process;
|
| | 48 | + if(CreateProcessA(NULL,command,NULL,NULL,FALSE,0,NULL,NULL,&startinfo,&process))
|
| | 49 | + {
|
| | 50 | + WaitForSingleObject(process.hProcess,INFINITE);
|
| | 51 | + CloseHandle(process.hProcess);
|
| | 52 | + CloseHandle(process.hThread);
|
| | 53 | + FILE *revfile = fopen(pathout,"r");
|
| | 54 | + if(!revfile)
|
| | 55 | + {
|
| | 56 | + cout << "WARNING: Failed to create revision file" << endl;
|
| | 57 | + return 0;
|
| | 58 | + }
|
| | 59 | + char revstring[32];
|
| | 60 | + fgets(revstring,32,revfile);
|
| | 61 | + fclose(revfile);
|
| | 62 | + return atoi(revstring);
|
| | 63 | + }
|
| | 64 | + else
|
| | 65 | + {
|
| | 66 | + int result = MessageBoxA(NULL,"Could not find subwcrev.exe, would you like to download TortoiseSVN?","TortoiseSVN not found",
|
| | 67 | + MB_YESNO|MB_ICONWARNING);
|
| | 68 | + if(result == IDYES)
|
| | 69 | + {
|
| | 70 | + MessageBoxA(NULL,"Please try again after installing TortoiseSVN.","TortoiseSVN not found",MB_OK|MB_ICONINFORMATION);
|
| | 71 | + ShellExecuteA(NULL,"open","http://tortoisesvn.net/",NULL,NULL,SW_SHOWNORMAL);
|
| | 72 | + exit(-1);
|
| | 73 | + }
|
| | 74 | + else return 0;
|
| | 75 | + }
|
| | 76 | +}
|
| | 77 | +
|
| 25 | 78 | int ProcessHeaders(char *path)
|
| 26 | 79 | {
|
| 27 | 80 | char pathin[FILENAME_MAX+1];
|
| — | — | @@ -29,7 +82,7 @@ |
| 30 | 83 | char verbuffer[20];
|
| 31 | 84 | char numstring[16];
|
| 32 | 85 | char *findptr;
|
| 33 | | - int revision = 0; //FIXME: Get SVN Rev.
|
| | 86 | + int revision = GetSVNRev(path);
|
| 34 | 87 | strncpy(pathin,path,FILENAME_MAX);
|
| 35 | 88 | strncpy(pathout,path,FILENAME_MAX);
|
| 36 | 89 | strncat(pathin,"\\version.h.in",FILENAME_MAX-strlen(pathin));
|
| Index: buildtool/buildtool.vcxproj |
| — | — | @@ -52,8 +52,7 @@ |
| 53 | 53 | </ClCompile>
|
| 54 | 54 | <Link>
|
| 55 | 55 | <GenerateDebugInformation>true</GenerateDebugInformation>
|
| 56 | | - <AdditionalDependencies>
|
| 57 | | - </AdditionalDependencies>
|
| | 56 | + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
| 58 | 57 | </Link>
|
| 59 | 58 | <PostBuildEvent>
|
| 60 | 59 | <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
|
| — | — | @@ -70,8 +69,7 @@ |
| 71 | 70 | </ClCompile>
|
| 72 | 71 | <Link>
|
| 73 | 72 | <GenerateDebugInformation>true</GenerateDebugInformation>
|
| 74 | | - <AdditionalDependencies>
|
| 75 | | - </AdditionalDependencies>
|
| | 73 | + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
| 76 | 74 | </Link>
|
| 77 | 75 | <PostBuildEvent>
|
| 78 | 76 | <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
|
| Index: common/rev.in |
| — | — | @@ -0,0 +1 @@ |
| | 2 | +$WCREV$ |
| \ No newline at end of file |
| Index: common |
| Property changes on: common |
| ___________________________________________________________________ |
| Modified: svn:ignore |
| ## -6,3 +6,4 ## |
| 1 | 3 | common.vcxproj.user |
| 2 | 4 | version.h |
| 3 | 5 | version.nsh |
| | 6 | +rev |