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}"
146 echo "${indent}EndGlobalSection"
149 # Solution Properties
151 echo "${indent}GlobalSection(SolutionProperties) = preSolution"
153 echo "${indent}HideSolutionNode = FALSE"
155 echo "${indent}EndGlobalSection"
166 found_devenv := \$(shell which devenv.com >/dev/null 2>&1 && echo yes)
168 ${TAB}@echo " * devenv.com not found in path."
170 ${TAB}@echo " * You will have to build all configurations manually using the"
171 ${TAB}@echo " * Visual Studio IDE. To allow make to build them automatically,"
172 ${TAB}@echo " * add the Common7/IDE directory of your Visual Studio"
173 ${TAB}@echo " * installation to your path, eg:"
174 ${TAB}@echo " * C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
177 CLEAN-OBJS += \$(if \$(found_devenv),,.nodevenv.once)
181 for sln_config
in ${config_list}; do
182 local config
=${sln_config%%|*}
183 local platform
=${sln_config##*|}
184 local nows_sln_config
=`echo $sln_config | sed -e 's/[^a-zA-Z0-9]/_/g'`
186 BUILD_TARGETS += \$(if \$(NO_LAUNCH_DEVENV),,$nows_sln_config)
188 ${TAB}rm -rf "$platform"/"$config"
189 .PHONY: $nows_sln_config
190 ifneq (\$(found_devenv),)
191 ifeq (\$(CONFIG_VS_VERSION),7)
192 $nows_sln_config: $outfile
193 ${TAB}devenv.com $outfile -build "$config"
196 $nows_sln_config: $outfile
197 ${TAB}devenv.com $outfile -build "$sln_config"
201 $nows_sln_config: $outfile .nodevenv.once
202 ${TAB}@echo " * Skipping build of $sln_config (devenv.com not in path)."
211 # Process command line
218 --out=*) outfile
="${optval}"; mkoutfile
="${optval}".mk
220 --dep=*) eval "${optval%%:*}_deps=\"\${${optval%%:*}_deps} ${optval##*:}\""
222 --ver=*) vs_ver
="$optval"
226 *) die Unrecognized Visual Studio Version
in $opt
230 --ver=*) vs_ver
="$optval"
233 sln_vers_str
="Visual Studio .NET 2003"
237 *) die
"Unrecognized Visual Studio Version '$optval' in $opt"
241 --target=*) target
="${optval}"
245 *) file_list
[${#file_list[@]}]="$opt"
248 outfile
=${outfile:-/dev/stdout}
249 mkoutfile
=${mkoutfile:-/dev/stdout}
250 case "${vs_ver:-8}" in
252 sln_vers_str
="Visual Studio .NET 2003"
255 sln_vers_str
="Visual Studio 2005"
258 sln_vers_str
="Visual Studio 2008"
262 for f
in "${file_list[@]}"; do
265 cat >${outfile} <<EOF
266 Microsoft Visual Studio Solution File, Format Version $sln_vers${EOLDOS}
267 # $sln_vers_str${EOLDOS}
269 for proj
in ${proj_list}; do
270 process_project
$proj >>${outfile}
272 process_global
>>${outfile}
273 process_makefile
>${mkoutfile}