clean up msvs project generation

add visual studio 9 to --help

remove cpp, cxx, hpp, hxx files from filter

add the ability to target project names. this will be necessary to
enable obj_int_extract

Change-Id: I407583320d8b67a0df40c07221838c42678792f7
This commit is contained in:
Johann 2011-02-28 14:13:39 -05:00
Родитель 4decd27947
Коммит a1cfcb413d
1 изменённых файлов: 186 добавлений и 163 удалений

Просмотреть файл

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