]> granicus.if.org Git - libvpx/commitdiff
Fix building for arm with Visual Studio 2013
authorMartin Storsjo <martin@martin.st>
Sun, 4 May 2014 20:24:59 +0000 (23:24 +0300)
committerMartin Storsjo <martin@martin.st>
Mon, 5 May 2014 10:26:37 +0000 (13:26 +0300)
The microsoft build tools explicitly disallow building for arm in
the "desktop" target configuration; one has to target "Windows
Store" apps (aka WinRT/Metro) or Windows Phone. In Visual Studio
2012, one could just pick the v110_wp80 toolset which made the
vcxproj files buildable. In Visual Studio 2013, picking the v120_wp81
toolset isn't enough - one has to configure the vcxproj files
as an "AppContainerApplication". This has the implication that
you can't just build a plain .exe (such as the examples) - an .exe
project would need to have an AppxManifest file. Therefore we can
only build the library itself.

If loaded into Visual Studio for Windows (the Windows Store/Phone
version of Visual Studio, not the Desktop one), the obj_int_extract
project is omitted since it's treated as incompatible. Building
from the command line with msbuild works fine though.

The armv7-win32-vs12 target was added as part of a638bdf4 even
though actual use of it hadn't been tested.

Change-Id: Iee8088252cf790317aeb6b417d29058225f1f629

build/make/configure.sh
build/make/gen_msvs_vcxproj.sh

index a65d395de02a8effa58d6c76766ed705acf20c76..4c3b05f66feb205f0b54b1e234b16ee8e7aaefeb 100755 (executable)
@@ -859,6 +859,13 @@ EOF
             msvs_arch_dir=arm-msvs
             disable_feature multithread
             disable_feature unit_tests
+            vs_version=${tgt_cc##vs}
+            if [ $vs_version -ge 12 ]; then
+                # MSVC 2013 doesn't allow doing plain .exe projects for ARM,
+                # only "AppContainerApplication" which requires an AppxManifest.
+                # Therefore disable the examples, just build the library.
+                disable_feature examples
+            fi
             ;;
         rvct)
             CC=armcc
index 9dc790629215599f768fb882e2f4c5bdb594692a..8529eed2431742c9908a581daa98052062fa5d04 100755 (executable)
@@ -292,6 +292,18 @@ generate_vcxproj() {
         tag_content ProjectGuid "{${guid}}"
         tag_content RootNamespace ${name}
         tag_content Keyword ManagedCProj
+        if [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
+            tag_content AppContainerApplication true
+            # The application type can be one of "Windows Store",
+            # "Windows Phone" or "Windows Phone Silverlight". The
+            # actual value doesn't matter from the libvpx point of view,
+            # since a static library built for one works on the others.
+            # The PlatformToolset field needs to be set in sync with this;
+            # for Windows Store and Windows Phone Silverlight it should be
+            # v120 while it should be v120_wp81 if the type is Windows Phone.
+            tag_content ApplicationType "Windows Store"
+            tag_content ApplicationTypeRevision 8.1
+        fi
     close_tag PropertyGroup
 
     tag Import \
@@ -324,18 +336,10 @@ generate_vcxproj() {
                 fi
             fi
             if [ "$vs_ver" = "12" ]; then
-                if [ "$plat" = "ARM" ]; then
-                    # Setting the wp80 toolchain automatically sets the
-                    # WINAPI_FAMILY define, which is required for building
-                    # code for arm with the windows headers. Alternatively,
-                    # one could add AppContainerApplication=true in the Globals
-                    # section and add PrecompiledHeader=NotUsing and
-                    # CompileAsWinRT=false in ClCompile and SubSystem=Console
-                    # in Link.
-                    tag_content PlatformToolset v120_wp80
-                else
-                    tag_content PlatformToolset v120
-                fi
+                # Setting a PlatformToolset indicating windows phone isn't
+                # enough to build code for arm with MSVC 2013, one strictly
+                # has to enable AppContainerApplication as well.
+                tag_content PlatformToolset v120
             fi
             tag_content CharacterSet Unicode
             if [ "$config" = "Release" ]; then
@@ -427,15 +431,25 @@ generate_vcxproj() {
             if ${werror:-false}; then
                 tag_content TreatWarningAsError true
             fi
+            if [ $vs_ver -ge 11 ]; then
+                # We need to override the defaults for these settings
+                # if AppContainerApplication is set.
+                tag_content CompileAsWinRT false
+                tag_content PrecompiledHeader NotUsing
+                tag_content SDLCheck false
+            fi
             close_tag ClCompile
             case "$proj_kind" in
             exe)
                 open_tag Link
                 if [ "$name" != "obj_int_extract" ]; then
-                    tag_content AdditionalDependencies "$curlibs"
+                    tag_content AdditionalDependencies "$curlibs;%(AdditionalDependencies)"
                     tag_content AdditionalLibraryDirectories "$libdirs;%(AdditionalLibraryDirectories)"
                 fi
                 tag_content GenerateDebugInformation true
+                # Console is the default normally, but if
+                # AppContainerApplication is set, we need to override it.
+                tag_content SubSystem Console
                 close_tag Link
                 ;;
             dll)