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
Unified · Split
| @@ -32,7 +32,7 @@ Options: · 31 unmodified lines | ||
| 32 | 32 | --name=project_name Name of the project (required) |
| 33 | 33 | --proj-guid=GUID GUID to use for the project |
| 34 | 34 | --module-def=filename File containing export definitions (for DLLs) |
| 35 | − --ver=version Version (7,8) of visual studio to generate for | |
| 35 | + --ver=version Version (7,8,9) of visual studio to generate for | |
| 36 | 36 | -Ipath/to/include Additional include directories |
| 37 | 37 | -DFLAG[=value] Preprocessor macros to define |
| 38 | 38 | -Lpath/to/lib Additional library search paths |
| @@ -132,7 +132,7 @@ generate_filter() { · 93 unmodified lines | ||
| 132 | 132 | open_tag Filter \ |
| 133 | 133 | Name=$name \ |
| 134 | 134 | Filter=$pats \ |
| 135 | − UniqueIdentifier=`generate_uuid` | |
| 135 | + UniqueIdentifier=`generate_uuid` \ | |
| 136 | 136 | |
| 137 | 137 | file_list_sz=${#file_list[@]} |
| 138 | 138 | for i in ${!file_list[@]}; do |
| @@ -145,31 +145,21 @@ generate_filter() { · 6 unmodified lines | ||
| 145 | 145 | if [ "$pat" == "asm" ] && $asm_use_custom_step; then |
| 146 | 146 | for plat in "${platforms[@]}"; do |
| 147 | 147 | for cfg in Debug Release; do |
| 148 | − open_tag FileConfiguration \ | |
| 149 | − Name="${cfg}|${plat}" | |
| 148 | + open_tag FileConfiguration \ | |
| 149 | + Name="${cfg}|${plat}" \ | |
| 150 | + | |
| 150 | 151 | tag Tool \ |
| 151 | 152 | Name="VCCustomBuildTool" \ |
| 152 | 153 | Description="Assembling \$(InputFileName)" \ |
| 153 | − CommandLine="$(eval echo \$asm_${cfg}_cmdline)"\ | |
| 154 | − Outputs="\$(InputName).obj" | |
| 154 | + CommandLine="$(eval echo \$asm_${cfg}_cmdline)" \ | |
| 155 | + Outputs="\$(InputName).obj" \ | |
| 156 | + | |
| 155 | 157 | close_tag FileConfiguration |
| 156 | 158 | done |
| 157 | 159 | done |
| 158 | 160 | fi |
| 159 | 161 | |
| 160 | − if [ "${f##*.}" == "cpp" ]; then | |
| 161 | − for plat in "${platforms[@]}"; do | |
| 162 | − for cfg in Debug Release; do | |
| 163 | − open_tag FileConfiguration \ | |
| 164 | − Name="${cfg}|${plat}" | |
| 165 | − tag Tool \ | |
| 166 | − Name="VCCLCompilerTool" \ | |
| 167 | − CompileAs="2" | |
| 168 | − close_tag FileConfiguration | |
| 169 | − done | |
| 170 | − done | |
| 171 | − fi | |
| 172 | − close_tag File | |
| 162 | + close_tag File | |
| 173 | 163 | |
| 174 | 164 | break |
| 175 | 165 | fi |
| @@ -185,57 +175,61 @@ unset target · 9 unmodified lines | ||
| 185 | 175 | for opt in "$@"; do |
| 186 | 176 | optval="${opt#*=}" |
| 187 | 177 | case "$opt" in |
| 188 | − --help|-h) show_help | |
| 189 | − ;; | |
| 190 | − --target=*) target="${optval}" | |
| 191 | − ;; | |
| 192 | − --out=*) outfile="$optval" | |
| 193 | − ;; | |
| 194 | − --name=*) name="${optval}" | |
| 195 | − ;; | |
| 196 | − --proj-guid=*) guid="${optval}" | |
| 197 | − ;; | |
| 198 | − --module-def=*) | |
| 199 | − link_opts="${link_opts} ModuleDefinitionFile=${optval}" | |
| 200 | − ;; | |
| 201 | − --exe) proj_kind="exe" | |
| 202 | − ;; | |
| 203 | − --lib) proj_kind="lib" | |
| 204 | − ;; | |
| 205 | − --static-crt) use_static_runtime=true | |
| 206 | − ;; | |
| 207 | − --ver=*) vs_ver="$optval" | |
| 208 | − case $optval in | |
| 209 | − [789]) | |
| 210 | − ;; | |
| 211 | − *) die Unrecognized Visual Studio Version in $opt | |
| 212 | − ;; | |
| 213 | − esac | |
| 214 | − ;; | |
| 215 | − -I*) opt="${opt%/}" | |
| 216 | − incs="${incs}${incs:+;}"${opt##-I}"" | |
| 217 | − yasmincs="${yasmincs} ${opt}" | |
| 218 | − ;; | |
| 219 | − -D*) defines="${defines}${defines:+;}${opt##-D}" | |
| 220 | − ;; | |
| 221 | − -L*) # fudge . to $(OutDir) | |
| 222 | − if [ "${opt##-L}" == "." ]; then | |
| 223 | − libdirs="${libdirs}${libdirs:+;}"\$(OutDir)"" | |
| 224 | − else | |
| 225 | − # Also try directories for this platform/configuration | |
| 226 | − libdirs="${libdirs}${libdirs:+;}"${opt##-L}"" | |
| 227 | − libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)/\$(ConfigurationName)"" | |
| 228 | − libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)"" | |
| 229 | − fi | |
| 230 | − ;; | |
| 231 | − -l*) libs="${libs}${libs:+ }${opt##-l}.lib" | |
| 232 | − ;; | |
| 233 | − -*) die_unknown $opt | |
| 234 | − ;; | |
| 235 | − *) file_list[${#file_list[@]}]="$opt" | |
| 236 | − case "$opt" in | |
| 237 | − *.asm) uses_asm=true;; | |
| 238 | − esac | |
| 178 | + --help|-h) show_help | |
| 179 | + ;; | |
| 180 | + --target=*) target="${optval}" | |
| 181 | + ;; | |
| 182 | + --out=*) outfile="$optval" | |
| 183 | + ;; | |
| 184 | + --name=*) name="${optval}" | |
| 185 | + ;; | |
| 186 | + --proj-guid=*) guid="${optval}" | |
| 187 | + ;; | |
| 188 | + --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}" | |
| 189 | + ;; | |
| 190 | + --exe) proj_kind="exe" | |
| 191 | + ;; | |
| 192 | + --lib) proj_kind="lib" | |
| 193 | + ;; | |
| 194 | + --static-crt) use_static_runtime=true | |
| 195 | + ;; | |
| 196 | + --ver=*) | |
| 197 | + vs_ver="$optval" | |
| 198 | + case "$optval" in | |
| 199 | + [789]) | |
| 200 | + ;; | |
| 201 | + *) die Unrecognized Visual Studio Version in $opt | |
| 202 | + ;; | |
| 203 | + esac | |
| 204 | + ;; | |
| 205 | + -I*) | |
| 206 | + opt="${opt%/}" | |
| 207 | + incs="${incs}${incs:+;}"${opt##-I}"" | |
| 208 | + yasmincs="${yasmincs} ${opt}" | |
| 209 | + ;; | |
| 210 | + -D*) defines="${defines}${defines:+;}${opt##-D}" | |
| 211 | + ;; | |
| 212 | + -L*) # fudge . to $(OutDir) | |
| 213 | + if [ "${opt##-L}" == "." ]; then | |
| 214 | + libdirs="${libdirs}${libdirs:+;}"\$(OutDir)"" | |
| 215 | + else | |
| 216 | + # Also try directories for this platform/configuration | |
| 217 | + libdirs="${libdirs}${libdirs:+;}"${opt##-L}"" | |
| 218 | + libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)/\$(ConfigurationName)"" | |
| 219 | + libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)"" | |
| 220 | + fi | |
| 221 | + ;; | |
| 222 | + -l*) libs="${libs}${libs:+ }${opt##-l}.lib" | |
| 223 | + ;; | |
| 224 | + -*) die_unknown $opt | |
| 225 | + ;; | |
| 226 | + *) | |
| 227 | + file_list[${#file_list[@]}]="$opt" | |
| 228 | + case "$opt" in | |
| 229 | + *.asm) uses_asm=true | |
| 230 | + ;; | |
| 231 | + esac | |
| 232 | + ;; | |
| 239 | 233 | esac |
| 240 | 234 | done |
| 241 | 235 | outfile=${outfile:-/dev/stdout} |
| @@ -278,8 +272,7 @@ done · 36 unmodified lines | ||
| 278 | 272 | |
| 279 | 273 | # List Keyword for this target |
| 280 | 274 | case "$target" in |
| 281 | − x86*) | |
| 282 | − keyword="ManagedCProj" | |
| 275 | + x86*) keyword="ManagedCProj" | |
| 283 | 276 | ;; |
| 284 | 277 | *) die "Unsupported target $target!" |
| 285 | 278 | esac |
| @@ -296,155 +289,185 @@ case "$target" in · 10 unmodified lines | ||
| 296 | 289 | asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(InputPath)"" |
| 297 | 290 | ;; |
| 298 | 291 | *) die "Unsupported target $target!" |
| 292 | + ;; | |
| 299 | 293 | esac |
| 300 | 294 | |
| 301 | 295 | generate_vcproj() { |
| 302 | 296 | case "$proj_kind" in |
| 303 | − exe) vs_ConfigurationType=1 | |
| 304 | − ;; | |
| 305 | − *) vs_ConfigurationType=4 | |
| 306 | − ;; | |
| 297 | + exe) vs_ConfigurationType=1 | |
| 298 | + ;; | |
| 299 | + *) vs_ConfigurationType=4 | |
| 300 | + ;; | |
| 307 | 301 | esac |
| 308 | 302 | |
| 309 | 303 | echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>" |
| 310 | − open_tag VisualStudioProject \ | |
| 311 | − ProjectType="Visual C++" \ | |
| 312 | − Version="${vs_ver_id}" \ | |
| 313 | − Name="${name}" \ | |
| 314 | − ProjectGUID="{${guid}}" \ | |
| 315 | − RootNamespace="${name}" \ | |
| 316 | − Keyword="${keyword}" | |
| 317 | − | |
| 318 | − open_tag Platforms | |
| 304 | + open_tag VisualStudioProject \ | |
| 305 | + ProjectType="Visual C++" \ | |
| 306 | + Version="${vs_ver_id}" \ | |
| 307 | + Name="${name}" \ | |
| 308 | + ProjectGUID="{${guid}}" \ | |
| 309 | + RootNamespace="${name}" \ | |
| 310 | + Keyword="${keyword}" \ | |
| 311 | + | |
| 312 | + open_tag Platforms | |
| 319 | 313 | for plat in "${platforms[@]}"; do |
| 320 | − tag Platform Name="$plat" | |
| 314 | + tag Platform Name="$plat" | |
| 321 | 315 | done |
| 322 | 316 | close_tag Platforms |
| 323 | 317 | |
| 324 | − open_tag ToolFiles | |
| 318 | + open_tag ToolFiles | |
| 325 | 319 | case "$target" in |
| 326 | 320 | x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/yasm.rules" |
| 327 | 321 | ;; |
| 328 | 322 | esac |
| 329 | 323 | close_tag ToolFiles |
| 330 | 324 | |
| 331 | − open_tag Configurations | |
| 325 | + open_tag Configurations | |
| 332 | 326 | for plat in "${platforms[@]}"; do |
| 333 | 327 | plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'` |
| 334 | − open_tag Configuration \ | |
| 335 | − Name="Debug|$plat" \ | |
| 336 | − OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ | |
| 337 | − IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ | |
| 338 | − ConfigurationType="$vs_ConfigurationType" \ | |
| 339 | − CharacterSet="1" | |
| 328 | + open_tag Configuration \ | |
| 329 | + Name="Debug|$plat" \ | |
| 330 | + OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ | |
| 331 | + IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ | |
| 332 | + ConfigurationType="$vs_ConfigurationType" \ | |
| 333 | + CharacterSet="1" \ | |
| 340 | 334 | |
| 341 | 335 | case "$target" in |
| 342 | − x86*) tag Tool \ | |
| 343 | − Name="VCCLCompilerTool" \ | |
| 344 | − Optimization="0" \ | |
| 345 | − AdditionalIncludeDirectories="$incs" \ | |
| 346 | − PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ | |
| 347 | − RuntimeLibrary="$debug_runtime" \ | |
| 348 | − UsePrecompiledHeader="0" \ | |
| 349 | − WarningLevel="3" \ | |
| 350 | − DebugInformationFormat="1" \ | |
| 351 | − Detect64BitPortabilityProblems="true" \ | |
| 352 | − | |
| 353 | − $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1" | |
| 336 | + x86*) | |
| 337 | + case "$name" in | |
| 338 | + *) | |
| 339 | + tag Tool \ | |
| 340 | + Name="VCCLCompilerTool" \ | |
| 341 | + Optimization="0" \ | |
| 342 | + AdditionalIncludeDirectories="$incs" \ | |
| 343 | + PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ | |
| 344 | + RuntimeLibrary="$debug_runtime" \ | |
| 345 | + UsePrecompiledHeader="0" \ | |
| 346 | + WarningLevel="3" \ | |
| 347 | + DebugInformationFormat="1" \ | |
| 348 | + Detect64BitPortabilityProblems="true" \ | |
| 349 | + | |
| 350 | + $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1" | |
| 351 | + ;; | |
| 352 | + esac | |
| 354 | 353 | ;; |
| 355 | 354 | esac |
| 356 | 355 | |
| 357 | 356 | case "$proj_kind" in |
| 358 | 357 | exe) |
| 359 | 358 | case "$target" in |
| 360 | − x86*) tag Tool \ | |
| 361 | − Name="VCLinkerTool" \ | |
| 362 | − AdditionalDependencies="$debug_libs \$(NoInherit)" \ | |
| 363 | − AdditionalLibraryDirectories="$libdirs" \ | |
| 364 | − GenerateDebugInformation="true" \ | |
| 365 | − ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \ | |
| 366 | − | |
| 359 | + x86*) | |
| 360 | + case "$name" in | |
| 361 | + *) | |
| 362 | + tag Tool \ | |
| 363 | + Name="VCLinkerTool" \ | |
| 364 | + AdditionalDependencies="$debug_libs \$(NoInherit)" \ | |
| 365 | + AdditionalLibraryDirectories="$libdirs" \ | |
| 366 | + GenerateDebugInformation="true" \ | |
| 367 | + ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \ | |
| 368 | + ;; | |
| 369 | + esac | |
| 367 | 370 | ;; |
| 368 | 371 | esac |
| 369 | 372 | ;; |
| 370 | 373 | lib) |
| 371 | 374 | case "$target" in |
| 372 | − *) tag Tool \ | |
| 373 | − Name="VCLibrarianTool" \ | |
| 374 | − OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \ | |
| 375 | − ;; | |
| 375 | + x86*) | |
| 376 | + tag Tool \ | |
| 377 | + Name="VCLibrarianTool" \ | |
| 378 | + OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \ | |
| 379 | + | |
| 380 | + ;; | |
| 376 | 381 | esac |
| 377 | 382 | ;; |
| 378 | − dll) tag Tool \ | |
| 379 | − Name="VCLinkerTool" \ | |
| 380 | − AdditionalDependencies="\$(NoInherit)" \ | |
| 381 | − LinkIncremental="2" \ | |
| 382 | − GenerateDebugInformation="true" \ | |
| 383 | − AssemblyDebug="1" \ | |
| 384 | − TargetMachine="1" \ | |
| 385 | − $link_opts | |
| 383 | + dll) | |
| 384 | + tag Tool \ | |
| 385 | + Name="VCLinkerTool" \ | |
| 386 | + AdditionalDependencies="\$(NoInherit)" \ | |
| 387 | + LinkIncremental="2" \ | |
| 388 | + GenerateDebugInformation="true" \ | |
| 389 | + AssemblyDebug="1" \ | |
| 390 | + TargetMachine="1" \ | |
| 391 | + $link_opts \ | |
| 392 | + | |
| 393 | + ;; | |
| 386 | 394 | esac |
| 387 | 395 | |
| 388 | 396 | close_tag Configuration |
| 389 | 397 | |
| 390 | − open_tag Configuration \ | |
| 391 | − Name="Release|$plat" \ | |
| 392 | − OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ | |
| 393 | − IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ | |
| 394 | − ConfigurationType="$vs_ConfigurationType" \ | |
| 395 | − CharacterSet="1" \ | |
| 396 | − WholeProgramOptimization="0" | |
| 398 | + open_tag Configuration \ | |
| 399 | + Name="Release|$plat" \ | |
| 400 | + OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ | |
| 401 | + IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ | |
| 402 | + ConfigurationType="$vs_ConfigurationType" \ | |
| 403 | + CharacterSet="1" \ | |
| 404 | + WholeProgramOptimization="0" \ | |
| 397 | 405 | |
| 398 | − case "$target" in | |
| 399 | − x86*) tag Tool \ | |
| 400 | − Name="VCCLCompilerTool" \ | |
| 401 | − AdditionalIncludeDirectories="$incs" \ | |
| 402 | − PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ | |
| 403 | − RuntimeLibrary="$release_runtime" \ | |
| 404 | − UsePrecompiledHeader="0" \ | |
| 405 | − WarningLevel="3" \ | |
| 406 | − DebugInformationFormat="0" \ | |
| 407 | − Detect64BitPortabilityProblems="true" | |
| 408 | − | |
| 409 | − $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" | |
| 410 | − ;; | |
| 406 | + case "$target" in | |
| 407 | + x86*) | |
| 408 | + case "$name" in | |
| 409 | + *) | |
| 410 | + tag Tool \ | |
| 411 | + Name="VCCLCompilerTool" \ | |
| 412 | + AdditionalIncludeDirectories="$incs" \ | |
| 413 | + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ | |
| 414 | + RuntimeLibrary="$release_runtime" \ | |
| 415 | + UsePrecompiledHeader="0" \ | |
| 416 | + WarningLevel="3" \ | |
| 417 | + DebugInformationFormat="0" \ | |
| 418 | + Detect64BitPortabilityProblems="true" \ | |
| 419 | + | |
| 420 | + $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" | |
| 421 | + ;; | |
| 411 | 422 | esac |
| 423 | + ;; | |
| 424 | + esac | |
| 412 | 425 | |
| 413 | 426 | case "$proj_kind" in |
| 414 | 427 | exe) |
| 415 | 428 | case "$target" in |
| 416 | − x86*) tag Tool \ | |
| 417 | − Name="VCLinkerTool" \ | |
| 418 | − AdditionalDependencies="$libs \$(NoInherit)" \ | |
| 419 | − AdditionalLibraryDirectories="$libdirs" \ | |
| 429 | + x86*) | |
| 430 | + case "$name" in | |
| 431 | + *) | |
| 432 | + tag Tool \ | |
| 433 | + Name="VCLinkerTool" \ | |
| 434 | + AdditionalDependencies="$libs \$(NoInherit)" \ | |
| 435 | + AdditionalLibraryDirectories="$libdirs" \ | |
| 436 | + | |
| 437 | + ;; | |
| 438 | + esac | |
| 420 | 439 | ;; |
| 421 | 440 | esac |
| 422 | 441 | ;; |
| 423 | − lib) | |
| 442 | + lib) | |
| 424 | 443 | case "$target" in |
| 425 | − *) tag Tool \ | |
| 426 | − Name="VCLibrarianTool" \ | |
| 427 | − OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \ | |
| 428 | − ;; | |
| 444 | + x86*) | |
| 445 | + tag Tool \ | |
| 446 | + Name="VCLibrarianTool" \ | |
| 447 | + OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \ | |
| 448 | + | |
| 449 | + ;; | |
| 429 | 450 | esac |
| 430 | − ;; | |
| 431 | − dll) # note differences to debug version: LinkIncremental, AssemblyDebug | |
| 432 | − tag Tool \ | |
| 433 | − Name="VCLinkerTool" \ | |
| 434 | − AdditionalDependencies="\$(NoInherit)" \ | |
| 435 | − LinkIncremental="1" \ | |
| 436 | − GenerateDebugInformation="true" \ | |
| 437 | − TargetMachine="1" \ | |
| 438 | − $link_opts | |
| 451 | + ;; | |
| 452 | + dll) # note differences to debug version: LinkIncremental, AssemblyDebug | |
| 453 | + tag Tool \ | |
| 454 | + Name="VCLinkerTool" \ | |
| 455 | + AdditionalDependencies="\$(NoInherit)" \ | |
| 456 | + LinkIncremental="1" \ | |
| 457 | + GenerateDebugInformation="true" \ | |
| 458 | + TargetMachine="1" \ | |
| 459 | + $link_opts \ | |
| 460 | + | |
| 461 | + ;; | |
| 439 | 462 | esac |
| 440 | 463 | |
| 441 | 464 | close_tag Configuration |
| 442 | 465 | done |
| 443 | 466 | close_tag Configurations |
| 444 | 467 | |
| 445 | − open_tag Files | |
| 446 | − generate_filter srcs "Source Files" "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | |
| 447 | − generate_filter hdrs "Header Files" "h;hpp;hxx;hm;inl;inc;xsd" | |
| 468 | + open_tag Files | |
| 469 | + generate_filter srcs "Source Files" "c;def;odl;idl;hpj;bat;asm;asmx" | |
| 470 | + generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd" | |
| 448 | 471 | generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
| 449 | 472 | generate_filter resrcs "Build Files" "mk" |
| 450 | 473 | close_tag Files |