Generate files from .in files before compilation

This commit is contained in:
Frank Denis 2013-09-30 13:31:37 -07:00
parent e1e6e0cf7e
commit 3890eb1f33
3 changed files with 36 additions and 0 deletions

View File

@ -179,6 +179,10 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)msvc-scripts\process.bat</Command>
<Message>Process .in files</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
<ClCompile>
@ -195,6 +199,10 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>$(VC_SourcePath)/msvc-scripts/process.bat</Command>
<Message>Process .in files</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@ -248,6 +256,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>$(VC_SourcePath)/msvc-scripts/process.bat</Command>
<Message>Process .in files</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
<ClCompile>
@ -269,6 +281,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>$(VC_SourcePath)/msvc-scripts/process.bat</Command>
<Message>Process .in files</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>

8
msvc-scripts/process.bat Executable file
View File

@ -0,0 +1,8 @@
cscript msvc-scripts/rep.vbs //Nologo s/@HAVE_TI_MODE_V@/0/ < src\libsodium\include\sodium\crypto_scalarmult_curve25519.h.in > src\libsodium\include\sodium\crypto_scalarmult_curve25519.h
cscript msvc-scripts/rep.vbs //Nologo s/@HAVE_AMD64_ASM_V@/0/ < src\libsodium\include\sodium\crypto_stream_salsa20.h.in > src\libsodium\include\sodium\crypto_stream_salsa20.h
cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/0.4.3/ < src\libsodium\include\sodium\version.h.in > tmp
cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/4/ < tmp > tmp2
cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/3/ < tmp2 > src\libsodium\include\sodium\version.h
del tmp tmp2

12
msvc-scripts/rep.vbs Normal file
View File

@ -0,0 +1,12 @@
Dim pat, patparts, rxp, inp
pat = WScript.Arguments(0)
patparts = Split(pat, "/")
Set rxp = new RegExp
rxp.Global = True
rxp.Multiline = False
rxp.Pattern = patparts(1)
Do While Not WScript.StdIn.AtEndOfStream
inp = WScript.StdIn.ReadLine()
WScript.Echo rxp.Replace(inp, patparts(2))
Loop