☰
Current Page
Main Menu
Home
Home
Editing
VersionStrings
Edit
Preview
h1
h2
h3
Keybinding
default
vim
emacs
Markup
Markdown
Plain Text
Pod
RDoc
reStructuredText
AsciiDoc
BibTeX
Creole
MediaWiki
Org-mode
Textile
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
--- title: VersionStrings --- # Methods Compiler define: Set a preprocessor define passed to the compiler. Keyword substitution: Provide a header with keywords into which substitutions are made. Template header: Provide a template with keywords which are processed and output to a generated header. # Tools TortoiseSVN: SubWCRev svn: svnversion git: git-describe # Implementation ## Compiler Define ### Subversion -D`svnversion` Requires svn command line tools (not installed by default with TortoiseSVN). ### Git -D`git describe` ## Keyword substitution * An anti-pattern * Unsuitable for VCSs with no global version id (SVN). ## Template Header ### Subversion Create a template header file "version.in" of the form: #ifndef VERSION_H #define VERSION_H #define VERSION\_VCS\_REV "$WCREV$" #define VERSION\_BUILD\_TIME "$WCNOW$" #define VERSION\_VCS\_PATH "$WCURL$" #define VERSION\_LOCAL\_MODS $WCMODS?1:0$ #endif /\*VERSION_H\*/ and in the build script run SubWCRev . version.in version.h The generated output looks like #ifndef VERSION_H #define VERSION_H #define VERSION\_VCS\_REV "120" #define VERSION\_BUILD\_TIME "2013/02/21 17:44:46" #define VERSION\_VCS\_PATH "http://path/to/repo/trunk" #define VERSION\_LOCAL\_MODS 1 #endif /\*VERSION_H\*/ ### Git No equivalent? #### Problems * No way to pre-process the variables in the build script. * Windows platform only. ## Generated Header * Dependency problems # Links * <http://stackoverflow.com/questions/1704907/how-can-i-get-my-c-code-to-automatically-print-out-its-git-version-hash> [4]: VersionStrings?action=sourceblock&num=1 [5]: VersionStrings?action=sourceblock&num=2 <!-- vim: filetype=markdown -->
Uploading file...
Sidebar
# SideBar * [Home][1] * [Projects][2] * * * <!-- --> * [Code][3] * [Tech][4] * [Network][5] * [MediaCentre][6] * [UAV][7] * * * <!-- --> * [Travel][8] * [Music][9] * [Horse Riding][10] * [Study][11] * [Games][12] * [Other Activities][13] * * * <!-- --> * [Car][14] * [House][15] * [Watch][16] * [Clothing][17] * [Miscellany][18] * * * [1]: /Home [2]: /Projects [3]: /Code/Code [4]: /Tech/Tech [5]: /Network/Network [6]: /MediaCentre/MediaCentre [7]: /UAV/UAV [8]: /Travel/Travel [9]: /Music/Music [10]: /HorseRiding/HorseRiding [11]: /Study/Study [12]: /Games/Games [13]: /Do/Do [14]: /Car/Car [15]: /House/House [16]: /Watch/Watch [17]: /Clothing/Clothing [18]: /Miscellany/Miscellany <!-- vim: filetype=markdown -->
Edit message:
Cancel