From 56666f07263d9a5e278f78fd4008c7e1bc8896a8 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 17 May 2013 00:53:05 +0300 Subject: [PATCH 1/6] Add a new script for producing vcxproj files Change-Id: If02a7b85f417b9693dcdab73573fc13f67e17016 --- build/make/gen_msvs_vcxproj.sh | 506 +++++++++++++++++++++++++++++++++ 1 file changed, 506 insertions(+) create mode 100755 build/make/gen_msvs_vcxproj.sh diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh new file mode 100755 index 000000000..e7f8f8503 --- /dev/null +++ b/build/make/gen_msvs_vcxproj.sh @@ -0,0 +1,506 @@ +#!/bin/bash +## +## Copyright (c) 2013 The WebM project authors. All Rights Reserved. +## +## Use of this source code is governed by a BSD-style license +## that can be found in the LICENSE file in the root of the source +## tree. An additional intellectual property rights grant can be found +## in the file PATENTS. All contributing project authors may +## be found in the AUTHORS file in the root of the source tree. +## + + +self=$0 +self_basename=${self##*/} +self_dirname=$(dirname "$0") +EOL=$'\n' + +show_help() { + cat <&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() { + local tag=$1 + shift + if [ $# -ne 0 ]; then + echo "${indent}<${tag}" + indent_push + tag_attributes "$@" + indent_pop + echo "${indent}/>" + else + echo "${indent}<${tag}/>" + fi +} + +tag_content() { + local tag=$1 + local content=$2 + shift + shift + if [ $# -ne 0 ]; then + echo "${indent}<${tag}" + indent_push + tag_attributes "$@" + echo "${indent}>${content}" + indent_pop + else + echo "${indent}<${tag}>${content}" + fi +} + +generate_filter() { + local name=$1 + local pats=$2 + local file_list_sz + local i + local f + local saveIFS="$IFS" + local pack + echo "generating filter '$name' from ${#file_list[@]} files" >&2 + IFS=* + + 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] + + objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g') + + if [ "$pat" == "asm" ] && $asm_use_custom_step; then + open_tag CustomBuild \ + Include=".\\$f" + for plat in "${platforms[@]}"; do + for cfg in Debug Release; do + tag_content Message "Assembling %(Filename)%(Extension)" \ + Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'" + tag_content Command "$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)$objf" \ + Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'" + tag_content Outputs "\$(IntDir)$objf" \ + Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'" + done + done + close_tag CustomBuild + elif [ "$pat" == "c" ] || [ "$pat" == "cc" ] ; then + open_tag ClCompile \ + Include=".\\$f" + # Separate file names with Condition? + tag_content ObjectFileName "\$(IntDir)$objf" + close_tag ClCompile + elif [ "$pat" == "h" ] ; then + tag ClInclude \ + Include=".\\$f" + elif [ "$pat" == "vcxproj" ] ; then + open_tag ProjectReference \ + Include="$f" + depguid=`grep ProjectGuid "$f" | sed 's,.*<.*>\(.*\).*,\1,'` + tag_content Project "$depguid" + tag_content ReferenceOutputAssembly false + close_tag ProjectReference + else + tag None \ + Include=".\\$f" + fi + + break + fi + done + done + + 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=*) module_def="${optval}" + ;; + --exe) proj_kind="exe" + ;; + --dll) proj_kind="dll" + ;; + --lib) proj_kind="lib" + ;; + --src-path-bare=*) src_path_bare="$optval" + ;; + --static-crt) use_static_runtime=true + ;; + --ver=*) + vs_ver="$optval" + case "$optval" in + 10|11) + ;; + *) die Unrecognized Visual Studio Version in $opt + ;; + esac + ;; + -I*) + opt="${opt%/}" + incs="${incs}${incs:+;}${opt##-I}" + yasmincs="${yasmincs} ${opt}" + ;; + -D*) defines="${defines}${defines:+;}${opt##-D}" + ;; + -L*) # fudge . to $(OutDir) + if [ "${opt##-L}" == "." ]; then + libdirs="${libdirs}${libdirs:+;}\$(OutDir)" + else + # Also try directories for this platform/configuration + libdirs="${libdirs}${libdirs:+;}${opt##-L}" + libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)/\$(Configuration)" + libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)" + 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:-11}" in + 10|11) + asm_use_custom_step=$uses_asm + ;; +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=MultiThreaded + debug_runtime=MultiThreadedDebug + lib_sfx=mt +else + release_runtime=MultiThreadedDLL + debug_runtime=MultiThreadedDebugDLL + 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 +debug_libs=${debug_libs// /;} +libs=${libs// /;} + + +# List of all platforms supported for this target +case "$target" in + x86_64*) + platforms[0]="x64" + asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} "%(FullPath)"" + asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "%(FullPath)"" + ;; + x86*) + platforms[0]="Win32" + asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} "%(FullPath)"" + asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "%(FullPath)"" + ;; + *) die "Unsupported target $target!" + ;; +esac + +generate_vcxproj() { + echo "" + open_tag Project \ + DefaultTargets="Build" \ + ToolsVersion="4.0" \ + xmlns="http://schemas.microsoft.com/developer/msbuild/2003" \ + + open_tag ItemGroup \ + Label="ProjectConfigurations" + for plat in "${platforms[@]}"; do + for config in Debug Release; do + open_tag ProjectConfiguration \ + Include="$config|$plat" + tag_content Configuration $config + tag_content Platform $plat + close_tag ProjectConfiguration + done + done + close_tag ItemGroup + + open_tag PropertyGroup \ + Label="Globals" + tag_content ProjectGuid "{${guid}}" + tag_content RootNamespace ${name} + tag_content Keyword ManagedCProj + close_tag PropertyGroup + + tag Import \ + Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" + + for plat in "${platforms[@]}"; do + for config in Release Debug; do + open_tag PropertyGroup \ + Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'" \ + Label="Configuration" + if [ "$proj_kind" = "exe" ]; then + tag_content ConfigurationType Application + elif [ "$proj_kind" = "dll" ]; then + tag_content ConfigurationType DynamicLibrary + else + tag_content ConfigurationType StaticLibrary + fi + tag_content PlatformToolset v110 # v110_wp80, omit for v10 + tag_content CharacterSet Unicode + if [ "$config" = "Release" ]; then + tag_content WholeProgramOptimization true + fi + close_tag PropertyGroup + done + done + + tag Import \ + Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" + + open_tag ImportGroup \ + Label="PropertySheets" + tag Import \ + Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" \ + Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" \ + Label="LocalAppDataPlatform" + close_tag ImportGroup + + tag PropertyGroup \ + Label="UserMacros" + + for plat in "${platforms[@]}"; do + plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'` + for config in Debug Release; do + open_tag PropertyGroup \ + Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'" + tag_content OutDir "\$(SolutionDir)$plat_no_ws\\\$(Configuration)\\" + tag_content IntDir "$plat_no_ws\\\$(Configuration)\\${name}\\" + close_tag PropertyGroup + done + done + + for plat in "${platforms[@]}"; do + for config in Debug Release; do + open_tag ItemDefinitionGroup \ + Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'" + if [ "$name" = "vpx" ]; then + open_tag PreBuildEvent + tag_content Command "call obj_int_extract.bat $src_path_bare" + close_tag PreBuildEvent + fi + open_tag ClCompile + if [ "$config" = "Debug" ]; then + opt=Disabled + runtime=$debug_runtime + curlibs=$debug_libs + confsuffix=d + case "$name" in + obj_int_extract) + debug=DEBUG + ;; + *) + debug=_DEBUG + ;; + esac + else + opt=MaxSpeed + runtime=$release_runtime + curlibs=$libs + confsuffix="" + tag_content FavorSizeOrSpeed Speed + debug=NDEBUG + fi + case "$name" in + obj_int_extract) + extradefines=";_CONSOLE" + ;; + *) + extradefines=";$defines" + ;; + esac + tag_content Optimization $opt + tag_content AdditionalIncludeDirectories "$incs;%(AdditionalIncludeDirectories)" + tag_content PreprocessorDefinitions "WIN32;$debug;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE$extradefines;%(PreprocessorDefinitions)" + tag_content RuntimeLibrary $runtime + tag_content WarningLevel Level3 + # DebugInformationFormat + close_tag ClCompile + case "$proj_kind" in + exe) + open_tag Link + if [ "$name" = "obj_int_extract" ]; then + tag_content OutputFile "${name}.exe" + else + tag_content AdditionalDependencies "$curlibs" + tag_content AdditionalLibraryDirectories "$libdirs;%(AdditionalLibraryDirectories)" + fi + tag_content GenerateDebugInformation true + close_tag Link + ;; + dll) + open_tag Link + tag_content GenerateDebugInformation true + tag_content ModuleDefinitionFile $module_def + close_tag Link + ;; + lib) + open_tag Lib + tag_content OutputFile "\$(OutDir)${name}${lib_sfx}${confsuffix}.lib" + close_tag Lib + ;; + esac + close_tag ItemDefinitionGroup + done + + done + + open_tag ItemGroup + generate_filter "Source Files" "c;cc;def;odl;idl;hpj;bat;asm;asmx" + close_tag ItemGroup + open_tag ItemGroup + generate_filter "Header Files" "h;hm;inl;inc;xsd" + close_tag ItemGroup + open_tag ItemGroup + generate_filter "Build Files" "mk" + close_tag ItemGroup + open_tag ItemGroup + generate_filter "References" "vcxproj" + close_tag ItemGroup + + tag Import \ + Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" + + open_tag ImportGroup \ + Label="ExtensionTargets" + close_tag ImportGroup + + close_tag Project + + # 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 +} + +# This regexp doesn't catch most of the strings in the vcxproj format, +# since they're like path instead of +# as previously. It still seems to work ok despite this. +generate_vcxproj | + sed -e '/"/s;\([^ "]\)/;\1\\;g' | + sed -e '/xmlns/s;\\;/;g' > ${outfile} + +exit From cbc8089a1e313a54cdec460f223b798b8def03a9 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 17 May 2013 00:59:20 +0300 Subject: [PATCH 2/6] gen_msvs_sln: Support producing versions 10 and 11, handle vcxproj files Change-Id: I3c23a2ce383d9291a823d2be7364608ce0e01570 --- build/make/gen_msvs_sln.sh | 33 ++++++++++++++++++++++++++------- build/make/gen_msvs_vcxproj.sh | 4 +++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/build/make/gen_msvs_sln.sh b/build/make/gen_msvs_sln.sh index 240678b64..5a8c79368 100755 --- a/build/make/gen_msvs_sln.sh +++ b/build/make/gen_msvs_sln.sh @@ -25,7 +25,7 @@ files. Options: --help Print this message --out=outfile Redirect output to a file - --ver=version Version (7,8,9) of visual studio to generate for + --ver=version Version (7,8,9,10,11) of visual studio to generate for --target=isa-os-cc Target specifier EOF exit 1 @@ -55,14 +55,19 @@ indent_pop() { parse_project() { local file=$1 - local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'` - local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'` + if [ "$sfx" = "vcproj" ]; then + local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'` + local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'` + else + local name=`grep RootNamespace "$file" | sed 's,.*<.*>\(.*\).*,\1,'` + local guid=`grep ProjectGuid "$file" | sed 's,.*<.*>\(.*\).*,\1,'` + fi # save the project GUID to a varaible, normalizing to the basename of the # vcproj file without the extension local var var=${file##*/} - var=${var%%.vcproj} + var=${var%%.${sfx}} eval "${var}_file=\"$1\"" eval "${var}_name=$name" eval "${var}_guid=$guid" @@ -83,14 +88,14 @@ process_project() { # vcproj file without the extension local var var=${file##*/} - var=${var%%.vcproj} + var=${var%%.${sfx}} eval "${var}_guid=$guid" echo "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"$name\", \"$file\", \"$guid\"" indent_push eval "local deps=\"\${${var}_deps}\"" - if [ -n "$deps" ]; then + if [ -n "$deps" ] && [ "$sfx" = "vcproj" ]; then echo "${indent}ProjectSection(ProjectDependencies) = postProject" indent_push @@ -221,7 +226,7 @@ for opt in "$@"; do ;; --ver=*) vs_ver="$optval" case $optval in - [789]) + [789]|10|11) ;; *) die Unrecognized Visual Studio Version in $opt ;; @@ -257,6 +262,20 @@ case "${vs_ver:-8}" in 9) sln_vers="10.00" sln_vers_str="Visual Studio 2008" ;; + 10) sln_vers="11.00" + sln_vers_str="Visual Studio 2010" + ;; + 11) sln_vers="12.00" + sln_vers_str="Visual Studio 2012" + ;; +esac +case "${vs_ver:-8}" in + [789]) + sfx=vcproj + ;; + 10|11) + sfx=vcxproj + ;; esac for f in "${file_list[@]}"; do diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh index e7f8f8503..38ffa267c 100755 --- a/build/make/gen_msvs_vcxproj.sh +++ b/build/make/gen_msvs_vcxproj.sh @@ -358,7 +358,9 @@ generate_vcxproj() { else tag_content ConfigurationType StaticLibrary fi - tag_content PlatformToolset v110 # v110_wp80, omit for v10 + if [ "$vs_ver" = "11" ]; then + tag_content PlatformToolset v110 + fi tag_content CharacterSet Unicode if [ "$config" = "Release" ]; then tag_content WholeProgramOptimization true From bd91bebe480b304b01b0f6fe7d83df440aef7967 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 17 May 2013 00:57:57 +0300 Subject: [PATCH 3/6] configure: Add x86*-vs10/11 targets Change-Id: I4be8ca12ccdce86d1409b7121cff94b4784ab31c --- build/make/configure.sh | 2 ++ configure | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/build/make/configure.sh b/build/make/configure.sh index 7070ec076..5c38c8107 100755 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -416,6 +416,7 @@ SRC_PATH_BARE=$source_path BUILD_PFX=${BUILD_PFX} TOOLCHAIN=${toolchain} ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} +GEN_VCPROJ=${gen_vcproj_cmd} CC=${CC} CXX=${CXX} @@ -433,6 +434,7 @@ ASFLAGS = ${ASFLAGS} extralibs = ${extralibs} AS_SFX = ${AS_SFX:-.asm} EXE_SFX = ${EXE_SFX} +VCPROJ_SFX = ${VCPROJ_SFX} RTCD_OPTIONS = ${RTCD_OPTIONS} EOF diff --git a/configure b/configure index f10e6adc0..eda16e634 100755 --- a/configure +++ b/configure @@ -122,6 +122,8 @@ all_platforms="${all_platforms} x86-win32-gcc" all_platforms="${all_platforms} x86-win32-vs7" all_platforms="${all_platforms} x86-win32-vs8" all_platforms="${all_platforms} x86-win32-vs9" +all_platforms="${all_platforms} x86-win32-vs10" +all_platforms="${all_platforms} x86-win32-vs11" all_platforms="${all_platforms} x86_64-darwin9-gcc" all_platforms="${all_platforms} x86_64-darwin10-gcc" all_platforms="${all_platforms} x86_64-darwin11-gcc" @@ -132,6 +134,8 @@ all_platforms="${all_platforms} x86_64-solaris-gcc" all_platforms="${all_platforms} x86_64-win64-gcc" all_platforms="${all_platforms} x86_64-win64-vs8" all_platforms="${all_platforms} x86_64-win64-vs9" +all_platforms="${all_platforms} x86_64-win64-vs10" +all_platforms="${all_platforms} x86_64-win64-vs11" all_platforms="${all_platforms} universal-darwin8-gcc" all_platforms="${all_platforms} universal-darwin9-gcc" all_platforms="${all_platforms} universal-darwin10-gcc" @@ -648,6 +652,16 @@ process_toolchain() { vs*) enable msvs enable solution vs_version=${tgt_cc##vs} + case $vs_version in + [789]) + VCPROJ_SFX=vcproj + gen_vcproj_cmd=${source_path}/build/make/gen_msvs_proj.sh + ;; + 10|11) + VCPROJ_SFX=vcxproj + gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh + ;; + esac all_targets="${all_targets} solution" INLINE="__forceinline" ;; From 0b4637e021089576d99405a33f0afe50a8f2c2e2 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 17 May 2013 00:56:46 +0300 Subject: [PATCH 4/6] msvs: Support producing both vcproj and vcxproj depending on configure variables Change-Id: Ifa27c7064118c24401ea4e55a64e129c4f503cd5 --- examples.mk | 10 +++++----- libs.mk | 30 +++++++++++++++--------------- solution.mk | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples.mk b/examples.mk index 8426ee769..805d023ed 100644 --- a/examples.mk +++ b/examples.mk @@ -231,19 +231,19 @@ endif # even though there is no real dependency there (the dependency is on # the makefiles). We may want to revisit this. define vcproj_template -$(1): $($(1:.vcproj=).SRCS) +$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) @echo " [vcproj] $$@" - $$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\ + $$(GEN_VCPROJ)\ --exe\ --target=$$(TOOLCHAIN)\ - --name=$$(@:.vcproj=)\ + --name=$$(@:.$(VCPROJ_SFX)=)\ --ver=$$(CONFIG_VS_VERSION)\ - --proj-guid=$$($$(@:.vcproj=).GUID)\ + --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\ $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \ --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \ $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) -lwinmm $$^ endef -PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.vcproj) +PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.$(VCPROJ_SFX)) INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\ $(addprefix bin/$(p)/,$(ALL_EXAMPLES:.c=.exe))) $(foreach proj,$(call enabled,PROJECTS),\ diff --git a/libs.mk b/libs.mk index adcde33f7..5e7216408 100644 --- a/libs.mk +++ b/libs.mk @@ -207,10 +207,10 @@ libvpx_srcs.txt: ifeq ($(CONFIG_EXTERNAL_BUILD),yes) ifeq ($(CONFIG_MSVS),yes) -obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c +obj_int_extract.$(VCPROJ_SFX): $(SRC_PATH_BARE)/build/make/obj_int_extract.c @cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat . @echo " [CREATE] $@" - $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \ + $(qexec)$(GEN_VCPROJ) \ --exe \ --target=$(TOOLCHAIN) \ --name=obj_int_extract \ @@ -221,7 +221,7 @@ obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c -I. \ -I"$(SRC_PATH_BARE)" \ -PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj +PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.$(VCPROJ_SFX) vpx.def: $(call enabled,CODEC_EXPORTS) @echo " [CREATE] $@" @@ -230,9 +230,9 @@ vpx.def: $(call enabled,CODEC_EXPORTS) --out=$@ $^ CLEAN-OBJS += vpx.def -vpx.vcproj: $(CODEC_SRCS) vpx.def +vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def @echo " [CREATE] $@" - $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \ + $(qexec)$(GEN_VCPROJ) \ $(if $(CONFIG_SHARED),--dll,--lib) \ --target=$(TOOLCHAIN) \ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ @@ -243,10 +243,10 @@ vpx.vcproj: $(CODEC_SRCS) vpx.def --out=$@ $(CFLAGS) $^ \ --src-path-bare="$(SRC_PATH_BARE)" \ -PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj +PROJECTS-$(BUILD_LIBVPX) += vpx.$(VCPROJ_SFX) -vpx.vcproj: vpx_config.asm -vpx.vcproj: $(RTCD) +vpx.$(VCPROJ_SFX): vpx_config.asm +vpx.$(VCPROJ_SFX): $(RTCD) endif else @@ -403,9 +403,9 @@ testdata:: $(LIBVPX_TEST_DATA) ifeq ($(CONFIG_EXTERNAL_BUILD),yes) ifeq ($(CONFIG_MSVS),yes) -gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc +gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc @echo " [CREATE] $@" - $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \ + $(qexec)$(GEN_VCPROJ) \ --lib \ --target=$(TOOLCHAIN) \ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ @@ -414,14 +414,14 @@ gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc --ver=$(CONFIG_VS_VERSION) \ --src-path-bare="$(SRC_PATH_BARE)" \ -D_VARIADIC_MAX=10 \ - --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \ + --out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \ -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src" -PROJECTS-$(CONFIG_MSVS) += gtest.vcproj +PROJECTS-$(CONFIG_MSVS) += gtest.$(VCPROJ_SFX) -test_libvpx.vcproj: $(LIBVPX_TEST_SRCS) +test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) @echo " [CREATE] $@" - $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \ + $(qexec)$(GEN_VCPROJ) \ --exe \ --target=$(TOOLCHAIN) \ --name=test_libvpx \ @@ -433,7 +433,7 @@ test_libvpx.vcproj: $(LIBVPX_TEST_SRCS) -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ -L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^ -PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj +PROJECTS-$(CONFIG_MSVS) += test_libvpx.$(VCPROJ_SFX) test:: testdata @set -e; for t in $(addprefix $(TGT_OS:win64=x64)/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done diff --git a/solution.mk b/solution.mk index 948305f05..2c8d29a2a 100644 --- a/solution.mk +++ b/solution.mk @@ -9,14 +9,14 @@ ## # libvpx reverse dependencies (targets that depend on libvpx) -VPX_NONDEPS=$(addsuffix .vcproj,vpx gtest obj_int_extract) +VPX_NONDEPS=$(addsuffix .$(VCPROJ_SFX),vpx gtest obj_int_extract) VPX_RDEPS=$(foreach vcp,\ - $(filter-out $(VPX_NONDEPS),$^), --dep=$(vcp:.vcproj=):vpx) + $(filter-out $(VPX_NONDEPS),$^), --dep=$(vcp:.$(VCPROJ_SFX)=):vpx) -vpx.sln: $(wildcard *.vcproj) +vpx.sln: $(wildcard *.$(VCPROJ_SFX)) @echo " [CREATE] $@" $(SRC_PATH_BARE)/build/make/gen_msvs_sln.sh \ - $(if $(filter vpx.vcproj,$^),$(VPX_RDEPS)) \ + $(if $(filter vpx.$(VCPROJ_SFX),$^),$(VPX_RDEPS)) \ --dep=vpx:obj_int_extract \ --dep=test_libvpx:gtest \ --ver=$(CONFIG_VS_VERSION)\ From 9a5cac0a55f9c99863ebbd4f5ae6315073b5dffb Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Sat, 18 May 2013 19:57:19 +0300 Subject: [PATCH 5/6] msvs: Pass dependency project vcxproj files to the project generation script This is required since the dependencies are specified within the vcxproj files themselves, not in the solution file. This doesn't do anything for the old vcproj files. Change-Id: If7818d8e9dbf4aac5bcb34abe648946cf24db51c --- examples.mk | 2 +- libs.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples.mk b/examples.mk index 805d023ed..05ca8e65a 100644 --- a/examples.mk +++ b/examples.mk @@ -231,7 +231,7 @@ endif # even though there is no real dependency there (the dependency is on # the makefiles). We may want to revisit this. define vcproj_template -$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) +$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX) @echo " [vcproj] $$@" $$(GEN_VCPROJ)\ --exe\ diff --git a/libs.mk b/libs.mk index 5e7216408..ac94b4289 100644 --- a/libs.mk +++ b/libs.mk @@ -230,7 +230,7 @@ vpx.def: $(call enabled,CODEC_EXPORTS) --out=$@ $^ CLEAN-OBJS += vpx.def -vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def +vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def obj_int_extract.$(VCPROJ_SFX) @echo " [CREATE] $@" $(qexec)$(GEN_VCPROJ) \ $(if $(CONFIG_SHARED),--dll,--lib) \ @@ -419,7 +419,7 @@ gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.c PROJECTS-$(CONFIG_MSVS) += gtest.$(VCPROJ_SFX) -test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) +test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_SFX) @echo " [CREATE] $@" $(qexec)$(GEN_VCPROJ) \ --exe \ From a37e84d1d045650536898c20fc7c7790790ef230 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Sun, 19 May 2013 12:21:29 +0300 Subject: [PATCH 6/6] msvs: Don't link to winmm.lib Linking to this library doesn't seem to be necessary, and this library isn't available in the windows phone API subset. Change-Id: I179837d6f9c7407f1cb6101533dc978316a30adf --- examples.mk | 2 +- libs.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples.mk b/examples.mk index 05ca8e65a..5b5ca2379 100644 --- a/examples.mk +++ b/examples.mk @@ -241,7 +241,7 @@ $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX) --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\ $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \ --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \ - $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) -lwinmm $$^ + $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^ endef PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.$(VCPROJ_SFX)) INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\ diff --git a/libs.mk b/libs.mk index ac94b4289..9c7dcdaaf 100644 --- a/libs.mk +++ b/libs.mk @@ -431,7 +431,7 @@ test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \ -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ - -L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^ + -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^ PROJECTS-$(CONFIG_MSVS) += test_libvpx.$(VCPROJ_SFX)