diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2018-12-10 06:57:07 -0800 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2018-12-10 06:57:07 -0800 |
commit | b8184b41882a9670447f0d99b35a48d24c091b25 (patch) | |
tree | 70bc20ae89be4737e4cd67c5921c0e1a21cec67b | |
parent | fcfa8b28157a95a4cde6e656af6c6ce79cf548f0 (diff) | |
download | libbu++-b8184b41882a9670447f0d99b35a48d24c091b25.tar.gz libbu++-b8184b41882a9670447f0d99b35a48d24c091b25.tar.bz2 libbu++-b8184b41882a9670447f0d99b35a48d24c091b25.tar.xz libbu++-b8184b41882a9670447f0d99b35a48d24c091b25.zip |
Made versioning nicer.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | autoconfig.cpp | 21 | ||||
-rw-r--r-- | default.bld | 2 |
3 files changed, 16 insertions, 9 deletions
@@ -5,11 +5,13 @@ | |||
5 | /bin2cpp.exe | 5 | /bin2cpp.exe |
6 | /mkunit.exe | 6 | /mkunit.exe |
7 | /myriad.exe | 7 | /myriad.exe |
8 | /jsontool.exe | ||
8 | /autoconfig | 9 | /autoconfig |
9 | /bin2cpp | 10 | /bin2cpp |
10 | /mkunit | 11 | /mkunit |
11 | /myriad | 12 | /myriad |
12 | /viewcsv | 13 | /viewcsv |
14 | /jsontool | ||
13 | .*.swp | 15 | .*.swp |
14 | .*.un~ | 16 | .*.un~ |
15 | /src/autoconfig.h | 17 | /src/autoconfig.h |
diff --git a/autoconfig.cpp b/autoconfig.cpp index 244fedf..96f0eab 100644 --- a/autoconfig.cpp +++ b/autoconfig.cpp | |||
@@ -126,25 +126,30 @@ int main( int argc, char *argv[] ) | |||
126 | buf[j] = '\0'; | 126 | buf[j] = '\0'; |
127 | fclose( fVer ); | 127 | fclose( fVer ); |
128 | 128 | ||
129 | char *end; | ||
130 | int32_t iVer = strtol( buf, &end, 10 ); | ||
131 | for(; (*end < '1' || *end > '9') && *end; end++ ) { } | ||
132 | int32_t iRev = strtol( end, NULL, 10 ); | ||
133 | |||
129 | fOut = fopen( argv[1], "w" ); | 134 | fOut = fopen( argv[1], "w" ); |
130 | fprintf( fOut, | 135 | fprintf( fOut, |
131 | "#ifndef BU_VERSION_H\n" | 136 | "#ifndef BU_VERSION_H\n" |
132 | "#define BU_VERSION_H\n\n" | 137 | "#define BU_VERSION_H\n\n" |
133 | "#define LIBBU_VERSION 0\n" | 138 | "#define LIBBU_VERSION %d\n" |
134 | "#define LIBBU_REVISION 1\n" | 139 | "#define LIBBU_REVISION %d\n" |
135 | "#define LIBBU_VERSION_STR \"%s\"\n" | 140 | "#define LIBBU_VERSION_STR \"%s\"\n" |
136 | "#define LIBBU_API 0\n" | 141 | "#define LIBBU_API 0\n" |
137 | "#define LIBBU_VC_ID \"", | 142 | "#define LIBBU_VC_ID \"", |
143 | iVer, iRev, | ||
138 | buf | 144 | buf |
139 | ); | 145 | ); |
140 | 146 | ||
141 | char buf2[1024]; | ||
142 | FILE *psub = popen("git describe --always", "r"); | 147 | FILE *psub = popen("git describe --always", "r"); |
143 | buf2[fread( buf2, 1, 1024, psub )] = '\0'; | 148 | buf[fread( buf, 1, 1024, psub )] = '\0'; |
144 | for( int j = 0; buf2[j]; j++ ) | 149 | for( int j = 0; buf[j]; j++ ) |
145 | if( buf2[j] == '\n' ) | 150 | if( buf[j] == '\n' ) |
146 | buf2[j] = '\0'; | 151 | buf[j] = '\0'; |
147 | fwrite( buf2, strlen(buf2), 1, fOut ); | 152 | fwrite( buf, strlen(buf), 1, fOut ); |
148 | pclose( psub ); | 153 | pclose( psub ); |
149 | fprintf( fOut, "\"\n\n#endif\n"); | 154 | fprintf( fOut, "\"\n\n#endif\n"); |
150 | } | 155 | } |
diff --git a/default.bld b/default.bld index 68bd049..e140bee 100644 --- a/default.bld +++ b/default.bld | |||
@@ -61,7 +61,7 @@ target ["src/autoconfig.h", "src/version.h"] | |||
61 | 61 | ||
62 | target "src/version.h" | 62 | target "src/version.h" |
63 | { | 63 | { |
64 | input ".git"; | 64 | input [".git", "version"]; |
65 | } | 65 | } |
66 | 66 | ||
67 | target "src/signals.h" | 67 | target "src/signals.h" |