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