## be found in the AUTHORS file in the root of the source tree.
##
-
self=$0
self_basename=${self##*/}
self_dirname=$(dirname "$0")
-EOL=$'\n'
+
+. "$self_dirname/msvs_common.sh"|| exit 127
show_help() {
cat <<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
if [ "${f##*.}" == "$pat" ]; then
unset file_list[i]
- objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g')
- open_tag File RelativePath="./$f"
+ objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,[:/],_,g')
+ open_tag File RelativePath="$f"
if [ "$pat" == "asm" ] && $asm_use_custom_step; then
for plat in "${platforms[@]}"; do
done
done
fi
- if [ "$pat" == "c" ] || [ "$pat" == "cc" ] ; then
+ if [ "$pat" == "c" ] || \
+ [ "$pat" == "cc" ] || [ "$pat" == "cpp" ]; then
for plat in "${platforms[@]}"; do
for cfg in Debug Release; do
open_tag FileConfiguration \
;;
--lib) proj_kind="lib"
;;
- --src-path-bare=*) src_path_bare="$optval"
+ --src-path-bare=*) src_path_bare=$(fix_path "$optval")
;;
--static-crt) use_static_runtime=true
;;
;;
-I*)
opt="${opt%/}"
- incs="${incs}${incs:+;}"${opt##-I}""
- yasmincs="${yasmincs} ${opt}"
+ opt=${opt##-I}
+ opt=$(fix_path "$opt")
+ incs="${incs}${incs:+;}"${opt}""
+ yasmincs="${yasmincs} -I${opt}"
;;
-D*) defines="${defines}${defines:+;}${opt##-D}"
;;
libdirs="${libdirs}${libdirs:+;}"\$(OutDir)""
else
# Also try directories for this platform/configuration
- libdirs="${libdirs}${libdirs:+;}"${opt##-L}""
- libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)/\$(ConfigurationName)""
- libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)""
+ opt=${opt##-L}
+ opt=$(fix_path "$opt")
+ libdirs="${libdirs}${libdirs:+;}"${opt}""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)/\$(ConfigurationName)""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)""
fi
;;
-l*) libs="${libs}${libs:+ }${opt##-l}.lib"
-*) die_unknown $opt
;;
*)
- file_list[${#file_list[@]}]="$opt"
+ file_list[${#file_list[@]}]="$(fix_path $opt)"
case "$opt" in
*.asm) uses_asm=true
;;
close_tag Configurations
open_tag Files
- generate_filter srcs "Source Files" "c;cc;def;odl;idl;hpj;bat;asm;asmx"
+ generate_filter srcs "Source Files" "c;cc;cpp;def;odl;idl;hpj;bat;asm;asmx"
generate_filter hdrs "Header Files" "h;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"