diff --git a/Makefile.libretro b/Makefile.libretro index 322c13d..33b3dae 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -293,8 +293,20 @@ else ifeq ($(platform), gcw0) PLATFORM_DEFINES += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float EXTERNAL_ZLIB = 1 -# Windows MSVC 2017 x64 -else ifeq ($(platform), windows_msvc2017_x64) +# Windows MSVC 2017 all architectures +else ifneq (,$(findstring windows_msvc2017,$(platform))) + + PlatformSuffix = $(subst windows_msvc2017_,,$(platform)) + ifneq (,$(findstring desktop,$(PlatformSuffix))) + WinPartition = desktop + CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP + else ifneq (,$(findstring uwp,$(PlatformSuffix))) + WinPartition = uwp + CFLAGS += -DWINAPI_FAMILY=WINAPI_FAMILY_APP + endif + + TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix)) + CC = cl.exe CXX = cl.exe @@ -333,24 +345,21 @@ else ifeq ($(platform), windows_msvc2017_x64) VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*') VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer) - ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) - HostCPUArchDir := HostX64 - else - HostCPUArchDir := HostX86 - endif - + WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared") WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt") - WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\x64") - WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\x64") + WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um") + WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)") + WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)") - VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\$(HostCPUArchDir) + #Turns out only the x86 cl.exe can compile for everything, the x64 one only compiles x64 + VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86 - PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/x64"):$(PATH) + PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH) PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE") INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include") - LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/x64") + LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/$(TargetArchMoniker)") - export INCLUDE := $(INCLUDE);$(WindowsSDKUCRTIncludeDir) + export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir) export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir) TARGET := $(TARGET_NAME)_libretro.dll PSS_STYLE :=2