| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 ## | 2 ## |
| 3 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 3 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 4 ## | 4 ## |
| 5 ## Use of this source code is governed by a BSD-style license | 5 ## Use of this source code is governed by a BSD-style license |
| 6 ## that can be found in the LICENSE file in the root of the source | 6 ## that can be found in the LICENSE file in the root of the source |
| 7 ## tree. An additional intellectual property rights grant can be found | 7 ## tree. An additional intellectual property rights grant can be found |
| 8 ## in the file PATENTS. All contributing project authors may | 8 ## in the file PATENTS. All contributing project authors may |
| 9 ## be found in the AUTHORS file in the root of the source tree. | 9 ## be found in the AUTHORS file in the root of the source tree. |
| 10 ## | 10 ## |
| 11 | 11 |
| 12 | 12 |
| 13 self=$0 | 13 self=$0 |
| 14 self_basename=${self##*/} | 14 self_basename=${self##*/} |
| 15 self_dirname=$(dirname "$0") | 15 self_dirname=$(dirname "$0") |
| 16 EOL=$'\n' | 16 EOL=$'\n' |
| 17 | 17 |
| 18 show_help() { | 18 show_help() { |
| 19 cat <<EOF | 19 cat <<EOF |
| 20 Usage: ${self_basename} --name=projname [options] file1 [file2 ...] | 20 Usage: ${self_basename} --name=projname [options] file1 [file2 ...] |
| 21 | 21 |
| 22 This script generates a Visual Studio project file from a list of source | 22 This script generates a Visual Studio project file from a list of source |
| 23 code files. | 23 code files. |
| 24 | 24 |
| 25 Options: | 25 Options: |
| 26 --help Print this message | 26 --help Print this message |
| 27 --exe Generate a project for building an Application | 27 --exe Generate a project for building an Application |
| 28 --lib Generate a project for creating a static library | 28 --lib Generate a project for creating a static library |
| 29 --dll Generate a project for creating a dll |
| 29 --static-crt Use the static C runtime (/MT) | 30 --static-crt Use the static C runtime (/MT) |
| 30 --target=isa-os-cc Target specifier (required) | 31 --target=isa-os-cc Target specifier (required) |
| 31 --out=filename Write output to a file [stdout] | 32 --out=filename Write output to a file [stdout] |
| 32 --name=project_name Name of the project (required) | 33 --name=project_name Name of the project (required) |
| 33 --proj-guid=GUID GUID to use for the project | 34 --proj-guid=GUID GUID to use for the project |
| 34 --module-def=filename File containing export definitions (for DLLs) | 35 --module-def=filename File containing export definitions (for DLLs) |
| 35 --ver=version Version (7,8,9) of visual studio to generate for | 36 --ver=version Version (7,8,9) of visual studio to generate for |
| 36 --src-path-bare=dir Path to root of source tree | 37 --src-path-bare=dir Path to root of source tree |
| 37 -Ipath/to/include Additional include directories | 38 -Ipath/to/include Additional include directories |
| 38 -DFLAG[=value] Preprocessor macros to define | 39 -DFLAG[=value] Preprocessor macros to define |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 Filter=$pats \ | 136 Filter=$pats \ |
| 136 UniqueIdentifier=`generate_uuid` \ | 137 UniqueIdentifier=`generate_uuid` \ |
| 137 | 138 |
| 138 file_list_sz=${#file_list[@]} | 139 file_list_sz=${#file_list[@]} |
| 139 for i in ${!file_list[@]}; do | 140 for i in ${!file_list[@]}; do |
| 140 f=${file_list[i]} | 141 f=${file_list[i]} |
| 141 for pat in ${pats//;/$IFS}; do | 142 for pat in ${pats//;/$IFS}; do |
| 142 if [ "${f##*.}" == "$pat" ]; then | 143 if [ "${f##*.}" == "$pat" ]; then |
| 143 unset file_list[i] | 144 unset file_list[i] |
| 144 | 145 |
| 146 objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g') |
| 145 open_tag File RelativePath="./$f" | 147 open_tag File RelativePath="./$f" |
| 148 |
| 146 if [ "$pat" == "asm" ] && $asm_use_custom_step; then | 149 if [ "$pat" == "asm" ] && $asm_use_custom_step; then |
| 147 for plat in "${platforms[@]}"; do | 150 for plat in "${platforms[@]}"; do |
| 148 for cfg in Debug Release; do | 151 for cfg in Debug Release; do |
| 149 open_tag FileConfiguration \ | 152 open_tag FileConfiguration \ |
| 150 Name="${cfg}|${plat}" \ | 153 Name="${cfg}|${plat}" \ |
| 151 | 154 |
| 152 tag Tool \ | 155 tag Tool \ |
| 153 Name="VCCustomBuildTool" \ | 156 Name="VCCustomBuildTool" \ |
| 154 Description="Assembling \$(InputFileName)" \ | 157 Description="Assembling \$(InputFileName)" \ |
| 155 CommandLine="$(eval echo \$asm_${cfg}_cmdline)"
\ | 158 CommandLine="$(eval echo \$asm_${cfg}_cmdline) -
o \$(IntDir)$objf" \ |
| 156 Outputs="\$(InputName).obj" \ | 159 Outputs="\$(IntDir)$objf" \ |
| 157 | 160 |
| 158 close_tag FileConfiguration | 161 close_tag FileConfiguration |
| 159 done | 162 done |
| 160 done | 163 done |
| 161 fi | 164 fi |
| 165 if [ "$pat" == "c" ] || [ "$pat" == "cc" ] ; then |
| 166 for plat in "${platforms[@]}"; do |
| 167 for cfg in Debug Release; do |
| 168 open_tag FileConfiguration \ |
| 169 Name="${cfg}|${plat}" \ |
| 162 | 170 |
| 171 tag Tool \ |
| 172 Name="VCCLCompilerTool" \ |
| 173 ObjectFile="\$(IntDir)$objf" \ |
| 174 |
| 175 close_tag FileConfiguration |
| 176 done |
| 177 done |
| 178 fi |
| 163 close_tag File | 179 close_tag File |
| 164 | 180 |
| 165 break | 181 break |
| 166 fi | 182 fi |
| 167 done | 183 done |
| 168 done | 184 done |
| 169 | 185 |
| 170 close_tag Filter | 186 close_tag Filter |
| 171 IFS="$saveIFS" | 187 IFS="$saveIFS" |
| 172 } | 188 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 183 --out=*) outfile="$optval" | 199 --out=*) outfile="$optval" |
| 184 ;; | 200 ;; |
| 185 --name=*) name="${optval}" | 201 --name=*) name="${optval}" |
| 186 ;; | 202 ;; |
| 187 --proj-guid=*) guid="${optval}" | 203 --proj-guid=*) guid="${optval}" |
| 188 ;; | 204 ;; |
| 189 --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}" | 205 --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}" |
| 190 ;; | 206 ;; |
| 191 --exe) proj_kind="exe" | 207 --exe) proj_kind="exe" |
| 192 ;; | 208 ;; |
| 209 --dll) proj_kind="dll" |
| 210 ;; |
| 193 --lib) proj_kind="lib" | 211 --lib) proj_kind="lib" |
| 194 ;; | 212 ;; |
| 195 --src-path-bare=*) src_path_bare="$optval" | 213 --src-path-bare=*) src_path_bare="$optval" |
| 196 ;; | 214 ;; |
| 197 --static-crt) use_static_runtime=true | 215 --static-crt) use_static_runtime=true |
| 198 ;; | 216 ;; |
| 199 --ver=*) | 217 --ver=*) |
| 200 vs_ver="$optval" | 218 vs_ver="$optval" |
| 201 case "$optval" in | 219 case "$optval" in |
| 202 [789]) | 220 [789]) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 done | 255 done |
| 238 outfile=${outfile:-/dev/stdout} | 256 outfile=${outfile:-/dev/stdout} |
| 239 guid=${guid:-`generate_uuid`} | 257 guid=${guid:-`generate_uuid`} |
| 240 asm_use_custom_step=false | 258 asm_use_custom_step=false |
| 241 uses_asm=${uses_asm:-false} | 259 uses_asm=${uses_asm:-false} |
| 242 case "${vs_ver:-8}" in | 260 case "${vs_ver:-8}" in |
| 243 7) vs_ver_id="7.10" | 261 7) vs_ver_id="7.10" |
| 244 asm_use_custom_step=$uses_asm | 262 asm_use_custom_step=$uses_asm |
| 245 ;; | 263 ;; |
| 246 8) vs_ver_id="8.00" | 264 8) vs_ver_id="8.00" |
| 265 asm_use_custom_step=$uses_asm |
| 247 ;; | 266 ;; |
| 248 9) vs_ver_id="9.00" | 267 9) vs_ver_id="9.00" |
| 268 asm_use_custom_step=$uses_asm |
| 249 ;; | 269 ;; |
| 250 esac | 270 esac |
| 251 | 271 |
| 252 [ -n "$name" ] || die "Project name (--name) must be specified!" | 272 [ -n "$name" ] || die "Project name (--name) must be specified!" |
| 253 [ -n "$target" ] || die "Target (--target) must be specified!" | 273 [ -n "$target" ] || die "Target (--target) must be specified!" |
| 254 | 274 |
| 255 if ${use_static_runtime:-false}; then | 275 if ${use_static_runtime:-false}; then |
| 256 release_runtime=0 | 276 release_runtime=0 |
| 257 debug_runtime=1 | 277 debug_runtime=1 |
| 258 lib_sfx=mt | 278 lib_sfx=mt |
| (...skipping 18 matching lines...) Expand all Loading... |
| 277 case "$target" in | 297 case "$target" in |
| 278 x86*) keyword="ManagedCProj" | 298 x86*) keyword="ManagedCProj" |
| 279 ;; | 299 ;; |
| 280 *) die "Unsupported target $target!" | 300 *) die "Unsupported target $target!" |
| 281 esac | 301 esac |
| 282 | 302 |
| 283 # List of all platforms supported for this target | 303 # List of all platforms supported for this target |
| 284 case "$target" in | 304 case "$target" in |
| 285 x86_64*) | 305 x86_64*) |
| 286 platforms[0]="x64" | 306 platforms[0]="x64" |
| 307 asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quo
t;\$(InputPath)"" |
| 308 asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(
InputPath)"" |
| 287 ;; | 309 ;; |
| 288 x86*) | 310 x86*) |
| 289 platforms[0]="Win32" | 311 platforms[0]="Win32" |
| 290 # these are only used by vs7 | |
| 291 asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quo
t;\$(InputPath)"" | 312 asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quo
t;\$(InputPath)"" |
| 292 asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(
InputPath)"" | 313 asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(
InputPath)"" |
| 293 ;; | 314 ;; |
| 294 *) die "Unsupported target $target!" | 315 *) die "Unsupported target $target!" |
| 295 ;; | 316 ;; |
| 296 esac | 317 esac |
| 297 | 318 |
| 298 generate_vcproj() { | 319 generate_vcproj() { |
| 299 case "$proj_kind" in | 320 case "$proj_kind" in |
| 300 exe) vs_ConfigurationType=1 | 321 exe) vs_ConfigurationType=1 |
| 301 ;; | 322 ;; |
| 323 dll) vs_ConfigurationType=2 |
| 324 ;; |
| 302 *) vs_ConfigurationType=4 | 325 *) vs_ConfigurationType=4 |
| 303 ;; | 326 ;; |
| 304 esac | 327 esac |
| 305 | 328 |
| 306 echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>" | 329 echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>" |
| 307 open_tag VisualStudioProject \ | 330 open_tag VisualStudioProject \ |
| 308 ProjectType="Visual C++" \ | 331 ProjectType="Visual C++" \ |
| 309 Version="${vs_ver_id}" \ | 332 Version="${vs_ver_id}" \ |
| 310 Name="${name}" \ | 333 Name="${name}" \ |
| 311 ProjectGUID="{${guid}}" \ | 334 ProjectGUID="{${guid}}" \ |
| 312 RootNamespace="${name}" \ | 335 RootNamespace="${name}" \ |
| 313 Keyword="${keyword}" \ | 336 Keyword="${keyword}" \ |
| 314 | 337 |
| 315 open_tag Platforms | 338 open_tag Platforms |
| 316 for plat in "${platforms[@]}"; do | 339 for plat in "${platforms[@]}"; do |
| 317 tag Platform Name="$plat" | 340 tag Platform Name="$plat" |
| 318 done | 341 done |
| 319 close_tag Platforms | 342 close_tag Platforms |
| 320 | 343 |
| 321 open_tag ToolFiles | |
| 322 case "$target" in | |
| 323 x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/
yasm.rules" | |
| 324 ;; | |
| 325 esac | |
| 326 close_tag ToolFiles | |
| 327 | |
| 328 open_tag Configurations | 344 open_tag Configurations |
| 329 for plat in "${platforms[@]}"; do | 345 for plat in "${platforms[@]}"; do |
| 330 plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'` | 346 plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'` |
| 331 open_tag Configuration \ | 347 open_tag Configuration \ |
| 332 Name="Debug|$plat" \ | 348 Name="Debug|$plat" \ |
| 333 OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ | 349 OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \ |
| 334 IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ | 350 IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \ |
| 335 ConfigurationType="$vs_ConfigurationType" \ | 351 ConfigurationType="$vs_ConfigurationType" \ |
| 336 CharacterSet="1" \ | 352 CharacterSet="1" \ |
| 337 | 353 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 sed -e '/"/s;\([^ "]\)/;\1\\;g' > ${outfile} | 580 sed -e '/"/s;\([^ "]\)/;\1\\;g' > ${outfile} |
| 565 | 581 |
| 566 exit | 582 exit |
| 567 <!-- | 583 <!-- |
| 568 TODO: Add any files not captured by filters. | 584 TODO: Add any files not captured by filters. |
| 569 <File | 585 <File |
| 570 RelativePath=".\ReadMe.txt" | 586 RelativePath=".\ReadMe.txt" |
| 571 > | 587 > |
| 572 </File> | 588 </File> |
| 573 --> | 589 --> |
| OLD | NEW |