Index: common/version.h |
— | — | @@ -1,15 +0,0 @@ |
2 | | -#pragma once
|
3 | | -#ifndef __VERSION_H
|
4 | | -#define __VERSION_H
|
5 | | -
|
6 | | -#define DXGLMAJOR 0
|
7 | | -#define DXGLMINOR 2
|
8 | | -#define DXGLPOINT 3
|
9 | | -#define DXGLBUILD 0
|
10 | | -
|
11 | | -#define DXGLVERNUMBER DXGLMAJOR,DXGLMINOR,DXGLPOINT,DXGLBUILD
|
12 | | -#define DXGLVERQWORD (((unsigned __int64)DXGLMAJOR<<48)+((unsigned __int64)DXGLMINOR<<32)+((unsigned __int64)DXGLPOINT<<16)+(unsigned __int64)DXGLBUILD)
|
13 | | -#define DXGLVERSTRING "0.2.3.0"
|
14 | | -
|
15 | | -
|
16 | | -#endif //__VERSION_H
|
Index: common/version.nsh |
— | — | @@ -1 +0,0 @@ |
2 | | -!define PRODUCT_VERSION "0.2.3" |
\ No newline at end of file |
Index: buildtool/buildtool.cpp |
— | — | @@ -15,14 +15,140 @@ |
16 | 16 | // License along with this library; if not, write to the Free Software
|
17 | 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 | 18 |
|
19 | | -#include "common.h"
|
20 | | -#include "../common/version.h"
|
| 19 | +#include <cstdio>
|
| 20 | +#include <iostream>
|
| 21 | +#include "../common/releasever.h"
|
21 | 22 |
|
22 | 23 | using namespace std;
|
23 | 24 |
|
24 | | -int main(int arg, char *argv[])
|
| 25 | +int ProcessHeaders(char *path)
|
25 | 26 | {
|
26 | | - cout << "DXGL Build Tool, version " << DXGLVERSTRING << endl;
|
| 27 | + char pathin[FILENAME_MAX+1];
|
| 28 | + char pathout[FILENAME_MAX+1];
|
| 29 | + char buffer[1024];
|
| 30 | + char verbuffer[20];
|
| 31 | + char numstring[16];
|
| 32 | + char *findptr;
|
| 33 | + int revision = 0; //FIXME: Get SVN Rev.
|
| 34 | + strncpy(pathin,path,FILENAME_MAX);
|
| 35 | + strncpy(pathout,path,FILENAME_MAX);
|
| 36 | + strncat(pathin,"\\version.h.in",FILENAME_MAX-strlen(pathin));
|
| 37 | + strncat(pathout,"\\version.h",FILENAME_MAX-strlen(pathin));
|
| 38 | + FILE *filein = fopen(pathin,"r");
|
| 39 | + if(!filein)
|
| 40 | + {
|
| 41 | + cout << "ERROR: Cannot read file " << pathin << endl;
|
| 42 | + return errno;
|
| 43 | + }
|
| 44 | + FILE *fileout = fopen(pathout,"w");
|
| 45 | + if(!fileout)
|
| 46 | + {
|
| 47 | + cout << "ERROR: Cannot create file " << pathin << endl;
|
| 48 | + return errno;
|
| 49 | + }
|
| 50 | + while(fgets(buffer,1024,filein))
|
| 51 | + {
|
| 52 | + findptr = strstr(buffer,"$MAJOR");
|
| 53 | + if(findptr) strncpy(findptr,STR(DXGLMAJORVER) "\n",6);
|
| 54 | + findptr = strstr(buffer,"$MINOR");
|
| 55 | + if(findptr) strncpy(findptr,STR(DXGLMINORVER) "\n",6);
|
| 56 | + findptr = strstr(buffer,"$POINT");
|
| 57 | + if(findptr) strncpy(findptr,STR(DXGLPOINTVER) "\n",6);
|
| 58 | + findptr = strstr(buffer,"$REVISION");
|
| 59 | + if(findptr)
|
| 60 | + {
|
| 61 | + _itoa(revision,verbuffer,10);
|
| 62 | + strcat(verbuffer,"\n");
|
| 63 | + strncpy(findptr,verbuffer,9);
|
| 64 | + }
|
| 65 | + findptr = strstr(buffer,"$VERSTRING");
|
| 66 | + if(findptr)
|
| 67 | + {
|
| 68 | + if(revision)
|
| 69 | + {
|
| 70 | + strcpy(verbuffer, "\"");
|
| 71 | + strcat(verbuffer,DXGLSTRVER);
|
| 72 | + strcat(verbuffer," r");
|
| 73 | + _itoa(revision,numstring,10);
|
| 74 | + strcat(verbuffer,numstring);
|
| 75 | + strcat(verbuffer,"\"");
|
| 76 | + strncpy(findptr,verbuffer,22);
|
| 77 | + }
|
| 78 | + else strncpy(findptr,"\"" DXGLSTRVER "\"\n",15);
|
| 79 | + }
|
| 80 | + fputs(buffer,fileout);
|
| 81 | + }
|
| 82 | + fclose(filein);
|
| 83 | + filein = NULL;
|
| 84 | + fclose(fileout);
|
| 85 | + fileout = NULL;
|
| 86 | + strncpy(pathin,path,FILENAME_MAX);
|
| 87 | + strncpy(pathout,path,FILENAME_MAX);
|
| 88 | + strncat(pathin,"\\version.nsh.in",FILENAME_MAX-strlen(pathin));
|
| 89 | + strncat(pathout,"\\version.nsh",FILENAME_MAX-strlen(pathin));
|
| 90 | + filein = fopen(pathin,"r");
|
| 91 | + if(!filein)
|
| 92 | + {
|
| 93 | + cout << "ERROR: Cannot read file " << pathin << endl;
|
| 94 | + return errno;
|
| 95 | + }
|
| 96 | + fileout = fopen(pathout,"w");
|
| 97 | + if(!fileout)
|
| 98 | + {
|
| 99 | + cout << "ERROR: Cannot create file " << pathin << endl;
|
| 100 | + return errno;
|
| 101 | + }
|
| 102 | + while(fgets(buffer,1024,filein))
|
| 103 | + {
|
| 104 | + findptr = strstr(buffer,"$PRODUCTVERSTRING");
|
| 105 | + if(findptr) strncpy(findptr,"\"" DXGLSTRVER "\"\n",15);
|
| 106 | + findptr = strstr(buffer,"$PRODUCTREVISION");
|
| 107 | + if(findptr)
|
| 108 | + {
|
| 109 | + if(revision)
|
| 110 | + {
|
| 111 | + strcpy(verbuffer,"\"r");
|
| 112 | + _itoa(revision,numstring,10);
|
| 113 | + strcat(verbuffer,numstring);
|
| 114 | + strcat(verbuffer,"\"\n");
|
| 115 | + strncpy(findptr,verbuffer,17);
|
| 116 | + }
|
| 117 | + else strncpy(findptr,"\"\"\n",17);
|
| 118 | + }
|
| 119 | +#ifdef _DEBUG
|
| 120 | + if(strstr(buffer,";!define DEBUG")) strcpy(buffer,"!define DEBUG");
|
| 121 | +#endif
|
| 122 | + fputs(buffer,fileout);
|
| 123 | + }
|
| 124 | + fclose(filein);
|
| 125 | + filein = NULL;
|
| 126 | + fclose(fileout);
|
| 127 | + fileout = NULL;
|
| 128 | + return 0;
|
| 129 | +}
|
27 | 130 |
|
| 131 | +int main(int argc, char *argv[])
|
| 132 | +{
|
| 133 | +
|
| 134 | + cout << "DXGL Build Tool, version " << DXGLSTRVER << endl;
|
| 135 | +#ifdef _DEBUG
|
| 136 | + cout << "Debug version." << endl;
|
| 137 | +#endif
|
| 138 | + if(argc > 1)
|
| 139 | + {
|
| 140 | + if(!strcmp(argv[1],"makeheader"))
|
| 141 | + {
|
| 142 | + if(argc < 3)
|
| 143 | + {
|
| 144 | + cout << "ERROR: No working directory specified." << endl;
|
| 145 | + return 1;
|
| 146 | + }
|
| 147 | + ProcessHeaders(argv[2]);
|
| 148 | + return 0;
|
| 149 | + }
|
| 150 | + }
|
| 151 | + else
|
| 152 | + {
|
| 153 | + }
|
28 | 154 | return 0;
|
29 | 155 | }
|
Index: buildtool/buildtool.rc |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: buildtool/buildtool.vcxproj |
— | — | @@ -48,7 +48,6 @@ |
49 | 49 | <WarningLevel>Level3</WarningLevel>
|
50 | 50 | <Optimization>Disabled</Optimization>
|
51 | 51 | <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
52 | | - <PrecompiledHeader>Use</PrecompiledHeader>
|
53 | 52 | <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
|
54 | 53 | </ClCompile>
|
55 | 54 | <Link>
|
— | — | @@ -56,12 +55,17 @@ |
57 | 56 | <AdditionalDependencies>
|
58 | 57 | </AdditionalDependencies>
|
59 | 58 | </Link>
|
| 59 | + <PostBuildEvent>
|
| 60 | + <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
|
| 61 | + </PostBuildEvent>
|
| 62 | + <PostBuildEvent>
|
| 63 | + <Message>Build headers</Message>
|
| 64 | + </PostBuildEvent>
|
60 | 65 | </ItemDefinitionGroup>
|
61 | 66 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
62 | 67 | <ClCompile>
|
63 | 68 | <WarningLevel>Level3</WarningLevel>
|
64 | 69 | <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
65 | | - <PrecompiledHeader>Use</PrecompiledHeader>
|
66 | 70 | <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
|
67 | 71 | </ClCompile>
|
68 | 72 | <Link>
|
— | — | @@ -69,9 +73,14 @@ |
70 | 74 | <AdditionalDependencies>
|
71 | 75 | </AdditionalDependencies>
|
72 | 76 | </Link>
|
| 77 | + <PostBuildEvent>
|
| 78 | + <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
|
| 79 | + </PostBuildEvent>
|
| 80 | + <PostBuildEvent>
|
| 81 | + <Message>Build headers</Message>
|
| 82 | + </PostBuildEvent>
|
73 | 83 | </ItemDefinitionGroup>
|
74 | 84 | <ItemGroup>
|
75 | | - <ClInclude Include="common.h" />
|
76 | 85 | <ClInclude Include="resource.h" />
|
77 | 86 | </ItemGroup>
|
78 | 87 | <ItemGroup>
|
— | — | @@ -79,10 +88,6 @@ |
80 | 89 | </ItemGroup>
|
81 | 90 | <ItemGroup>
|
82 | 91 | <ClCompile Include="buildtool.cpp" />
|
83 | | - <ClCompile Include="precomp.cpp">
|
84 | | - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
85 | | - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
86 | | - </ClCompile>
|
87 | 92 | </ItemGroup>
|
88 | 93 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
89 | 94 | <ImportGroup Label="ExtensionTargets">
|
Index: buildtool/buildtool.vcxproj.filters |
— | — | @@ -18,9 +18,6 @@ |
19 | 19 | <ClCompile Include="buildtool.cpp">
|
20 | 20 | <Filter>Source Files</Filter>
|
21 | 21 | </ClCompile>
|
22 | | - <ClCompile Include="precomp.cpp">
|
23 | | - <Filter>Source Files</Filter>
|
24 | | - </ClCompile>
|
25 | 22 | </ItemGroup>
|
26 | 23 | <ItemGroup>
|
27 | 24 | <ResourceCompile Include="buildtool.rc">
|
— | — | @@ -28,9 +25,6 @@ |
29 | 26 | </ResourceCompile>
|
30 | 27 | </ItemGroup>
|
31 | 28 | <ItemGroup>
|
32 | | - <ClInclude Include="common.h">
|
33 | | - <Filter>Header Files</Filter>
|
34 | | - </ClInclude>
|
35 | 29 | <ClInclude Include="resource.h">
|
36 | 30 | <Filter>Header Files</Filter>
|
37 | 31 | </ClInclude>
|
Index: common/common.vcxproj |
— | — | @@ -111,10 +111,11 @@ |
112 | 112 | <None Include="dxglicon.svg" />
|
113 | 113 | <None Include="dxglsm.ico" />
|
114 | 114 | <None Include="star.ico" />
|
115 | | - <None Include="version.nsh" />
|
| 115 | + <None Include="version.nsh.in" />
|
116 | 116 | </ItemGroup>
|
117 | 117 | <ItemGroup>
|
118 | | - <ClInclude Include="version.h" />
|
| 118 | + <ClInclude Include="releasever.h" />
|
| 119 | + <ClInclude Include="version.h.in" />
|
119 | 120 | </ItemGroup>
|
120 | 121 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
121 | 122 | <ImportGroup Label="ExtensionTargets">
|
Index: common/common.vcxproj.filters |
— | — | @@ -27,13 +27,16 @@ |
28 | 28 | <None Include="dxglicon.svg">
|
29 | 29 | <Filter>Resource Files</Filter>
|
30 | 30 | </None>
|
31 | | - <None Include="version.nsh">
|
| 31 | + <None Include="version.nsh.in">
|
32 | 32 | <Filter>Header Files</Filter>
|
33 | 33 | </None>
|
34 | 34 | </ItemGroup>
|
35 | 35 | <ItemGroup>
|
36 | | - <ClInclude Include="version.h">
|
| 36 | + <ClInclude Include="releasever.h">
|
37 | 37 | <Filter>Header Files</Filter>
|
38 | 38 | </ClInclude>
|
| 39 | + <ClInclude Include="version.h.in">
|
| 40 | + <Filter>Header Files</Filter>
|
| 41 | + </ClInclude>
|
39 | 42 | </ItemGroup>
|
40 | 43 | </Project> |
\ No newline at end of file |
Index: common/releasever.h |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +#pragma once
|
| 3 | +#ifndef __VERSION_H
|
| 4 | +#define __VERSION_H
|
| 5 | +
|
| 6 | +#define DXGLMAJORVER 0
|
| 7 | +#define DXGLMINORVER 3
|
| 8 | +#define DXGLPOINTVER 0
|
| 9 | +
|
| 10 | +#define STR2(x) #x
|
| 11 | +#define STR(x) STR2(x)
|
| 12 | +
|
| 13 | +#define DXGLSTRVER STR(DXGLMAJORVER) "." STR(DXGLMINORVER) "." STR(DXGLPOINTVER)
|
| 14 | +
|
| 15 | +
|
| 16 | +
|
| 17 | +#endif //__VERSION_H
|
Index: common/version.h.in |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +#pragma once
|
| 3 | +#ifndef __VERSION_H
|
| 4 | +#define __VERSION_H
|
| 5 | +
|
| 6 | +#define DXGLMAJOR $MAJOR
|
| 7 | +#define DXGLMINOR $MINOR
|
| 8 | +#define DXGLPOINT $POINT
|
| 9 | +#define DXGLBUILD $REVISION
|
| 10 | +
|
| 11 | +#define DXGLVERNUMBER DXGLMAJOR,DXGLMINOR,DXGLPOINT,DXGLBUILD
|
| 12 | +#define DXGLVERQWORD (((unsigned __int64)DXGLMAJOR<<48)+((unsigned __int64)DXGLMINOR<<32)+((unsigned __int64)DXGLPOINT<<16)+(unsigned __int64)DXGLBUILD)
|
| 13 | +#define DXGLVERSTRING $VERSTRING
|
| 14 | +
|
| 15 | +
|
| 16 | +#endif //__VERSION_H
|
Index: common/version.nsh.in |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +!define PRODUCT_VERSION $PRODUCTVERSTRING
|
| 3 | +!define PRODUCT_REVISION $PRODUCTREVISION
|
| 4 | +;!define DEBUG |
\ No newline at end of file |
Index: dxgl.sln |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | EndProjectSection
|
10 | 10 | EndProject
|
11 | 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common\common.vcxproj", "{87D591EB-B598-431B-9B3B-D0FF771AB473}"
|
| 12 | + ProjectSection(ProjectDependencies) = postProject
|
| 13 | + {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0} = {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}
|
| 14 | + EndProjectSection
|
12 | 15 | EndProject
|
13 | 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxglcfg", "dxglcfg\dxglcfg.vcxproj", "{DF380DA1-90DE-4174-9A1F-EEC16C5B5879}"
|
14 | 17 | ProjectSection(ProjectDependencies) = postProject
|
— | — | @@ -23,6 +26,9 @@ |
24 | 27 | EndProjectSection
|
25 | 28 | EndProject
|
26 | 29 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Help", "Help\Help.vcxproj", "{8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}"
|
| 30 | + ProjectSection(ProjectDependencies) = postProject
|
| 31 | + {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0} = {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}
|
| 32 | + EndProjectSection
|
27 | 33 | EndProject
|
28 | 34 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buildtool", "buildtool\buildtool.vcxproj", "{34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}"
|
29 | 35 | EndProject
|