ref: 4f43624eec8a6546fbd334883e7296bb42cad6da
parent: 74545d3d6b3f515780f4bfba5d98123fac25ab1a
parent: 52808550d8003f014df9814bc2ad504105a83675
author: sijchen <sijchen@cisco.com>
date: Tue Mar 17 05:19:36 EDT 2015
Merge pull request #1849 from mstorsjo/msvc2013-wp-dll Fix building DLLs for Windows Phone with MSVC 2013
--- a/README.md
+++ b/README.md
@@ -107,6 +107,19 @@
Then add `OS=msvc` to the make line of the 'For All Platforms' instructions.
+For Windows Phone builds
+------------------------
+
+Follow the instructions above for normal Windows builds, but use `OS=msvc-wp`
+instead of `OS=msvc`. You will also need gas-preprocessor (as mentioned below
+"Building the Library").
+
+If building for Windows Phone with MSVC 2013, there's no included bat file that sets the lib paths to the Windows Phone kit, but that can be done with a command like this:
+
+ export LIB="c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\store\arm;c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\arm;c:\Program Files (x86)\Windows Phone Kits\8.1\lib\arm"
+
+This is only necessary for building the DLL; the static library can be built without setting this.
+
For All Platforms
-------------------
From the main project directory:
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -40,6 +40,7 @@
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX)
SHARED=-LD
EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
-SHLDFLAGS=-Fd$(PROJECT_NAME).pdb -link -def:openh264.def -implib:$(EXTRA_LIBRARY)
+LDFLAGS += -link
+SHLDFLAGS=-pdb:$(PROJECT_NAME).pdb -def:openh264.def -implib:$(EXTRA_LIBRARY)
STATIC_LDFLAGS=
CODEC_UNITTEST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS
--- a/build/platform-msvc-wp.mk
+++ b/build/platform-msvc-wp.mk
@@ -3,8 +3,15 @@
CFLAGS_OPT += -MD
CFLAGS_DEBUG += -MDd
CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
-CXXFLAGS +=
-LDFLAGS +=
+# Ignore warnings about the main function prototype when building with -ZW
+CXXFLAGS += -ZW -wd4447
+LDFLAGS += -nodefaultlib:kernel32.lib -nodefaultlib:ole32.lib WindowsPhoneCore.lib
+# Ignore warnings about code built with -ZW in .lib files
+AR_OPTS += -ignore:4264
-codec/common/src/WelsThreadLib.$(OBJ): CXXFLAGS += -ZW
-
+# WelsThreadLib requires building with -ZW, since it uses new Windows Runtime
+# classes for creating threads.
+# If linking an .exe that contains Windows Runtime code, the first object
+# file linked into the exe also needs to be built with -ZW (otherwise the build
+# fails with "vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker",
+# so set it on all files.