Eliminate need for bison/flex in Visual Studio builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeff Cohen 2005-10-26 05:37:34 +00:00
parent 3fd24bd61f
commit 4ed1de843d
6 changed files with 75 additions and 32 deletions

View File

@ -0,0 +1,4 @@
Lexer.cpp
llvmAsmParser.cpp
llvmAsmParser.h
llvmAsmParser.output

View File

@ -20,7 +20,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;.."
AdditionalIncludeDirectories="..\..\include;..;..\..\lib\AsmParser"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@ -65,7 +65,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include;.."
AdditionalIncludeDirectories="..\..\include;..;..\..\lib\AsmParser"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
RuntimeLibrary="2"
ForceConformanceInForLoopScope="TRUE"
@ -114,16 +114,16 @@
<Tool
Name="VCCustomBuildTool"
Description="Flexing $(InputFileName)"
CommandLine="..\tools\flex -t &gt;$(InputDir)$(InputName).cpp $(InputPath)"
Outputs="$(InputDir)$(InputName).cpp"/>
CommandLine="..\doflex.cmd debug $(InputName) $(InputPath)"
Outputs="$(InputName).cpp"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Flexing $(InputFileName)"
CommandLine="..\tools\flex -t &gt;$(InputDir)$(InputName).cpp $(InputPath)"
Outputs="$(InputDir)$(InputName).cpp"/>
CommandLine="..\doflex.cmd release $(InputName) $(InputPath)"
Outputs="$(InputName).cpp"/>
</FileConfiguration>
</File>
<File
@ -133,20 +133,18 @@
<Tool
Name="VCCustomBuildTool"
Description="Bisoning $(InputFileName)"
CommandLine="..\tools\bison -pllvmAsm -tvdo$(InputDir)$(InputName).cpp $(InputPath)
move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
CommandLine="..\dobison.cmd llvmAsm debug $(InputName) $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp;$(InputDir)$(InputName).h"/>
Outputs="$(InputName).cpp;$(InputName).h"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Bisoning $(InputFileName)"
CommandLine="..\tools\bison -pllvmAsm -vdo$(InputDir)$(InputName).cpp $(InputPath)
move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
CommandLine="..\dobison.cmd llvmAsm release $(InputName) $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp;$(InputDir)$(InputName).h"/>
Outputs="$(InputName).cpp;$(InputName).h"/>
</FileConfiguration>
</File>
<File
@ -168,13 +166,13 @@ move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
Name="Generated Files"
Filter="">
<File
RelativePath="..\..\lib\AsmParser\Lexer.cpp">
RelativePath="Lexer.cpp">
</File>
<File
RelativePath="..\..\lib\AsmParser\llvmAsmParser.cpp">
RelativePath="llvmAsmParser.cpp">
</File>
<File
RelativePath="..\..\lib\AsmParser\llvmAsmParser.h">
RelativePath="llvmAsmParser.h">
</File>
</Filter>
</Files>

View File

@ -0,0 +1,4 @@
FileLexer.cpp
FileParser.cpp
FileParser.h
FileParser.output

View File

@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;.."
AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@ -72,7 +72,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include;.."
AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
RuntimeLibrary="2"
ForceConformanceInForLoopScope="TRUE"
@ -142,18 +142,16 @@
<Tool
Name="VCCustomBuildTool"
Description="Flexing $(InputFileName)"
CommandLine="..\tools\flex -t &gt;$(InputDir)$(InputName).cpp $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp"/>
CommandLine="..\doflex.cmd debug $(InputName) $(InputPath)"
Outputs="$(InputName).cpp"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Flexing $(InputFileName)"
CommandLine="..\tools\flex -t &gt;$(InputDir)$(InputName).cpp $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp"/>
CommandLine="..\doflex.cmd release $(InputName) $(InputPath)"
Outputs="$(InputName).cpp"/>
</FileConfiguration>
</File>
<File
@ -163,20 +161,18 @@
<Tool
Name="VCCustomBuildTool"
Description="Bisoning $(InputFileName)"
CommandLine="..\tools\bison -pFile -tvdo$(InputDir)$(InputName).cpp $(InputPath)
move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
CommandLine="..\dobison.cmd File debug $(InputName) $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp;$(InputDir)$(InputName).h"/>
Outputs="$(InputName).cpp;$(InputName).h"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Bisoning $(InputFileName)"
CommandLine="..\tools\bison -pFile -vdo$(InputDir)$(InputName).cpp $(InputPath)
move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
CommandLine="..\dobison.cmd File release $(InputName) $(InputPath)
"
Outputs="$(InputDir)$(InputName).cpp;$(InputDir)$(InputName).h"/>
Outputs="$(InputName).cpp;$(InputName).h"/>
</FileConfiguration>
</File>
<File
@ -240,7 +236,7 @@ move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
Name="Generated Files"
Filter="">
<File
RelativePath="..\..\utils\TableGen\FileLexer.cpp">
RelativePath="FileLexer.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
@ -255,7 +251,7 @@ move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
</FileConfiguration>
</File>
<File
RelativePath="..\..\utils\TableGen\fileparser.cpp">
RelativePath="fileparser.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
@ -270,7 +266,7 @@ move $(InputDir)$(InputName).hpp $(InputDir)$(InputName).h
</FileConfiguration>
</File>
<File
RelativePath="..\..\utils\TableGen\fileparser.h">
RelativePath="fileparser.h">
</File>
</Filter>
</Files>

22
win32/dobison.cmd Executable file
View File

@ -0,0 +1,22 @@
@echo off
rem dobison.cmd prefix mode target source
rem prefix - passed to bison as -p<prefix>
rem mode - either debug or release
rem target - generated parser file name without extension
rem source - input to bison
if "%2"=="debug" (set flags=-tvdo) else (set flags=-vdo)
rem Try and run bison. If it is present, great.
bison -p%1 %flags%%3.cpp %4
if errorlevel 1 goto error
move %3.hpp %3.h
goto done
:error
echo Bison could not run. Using pre-generated files.
copy %~pn4.cpp %3.cpp
copy %~pn4.h %3.h
:done
exit 0

19
win32/doflex.cmd Executable file
View File

@ -0,0 +1,19 @@
@echo off
rem doflex.cmd prefix mode target source
rem mode - either debug or release
rem target - generated parser file name without extension
rem source - input to bison
if "%1"=="debug" (set flags=-t) else (set flags=-t)
rem Try and run flex. If it is present, great.
flex %flags% >%2.cpp %3
if errorlevel 1 goto error
goto done
:error
echo Flex could not run. Using pre-generated files.
copy %~pn3.cpp %2.cpp
:done
exit 0