Merge "clean up msvs project generation"

This commit is contained in:
John Koleszar 2011-03-04 05:44:54 -08:00 committed by Code Review
commit 27c04aaa67

View File

@ -32,7 +32,7 @@ Options:
--name=project_name Name of the project (required) --name=project_name Name of the project (required)
--proj-guid=GUID GUID to use for the project --proj-guid=GUID GUID to use for the project
--module-def=filename File containing export definitions (for DLLs) --module-def=filename File containing export definitions (for DLLs)
--ver=version Version (7,8) of visual studio to generate for --ver=version Version (7,8,9) of visual studio to generate for
-Ipath/to/include Additional include directories -Ipath/to/include Additional include directories
-DFLAG[=value] Preprocessor macros to define -DFLAG[=value] Preprocessor macros to define
-Lpath/to/lib Additional library search paths -Lpath/to/lib Additional library search paths
@ -132,7 +132,7 @@ generate_filter() {
open_tag Filter \ open_tag Filter \
Name=$name \ Name=$name \
Filter=$pats \ Filter=$pats \
UniqueIdentifier=`generate_uuid` UniqueIdentifier=`generate_uuid` \
file_list_sz=${#file_list[@]} file_list_sz=${#file_list[@]}
for i in ${!file_list[@]}; do for i in ${!file_list[@]}; do
@ -146,29 +146,19 @@ generate_filter() {
for plat in "${platforms[@]}"; do for plat in "${platforms[@]}"; do
for cfg in Debug Release; do for cfg in Debug Release; do
open_tag FileConfiguration \ open_tag FileConfiguration \
Name="${cfg}|${plat}" Name="${cfg}|${plat}" \
tag Tool \ tag Tool \
Name="VCCustomBuildTool" \ Name="VCCustomBuildTool" \
Description="Assembling \$(InputFileName)" \ Description="Assembling \$(InputFileName)" \
CommandLine="$(eval echo \$asm_${cfg}_cmdline)"\ CommandLine="$(eval echo \$asm_${cfg}_cmdline)" \
Outputs="\$(InputName).obj" Outputs="\$(InputName).obj" \
close_tag FileConfiguration close_tag FileConfiguration
done done
done done
fi fi
if [ "${f##*.}" == "cpp" ]; then
for plat in "${platforms[@]}"; do
for cfg in Debug Release; do
open_tag FileConfiguration \
Name="${cfg}|${plat}"
tag Tool \
Name="VCCLCompilerTool" \
CompileAs="2"
close_tag FileConfiguration
done
done
fi
close_tag File close_tag File
break break
@ -195,8 +185,7 @@ for opt in "$@"; do
;; ;;
--proj-guid=*) guid="${optval}" --proj-guid=*) guid="${optval}"
;; ;;
--module-def=*) --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}"
link_opts="${link_opts} ModuleDefinitionFile=${optval}"
;; ;;
--exe) proj_kind="exe" --exe) proj_kind="exe"
;; ;;
@ -204,15 +193,17 @@ for opt in "$@"; do
;; ;;
--static-crt) use_static_runtime=true --static-crt) use_static_runtime=true
;; ;;
--ver=*) vs_ver="$optval" --ver=*)
case $optval in vs_ver="$optval"
case "$optval" in
[789]) [789])
;; ;;
*) die Unrecognized Visual Studio Version in $opt *) die Unrecognized Visual Studio Version in $opt
;; ;;
esac esac
;; ;;
-I*) opt="${opt%/}" -I*)
opt="${opt%/}"
incs="${incs}${incs:+;}"${opt##-I}"" incs="${incs}${incs:+;}"${opt##-I}""
yasmincs="${yasmincs} ${opt}" yasmincs="${yasmincs} ${opt}"
;; ;;
@ -232,10 +223,13 @@ for opt in "$@"; do
;; ;;
-*) die_unknown $opt -*) die_unknown $opt
;; ;;
*) file_list[${#file_list[@]}]="$opt" *)
file_list[${#file_list[@]}]="$opt"
case "$opt" in case "$opt" in
*.asm) uses_asm=true;; *.asm) uses_asm=true
;;
esac esac
;;
esac esac
done done
outfile=${outfile:-/dev/stdout} outfile=${outfile:-/dev/stdout}
@ -278,8 +272,7 @@ done
# List Keyword for this target # List Keyword for this target
case "$target" in case "$target" in
x86*) x86*) keyword="ManagedCProj"
keyword="ManagedCProj"
;; ;;
*) die "Unsupported target $target!" *) die "Unsupported target $target!"
esac esac
@ -296,6 +289,7 @@ case "$target" in
asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(InputPath)"" asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(InputPath)""
;; ;;
*) die "Unsupported target $target!" *) die "Unsupported target $target!"
;;
esac esac
generate_vcproj() { generate_vcproj() {
@ -313,7 +307,7 @@ generate_vcproj() {
Name="${name}" \ Name="${name}" \
ProjectGUID="{${guid}}" \ ProjectGUID="{${guid}}" \
RootNamespace="${name}" \ RootNamespace="${name}" \
Keyword="${keyword}" Keyword="${keyword}" \
open_tag Platforms open_tag Platforms
for plat in "${platforms[@]}"; do for plat in "${platforms[@]}"; do
@ -336,10 +330,13 @@ generate_vcproj() {
OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
ConfigurationType="$vs_ConfigurationType" \ ConfigurationType="$vs_ConfigurationType" \
CharacterSet="1" CharacterSet="1" \
case "$target" in case "$target" in
x86*) tag Tool \ x86*)
case "$name" in
*)
tag Tool \
Name="VCCLCompilerTool" \ Name="VCCLCompilerTool" \
Optimization="0" \ Optimization="0" \
AdditionalIncludeDirectories="$incs" \ AdditionalIncludeDirectories="$incs" \
@ -353,36 +350,47 @@ generate_vcproj() {
$uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1" $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
;; ;;
esac esac
;;
esac
case "$proj_kind" in case "$proj_kind" in
exe) exe)
case "$target" in case "$target" in
x86*) tag Tool \ x86*)
case "$name" in
*)
tag Tool \
Name="VCLinkerTool" \ Name="VCLinkerTool" \
AdditionalDependencies="$debug_libs \$(NoInherit)" \ AdditionalDependencies="$debug_libs \$(NoInherit)" \
AdditionalLibraryDirectories="$libdirs" \ AdditionalLibraryDirectories="$libdirs" \
GenerateDebugInformation="true" \ GenerateDebugInformation="true" \
ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \ ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
;;
esac
;; ;;
esac esac
;; ;;
lib) lib)
case "$target" in case "$target" in
*) tag Tool \ x86*)
tag Tool \
Name="VCLibrarianTool" \ Name="VCLibrarianTool" \
OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \ OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
;; ;;
esac esac
;; ;;
dll) tag Tool \ dll)
tag Tool \
Name="VCLinkerTool" \ Name="VCLinkerTool" \
AdditionalDependencies="\$(NoInherit)" \ AdditionalDependencies="\$(NoInherit)" \
LinkIncremental="2" \ LinkIncremental="2" \
GenerateDebugInformation="true" \ GenerateDebugInformation="true" \
AssemblyDebug="1" \ AssemblyDebug="1" \
TargetMachine="1" \ TargetMachine="1" \
$link_opts $link_opts \
;;
esac esac
close_tag Configuration close_tag Configuration
@ -393,10 +401,13 @@ generate_vcproj() {
IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
ConfigurationType="$vs_ConfigurationType" \ ConfigurationType="$vs_ConfigurationType" \
CharacterSet="1" \ CharacterSet="1" \
WholeProgramOptimization="0" WholeProgramOptimization="0" \
case "$target" in case "$target" in
x86*) tag Tool \ x86*)
case "$name" in
*)
tag Tool \
Name="VCCLCompilerTool" \ Name="VCCLCompilerTool" \
AdditionalIncludeDirectories="$incs" \ AdditionalIncludeDirectories="$incs" \
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
@ -404,27 +415,37 @@ generate_vcproj() {
UsePrecompiledHeader="0" \ UsePrecompiledHeader="0" \
WarningLevel="3" \ WarningLevel="3" \
DebugInformationFormat="0" \ DebugInformationFormat="0" \
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true" \
$uses_asm && tag Tool Name="YASM" IncludePaths="$incs" $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
;; ;;
esac esac
;;
esac
case "$proj_kind" in case "$proj_kind" in
exe) exe)
case "$target" in case "$target" in
x86*) tag Tool \ x86*)
case "$name" in
*)
tag Tool \
Name="VCLinkerTool" \ Name="VCLinkerTool" \
AdditionalDependencies="$libs \$(NoInherit)" \ AdditionalDependencies="$libs \$(NoInherit)" \
AdditionalLibraryDirectories="$libdirs" \ AdditionalLibraryDirectories="$libdirs" \
;;
esac
;; ;;
esac esac
;; ;;
lib) lib)
case "$target" in case "$target" in
*) tag Tool \ x86*)
tag Tool \
Name="VCLibrarianTool" \ Name="VCLibrarianTool" \
OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \ OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
;; ;;
esac esac
;; ;;
@ -435,7 +456,9 @@ generate_vcproj() {
LinkIncremental="1" \ LinkIncremental="1" \
GenerateDebugInformation="true" \ GenerateDebugInformation="true" \
TargetMachine="1" \ TargetMachine="1" \
$link_opts $link_opts \
;;
esac esac
close_tag Configuration close_tag Configuration
@ -443,8 +466,8 @@ generate_vcproj() {
close_tag Configurations close_tag Configurations
open_tag Files open_tag Files
generate_filter srcs "Source Files" "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" generate_filter srcs "Source Files" "c;def;odl;idl;hpj;bat;asm;asmx"
generate_filter hdrs "Header Files" "h;hpp;hxx;hm;inl;inc;xsd" generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
generate_filter resrcs "Build Files" "mk" generate_filter resrcs "Build Files" "mk"
close_tag Files close_tag Files