3 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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
7 ## tree. An additional intellectual property rights grant can be found
8 ## in the file PATENTS. All contributing project authors may
9 ## be found in the AUTHORS file in the root of the source tree.
14 self_basename
=${self##*/}
20 Usage: ${self_basename} [options] file1 [file2 ...]
22 This script generates a Visual Studio 2005 solution file from a list of project
26 --help Print this message
27 --out=outfile Redirect output to a file
28 --ver=version Version (7,8,9) of visual studio to generate for
29 --target=isa-os-cc Target specifier
35 echo "${self_basename}: $@" >&2
36 [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
41 echo "Unknown option
\"$1\".
" >&2
42 echo "See
${self_basename} --help for available options.
" >&2
43 [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
50 indent
="${indent}${indent1}"
53 indent
="${indent%${indent1}}"
58 local name
=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
59 local guid
=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
61 # save the project GUID to a varaible, normalizing to the basename of the
62 # vcproj file without the extension
66 eval "${var}_file=\"$1\""
67 eval "${var}_name=$name"
68 eval "${var}_guid=$guid"
70 # assume that all projects have the same list of possible configurations,
71 # so overwriting old config_lists is not a problem
72 config_list
=`grep -A1 '<Configuration' $file |
73 grep Name | cut -d\" -f2`
74 proj_list
="${proj_list} ${var}"
78 eval "local file=\${$1_file}"
79 eval "local name=\${$1_name}"
80 eval "local guid=\${$1_guid}"
82 # save the project GUID to a varaible, normalizing to the basename of the
83 # vcproj file without the extension
87 eval "${var}_guid=$guid"
89 echo "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"$name\", \"$file\", \"$guid\""
92 eval "local deps=\"\${${var}_deps}\""
93 if [ -n "$deps" ]; then
94 echo "${indent}ProjectSection(ProjectDependencies) = postProject"
98 eval "local dep_guid=\${${dep}_guid}"
99 [ -z "${dep_guid}" ] && die
"Unknown GUID for $dep (dependency of $var)"
100 echo "${indent}$dep_guid = $dep_guid"
104 echo "${indent}EndProjectSection"
117 # Solution Configuration Platforms
119 echo "${indent}GlobalSection(SolutionConfigurationPlatforms) = preSolution"
123 for config
in ${config_list}; do
124 echo "${indent}$config = $config"
128 echo "${indent}EndGlobalSection"
131 # Project Configuration Platforms
133 echo "${indent}GlobalSection(ProjectConfigurationPlatforms) = postSolution"
135 for proj
in ${proj_list}; do
136 eval "local proj_guid=\${${proj}_guid}"
138 for config
in ${config_list}; do
139 echo "${indent}${proj_guid}.${config}.ActiveCfg = ${config}"
140 echo "${indent}${proj_guid}.${config}.Build.0 = ${config}"
142 if [ "$target" == "armv6-wince-vs8" ] ||
[ "$target" == "armv5te-wince-vs8" ] ||
[ "$target" == "iwmmxt-wince-vs8" ] ||
[ "$target" == "iwmmxt2-wince-vs8" ];then
143 echo "${indent}${proj_guid}.${config}.Deploy.0 = ${config}"
149 echo "${indent}EndGlobalSection"
152 # Solution Properties
154 echo "${indent}GlobalSection(SolutionProperties) = preSolution"
156 echo "${indent}HideSolutionNode = FALSE"
158 echo "${indent}EndGlobalSection"
169 found_devenv := \$(shell which devenv.com >/dev/null 2>&1 && echo yes)
171 ${TAB}@echo " * devenv.com not found in path."
173 ${TAB}@echo " * You will have to build all configurations manually using the"
174 ${TAB}@echo " * Visual Studio IDE. To allow make to build them automatically,"
175 ${TAB}@echo " * add the Common7/IDE directory of your Visual Studio"
176 ${TAB}@echo " * installation to your path, eg:"
177 ${TAB}@echo " * C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
180 CLEAN-OBJS += \$(if \$(found_devenv),,.nodevenv.once)
184 for sln_config
in ${config_list}; do
185 local config
=${sln_config%%|*}
186 local platform
=${sln_config##*|}
187 local nows_sln_config
=`echo $sln_config | sed -e 's/[^a-zA-Z0-9]/_/g'`
189 BUILD_TARGETS += \$(if \$(NO_LAUNCH_DEVENV),,$nows_sln_config)
191 ${TAB}rm -rf "$platform"/"$config"
192 .PHONY: $nows_sln_config
193 ifneq (\$(found_devenv),)
194 ifeq (\$(CONFIG_VS_VERSION),7)
195 $nows_sln_config: $outfile
196 ${TAB}devenv.com $outfile -build "$config"
199 $nows_sln_config: $outfile
200 ${TAB}devenv.com $outfile -build "$sln_config"
204 $nows_sln_config: $outfile .nodevenv.once
205 ${TAB}@echo " * Skipping build of $sln_config (devenv.com not in path)."
214 # Process command line
221 --out=*) outfile
="${optval}"; mkoutfile
="${optval}".mk
223 --dep=*) eval "${optval%%:*}_deps=\"\${${optval%%:*}_deps} ${optval##*:}\""
225 --ver=*) vs_ver
="$optval"
229 *) die Unrecognized Visual Studio Version
in $opt
233 --ver=*) vs_ver
="$optval"
236 sln_vers_str
="Visual Studio .NET 2003"
240 *) die
"Unrecognized Visual Studio Version '$optval' in $opt"
244 --target=*) target
="${optval}"
248 *) file_list
[${#file_list[@]}]="$opt"
251 outfile
=${outfile:-/dev/stdout}
252 mkoutfile
=${mkoutfile:-/dev/stdout}
253 case "${vs_ver:-8}" in
255 sln_vers_str
="Visual Studio .NET 2003"
258 sln_vers_str
="Visual Studio 2005"
261 sln_vers_str
="Visual Studio 2008"
265 for f
in "${file_list[@]}"; do
268 cat >${outfile} <<EOF
269 Microsoft Visual Studio Solution File, Format Version $sln_vers${EOLDOS}
270 # $sln_vers_str${EOLDOS}
272 for proj
in ${proj_list}; do
273 process_project
$proj >>${outfile}
275 process_global
>>${outfile}
276 process_makefile
>${mkoutfile}