From 5ee47ddb27e6be9901eb2d17c35268bb1f003ce8 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 22 Aug 2017 18:38:37 -0700 Subject: [PATCH] msvc2017: UWP buildfixes --- Makefile.libretro | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index 33b3dae..3d5c6f4 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -50,6 +50,7 @@ ifneq ($(GIT_VERSION)," unknown") CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" endif LIBM := -lm +LIBS := # Unix ifeq ($(platform), unix) @@ -302,7 +303,9 @@ else ifneq (,$(findstring windows_msvc2017,$(platform))) CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP else ifneq (,$(findstring uwp,$(PlatformSuffix))) WinPartition = uwp - CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_APP + CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_APP -DWINDLL -D_UNICODE -DUNICODE -DWRL_NO_DEFAULT_LIB + LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE + LIBS += WindowsApp.lib endif TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix)) @@ -351,8 +354,15 @@ else ifneq (,$(findstring windows_msvc2017,$(platform))) WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)") WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)") - #Turns out only the x86 cl.exe can compile for everything, the x64 one only compiles x64 - VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86 + # For some reason the HostX86 compiler doesn't like compiling for x64 + # ("no such file" opening a shared library), and vice-versa. + # Work around it for now by using the strictly x86 compiler for x86, and x64 for x64. + # NOTE: What about ARM? + ifneq (,$(findstring x64,$(TargetArchMoniker))) + VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX64 + else + VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86 + endif PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH) PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE") @@ -466,8 +476,6 @@ endif CFLAGS += $(COREDEFINES) $(fpic) $(WARNING_DEFINES) $(DEFINES) $(ENDIANNESS_DEFINES) LDFLAGS += $(LIBM) -LIBS := - ifeq ($(platform), psp1) INCFLAGS += -I$(shell psp-config --pspsdk-path)/include endif