Merge pull request #1849 from mstorsjo/msvc2013-wp-dll

Fix building DLLs for Windows Phone with MSVC 2013
This commit is contained in:
sijchen 2015-03-17 09:19:36 +08:00
commit 4f43624eec
3 changed files with 26 additions and 5 deletions

View File

@ -107,6 +107,19 @@ You will also need to set your INCLUDE and LIB paths to point to your VS and SDK
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:

View File

@ -40,6 +40,7 @@ SHAREDLIBSUFFIX=dll
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

View File

@ -3,8 +3,15 @@ include $(SRC_PATH)build/msvc-common.mk
CFLAGS_OPT += -MD
CFLAGS_DEBUG += -MDd
CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
CXXFLAGS +=
LDFLAGS +=
codec/common/src/WelsThreadLib.$(OBJ): CXXFLAGS += -ZW
# 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
# 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.