summaryrefslogtreecommitdiff
path: root/build/make/gen_msvs_proj.sh
blob: 477dec7febd8b5cb12e5c0a968539aaf316bdebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
#!/bin/bash
##
##  Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
##
##  Use of this source code is governed by a BSD-style license and patent
##  grant that can be found in the LICENSE file in the root of the source
##  tree. All contributing project authors may be found in the AUTHORS
##  file in the root of the source tree.
##


self=$0
self_basename=${self##*/}
EOL=$'\n'

show_help() {
    cat <<EOF
Usage: ${self_basename} --name=projname [options] file1 [file2 ...]

This script generates a Visual Studio project file from a list of source
code files.

Options:
    --help                      Print this message
    --exe                       Generate a project for building an Application
    --lib                       Generate a project for creating a static library
    --static-crt                Use the static C runtime (/MT)
    --target=isa-os-cc          Target specifier (required)
    --out=filename              Write output to a file [stdout]
    --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
    -Ipath/to/include           Additional include directories
    -DFLAG[=value]              Preprocessor macros to define
    -Lpath/to/lib               Additional library search paths
    -llibname                   Library to link against
EOF
    exit 1
}

die() {
    echo "${self_basename}: $@" >&2
    exit 1
}

die_unknown(){
    echo "Unknown option \"$1\"." >&2
    echo "See ${self_basename} --help for available options." >&2
    exit 1
}

generate_uuid() {
    local hex="0123456789ABCDEF"
    local i
    local uuid=""
    local j
    #93995380-89BD-4b04-88EB-625FBE52EBFB
    for ((i=0; i<32; i++)); do
        (( j = $RANDOM % 16 ))
        uuid="${uuid}${hex:$j:1}"
    done
    echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
}

indent1="    "
indent=""
indent_push() {
    indent="${indent}${indent1}"
}
indent_pop() {
    indent="${indent%${indent1}}"
}

tag_attributes() {
    for opt in "$@"; do
        optval="${opt#*=}"
        [ -n "${optval}" ] ||
            die "Missing attribute value in '$opt' while generating $tag tag"
        echo "${indent}${opt%%=*}=\"${optval}\""
    done
}

open_tag() {
    local tag=$1
    shift
    if [ $# -ne 0 ]; then
        echo "${indent}<${tag}"
        indent_push
        tag_attributes "$@"
        echo "${indent}>"
    else
        echo "${indent}<${tag}>"
        indent_push
    fi
}

close_tag() {
    local tag=$1
    indent_pop
    echo "${indent}</${tag}>"
}

tag() {
    local tag=$1
    shift
    if [ $# -ne 0 ]; then
        echo "${indent}<${tag}"
        indent_push
        tag_attributes "$@"
        indent_pop
        echo "${indent}/>"
    else
        echo "${indent}<${tag}/>"
    fi
}

generate_filter() {
    local var=$1
    local name=$2
    local pats=$3
    local file_list_sz
    local i
    local f
    local saveIFS="$IFS"
    local pack
    echo "generating filter '$name' from ${#file_list[@]} files" >&2
    IFS=*

    open_tag Filter \
        Name=$name \
        Filter=$pats \
        UniqueIdentifier=`generate_uuid`

    file_list_sz=${#file_list[@]}
    for i in ${!file_list[@]}; do
        f=${file_list[i]}
        for pat in ${pats//;/$IFS}; do
            if [ "${f##*.}" == "$pat" ]; then
                unset file_list[i]

                open_tag File RelativePath="./$f"
                if [ "$pat" == "asm" ] && $asm_use_custom_step; then
                    for plat in "${platforms[@]}"; do
                        for cfg in Debug Release; do
                            open_tag  FileConfiguration \
                            Name="${cfg}|${plat}"
                            tag Tool \
                                Name="VCCustomBuildTool" \
                                Description="Assembling \$(InputFileName)" \
                                CommandLine="$(eval echo \$asm_${cfg}_cmdline)"\
                                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
            fi
        done
    done

    close_tag Filter
    IFS="$saveIFS"
}

# Process command line
unset target
for opt in "$@"; do
    optval="${opt#*=}"
    case "$opt" in
    --help|-h) show_help
    ;;
    --target=*) target="${optval}"
    ;;
    --out=*) outfile="$optval"
    ;;
    --name=*) name="${optval}"
    ;;
    --proj-guid=*) guid="${optval}"
    ;;
    --module-def=*)
        link_opts="${link_opts} ModuleDefinitionFile=${optval}"
    ;;
    --exe) proj_kind="exe"
    ;;
    --lib) proj_kind="lib"
    ;;
    --static-crt) use_static_runtime=true
    ;;
    --ver=*) vs_ver="$optval"
             case $optval in
             [78])
             ;;
             *) die Unrecognized Visual Studio Version in $opt
             ;;
             esac
    ;;
    -I*) opt="${opt%/}"
         incs="${incs}${incs:+;}&quot;${opt##-I}&quot;"
         yasmincs="${yasmincs} ${opt}"
    ;;
    -D*) defines="${defines}${defines:+;}${opt##-D}"
    ;;
    -L*) # fudge . to $(OutDir)
         if [ "${opt##-L}" == "." ]; then
             libdirs="${libdirs}${libdirs:+;}&quot;\$(OutDir)&quot;"
         else
             # Also try directories for this platform/configuration
             libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}&quot;"
             libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)/\$(ConfigurationName)&quot;"
             libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)&quot;"
         fi
    ;;
    -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
    ;;
    -*) die_unknown $opt
    ;;
    *) file_list[${#file_list[@]}]="$opt"
       case "$opt" in
       *.asm) uses_asm=true;;
       esac
    esac
done
outfile=${outfile:-/dev/stdout}
guid=${guid:-`generate_uuid`}
asm_use_custom_step=false
uses_asm=${uses_asm:-false}
case "${vs_ver:-8}" in
    7) vs_ver_id="7.10"
       asm_use_custom_step=$uses_asm
    ;;
    8) vs_ver_id="8.00"
    ;;
esac

[ -n "$name" ] || die "Project name (--name) must be specified!"
[ -n "$target" ] || die "Target (--target) must be specified!"

if ${use_static_runtime:-false}; then
    release_runtime=0
    debug_runtime=1
    lib_sfx=mt
else
    release_runtime=2
    debug_runtime=3
    lib_sfx=md
fi

# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
# debug exe, so this may need to be refactored later.
for lib in ${libs}; do
    if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
        lib=${lib%.lib}d.lib
    fi
    debug_libs="${debug_libs}${debug_libs:+ }${lib}"
done


# List Keyword for this target
case "$target" in
    x86*)
        keyword="ManagedCProj"
    ;;
    arm*|iwmmx*)
        keyword="Win32Proj"
    ;;
    *) die "Unsupported target $target!"
esac

# List of all platforms supported for this target
case "$target" in
    x86_64*)
        platforms[0]="x64"
    ;;
    x86*)
        platforms[0]="Win32"
        # these are only used by vs7
        asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} \$(InputPath)"
        asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} \$(InputPath)"
    ;;
    arm*|iwmmx*)
        case "${name}" in
        obj_int_extract) platforms[0]="Win32"
        ;;
        *) platforms[0]="Pocket PC 2003 (ARMV4)"
        ;;
        esac
    ;;
    *) die "Unsupported target $target!"
esac

# List Command-line Arguments for this target
case "$target" in
    arm*|iwmmx*)
        if [ "$name" == "example" ];then
            ARGU="--codec vp6 --flipuv --progress _bnd.vp6"
        fi
        if [ "$name" == "xma" ];then
            ARGU="--codec vp6 -h 240 -w 320 -v"
        fi
    ;;
esac

generate_vcproj() {
    case "$proj_kind" in
    exe) vs_ConfigurationType=1
    ;;
    *)   vs_ConfigurationType=4
    ;;
    esac

    echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
    open_tag  VisualStudioProject \
                  ProjectType="Visual C++" \
                  Version="${vs_ver_id}" \
                  Name="${name}" \
                  ProjectGUID="{${guid}}" \
                  RootNamespace="${name}" \
                  Keyword="${keyword}"

    open_tag  Platforms
    for plat in "${platforms[@]}"; do
        tag   Platform Name="$plat"
    done
    close_tag Platforms

    open_tag  ToolFiles
    case "$target" in
        x86*) $uses_asm && tag DefaultToolFile FileName="yasm.rules"
        ;;
        arm*|iwmmx*)
            if [ "$name" == "vpx_decoder" ];then
            case "$target" in
                armv5*)
                    tag DefaultToolFile FileName="armasmv5.rules"
                ;;
                armv6*)
                    tag DefaultToolFile FileName="armasmv6.rules"
                ;;
                iwmmxt*)
                    tag DefaultToolFile FileName="armasmxscale.rules"
                ;;
            esac
            fi
        ;;
    esac
    close_tag ToolFiles

    open_tag  Configurations
    for plat in "${platforms[@]}"; do
        plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
        open_tag  Configuration \
                      Name="Debug|$plat" \
                      OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
                      IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
                      ConfigurationType="$vs_ConfigurationType" \
                      CharacterSet="1"

        if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
            case "$name" in
                vpx_decoder) tag Tool \
                             Name="VCPreBuildEventTool" \
                             CommandLine="call obj_int_extract.bat \$(ConfigurationName)"
                             tag Tool \
                             Name="VCMIDLTool" \
                             TargetEnvironment="1"
                             tag Tool \
                             Name="VCCLCompilerTool" \
                             ExecutionBucket="7" \
                             Optimization="0" \
                             AdditionalIncludeDirectories="$incs" \
                             PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
                             MinimalRebuild="true" \
                             RuntimeLibrary="1" \
                             BufferSecurityCheck="false" \
                             UsePrecompiledHeader="0" \
                             WarningLevel="3" \
                             DebugInformationFormat="1" \
                             CompileAs="1"
                             tag Tool \
                             Name="VCResourceCompilerTool" \
                             PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
                             Culture="1033" \
                             AdditionalIncludeDirectories="\$(IntDir)" \
                ;;
                example|xma) tag Tool \
                             Name="VCCLCompilerTool" \
                             ExecutionBucket="7" \
                             Optimization="0" \
                             AdditionalIncludeDirectories="$incs" \
                             PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
                             MinimalRebuild="true" \
                             RuntimeLibrary="1" \
                             BufferSecurityCheck="false" \
                             UsePrecompiledHeader="0" \
                             WarningLevel="3" \
                             DebugInformationFormat="1" \
                             CompileAs="1"
                             tag Tool \
                             Name="VCResourceCompilerTool" \
                             PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
                             Culture="1033" \
                             AdditionalIncludeDirectories="\$(IntDir)" \
                ;;
                obj_int_extract) tag Tool \
                             Name="VCCLCompilerTool" \
                             Optimization="0" \
                             AdditionalIncludeDirectories="$incs" \
                             PreprocessorDefinitions="WIN32;DEBUG;_CONSOLE" \
                             RuntimeLibrary="1" \
                             WarningLevel="3" \
                             DebugInformationFormat="1" \
                ;;
            esac
        fi

        case "$target" in
            x86*) tag Tool \
                Name="VCCLCompilerTool" \
                Optimization="0" \
                AdditionalIncludeDirectories="$incs" \
                PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;$defines" \
                RuntimeLibrary="$debug_runtime" \
                UsePrecompiledHeader="0" \
                WarningLevel="3" \
                DebugInformationFormat="1" \
                Detect64BitPortabilityProblems="true" \

                $uses_asm && tag Tool Name="YASM"  IncludePaths="$incs" Debug="1"
            ;;
        esac

        case "$proj_kind" in
            exe)
                case "$target" in
                    x86*) tag Tool \
                          Name="VCLinkerTool" \
                          AdditionalDependencies="$debug_libs \$(NoInherit)" \
                          AdditionalLibraryDirectories="$libdirs" \
                          GenerateDebugInformation="true" \
                          ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \

                    ;;
                    arm*|iwmmx*)
                        case "$name" in
                            obj_int_extract) tag Tool \
                                Name="VCLinkerTool" \
                                OutputFile="${name}.exe" \
                                GenerateDebugInformation="true"
                            ;;
                            *) tag Tool \
                                Name="VCLinkerTool" \
                                AdditionalDependencies="$debug_libs" \
                                OutputFile="\$(OutDir)/${name}.exe" \
                                LinkIncremental="2" \
                                AdditionalLibraryDirectories="${libdirs};&quot;..\lib/$plat_no_ws&quot;" \
                                DelayLoadDLLs="\$(NOINHERIT)" \
                                GenerateDebugInformation="true" \
                                ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
                                SubSystem="9" \
                                StackReserveSize="65536" \
                                StackCommitSize="4096" \
                                EntryPointSymbol="mainWCRTStartup" \
                                TargetMachine="3"
                            ;;
                        esac
                     ;;
                 esac
            ;;
            lib)
                case "$target" in
                      arm*|iwmmx*) tag Tool \
                                    Name="VCLibrarianTool" \
                                    AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" \
                                    OutputFile="\$(OutDir)/${name}.lib" \
                                ;;
                                *) tag Tool \
                                    Name="VCLibrarianTool" \
                                    OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
                                ;;
                esac
            ;;
            dll) tag Tool \
                 Name="VCLinkerTool" \
                AdditionalDependencies="\$(NoInherit)" \
                LinkIncremental="2" \
                GenerateDebugInformation="true" \
                AssemblyDebug="1" \
                TargetMachine="1" \
                      $link_opts
        esac

        if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
            case "$name" in
                vpx_decoder) tag DeploymentTool \
                             ForceDirty="-1" \
                             RegisterOutput="0"
                                ;;
                example|xma) tag DeploymentTool \
                             ForceDirty="-1" \
                             RegisterOutput="0"
                             tag DebuggerTool \
                             Arguments="${ARGU}"
                                ;;
            esac
        fi
        close_tag Configuration

        open_tag  Configuration \
                      Name="Release|$plat" \
                      OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
                      IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
                      ConfigurationType="$vs_ConfigurationType" \
                      CharacterSet="1" \
                      WholeProgramOptimization="0"

        if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
            case "$name" in
                vpx_decoder) tag Tool \
                                     Name="VCPreBuildEventTool" \
                                     CommandLine="call obj_int_extract.bat \$(ConfigurationName)"
                             tag Tool \
                                     Name="VCMIDLTool" \
                                     TargetEnvironment="1"
                             tag Tool \
                                             Name="VCCLCompilerTool" \
                                             ExecutionBucket="7" \
                                             Optimization="2" \
                                             FavorSizeOrSpeed="1" \
                                             AdditionalIncludeDirectories="$incs" \
                                             PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
                                             RuntimeLibrary="0" \
                                             BufferSecurityCheck="false" \
                                             UsePrecompiledHeader="0" \
                                             WarningLevel="3" \
                                             DebugInformationFormat="0" \
                                             CompileAs="1"
                             tag Tool \
                                             Name="VCResourceCompilerTool" \
                                             PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
                                             Culture="1033" \
                                             AdditionalIncludeDirectories="\$(IntDir)" \
                ;;
                example|xma) tag Tool \
                             Name="VCCLCompilerTool" \
                             ExecutionBucket="7" \
                             Optimization="2" \
                             FavorSizeOrSpeed="1" \
                             AdditionalIncludeDirectories="$incs" \
                             PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
                             RuntimeLibrary="0" \
                             BufferSecurityCheck="false" \
                             UsePrecompiledHeader="0" \
                             WarningLevel="3" \
                             DebugInformationFormat="0" \
                             CompileAs="1"
                             tag Tool \
                             Name="VCResourceCompilerTool" \
                             PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES)" \
                             Culture="1033" \
                             AdditionalIncludeDirectories="\$(IntDir)" \
                ;;
                obj_int_extract) tag Tool \
                             Name="VCCLCompilerTool" \
                             AdditionalIncludeDirectories="$incs" \
                             PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" \
                             RuntimeLibrary="0" \
                             UsePrecompiledHeader="0" \
                             WarningLevel="3" \
                             Detect64BitPortabilityProblems="true" \
                             DebugInformationFormat="0" \
                ;;
            esac
        fi

    case "$target" in
        x86*) tag       Tool \
                      Name="VCCLCompilerTool" \
                      AdditionalIncludeDirectories="$incs" \
                      PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;$defines" \
                      RuntimeLibrary="$release_runtime" \
                      UsePrecompiledHeader="0" \
                      WarningLevel="3" \
                      DebugInformationFormat="0" \
                      Detect64BitPortabilityProblems="true"

                $uses_asm && tag Tool Name="YASM"  IncludePaths="$incs"
                ;;
                esac

        case "$proj_kind" in
            exe)
                case "$target" in
                    x86*) tag Tool \
                                  Name="VCLinkerTool" \
                                  AdditionalDependencies="$libs \$(NoInherit)" \
                                  AdditionalLibraryDirectories="$libdirs" \
                    ;;
                    arm*|iwmmx*)
                        case "$name" in
                            obj_int_extract) tag Tool \
                                Name="VCLinkerTool" \
                                OutputFile="${name}.exe" \
                                LinkIncremental="1" \
                                GenerateDebugInformation="false" \
                                SubSystem="0" \
                                OptimizeReferences="0" \
                                EnableCOMDATFolding="0" \
                                TargetMachine="0"
                            ;;
                            *) tag Tool \
                                Name="VCLinkerTool" \
                                AdditionalDependencies="$libs" \
                                OutputFile="\$(OutDir)/${name}.exe" \
                                LinkIncremental="1" \
                                AdditionalLibraryDirectories="${libdirs};&quot;..\lib/$plat_no_ws&quot;" \
                                DelayLoadDLLs="\$(NOINHERIT)" \
                                GenerateDebugInformation="true" \
                                ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
                                SubSystem="9" \
                                StackReserveSize="65536" \
                                StackCommitSize="4096" \
                                OptimizeReferences="2" \
                                EnableCOMDATFolding="2" \
                                EntryPointSymbol="mainWCRTStartup" \
                                TargetMachine="3"
                            ;;
                        esac
                     ;;
                 esac
            ;;
        lib)
                case "$target" in
                      arm*|iwmmx*) tag Tool \
                                    Name="VCLibrarianTool" \
                                    AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" \
                                    OutputFile="\$(OutDir)/${name}.lib" \
                                ;;
                                *) tag Tool \
                                    Name="VCLibrarianTool" \
                                    OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
                                ;;
                esac
        ;;
        dll) # note differences to debug version: LinkIncremental, AssemblyDebug
             tag Tool \
                      Name="VCLinkerTool" \
                      AdditionalDependencies="\$(NoInherit)" \
                      LinkIncremental="1" \
                      GenerateDebugInformation="true" \
                      TargetMachine="1" \
                      $link_opts
        esac

        if [ "$target" == "armv6-wince-vs8" ] || [ "$target" == "armv5te-wince-vs8" ] || [ "$target" == "iwmmxt-wince-vs8" ] || [ "$target" == "iwmmxt2-wince-vs8" ];then
            case "$name" in
                vpx_decoder) tag DeploymentTool \
                             ForceDirty="-1" \
                             RegisterOutput="0"
                ;;
                example|xma) tag DeploymentTool \
                             ForceDirty="-1" \
                             RegisterOutput="0"
                             tag DebuggerTool \
                             Arguments="${ARGU}"
                                ;;
            esac
        fi

        close_tag Configuration
    done
    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 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

    tag       Globals
    close_tag VisualStudioProject

    # This must be done from within the {} subshell
    echo "Ignored files list (${#file_list[@]} items) is:" >&2
    for f in "${file_list[@]}"; do
        echo "    $f" >&2
    done
}

generate_vcproj |
    sed  -e '/"/s;\([^ "]\)/;\1\\;g' > ${outfile}

exit
<!--
TODO: Add any files not captured by filters.
                <File
                        RelativePath=".\ReadMe.txt"
                        >
                </File>
-->