Makefile.clangcl: permit building for Windows on Arm.

Now we don't have to worry about which windres we're using (or whether
another target architecture's windres will do just as well), this is
very easy - just test for a couple of extra values of $(Platform).

To build on Arm with VS2017 includes and libraries, various blog posts
and websites explain that you have to #define a cumbersome macro
called _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE, without which the
headers will #error at you. But if you do that, then everything seems
to compile fine and I actually tested it on an Arm Windows machine
today.

Also, I had to disable stack protection (/GS-), because clang-cl
doesn't yet support the particular form of it for which the VS2017 Arm
C library provides the runtime support. Unfortunate in a security
application, of course, but there we go.
This commit is contained in:
Simon Tatham 2018-05-30 19:10:07 +01:00
Родитель bf0cf984cd
Коммит 37aca556ce
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -526,8 +526,16 @@ if (defined $makefiles{'clangcl'}) {
"RCCMD = llvm-rc\n". "RCCMD = llvm-rc\n".
"ifeq (\$(Platform),x64)\n". "ifeq (\$(Platform),x64)\n".
"CCTARGET = x86_64-pc-windows-msvc18.0.0\n". "CCTARGET = x86_64-pc-windows-msvc18.0.0\n".
"PLATFORMCFLAGS =\n".
"else ifeq (\$(Platform),arm)\n".
"CCTARGET = arm-pc-windows-msvc18.0.0\n".
"PLATFORMCFLAGS = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /GS-\n".
"else ifeq (\$(Platform),arm64)\n".
"CCTARGET = arm64-pc-windows-msvc18.0.0\n".
"PLATFORMCFLAGS = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /GS-\n".
"else\n". "else\n".
"CCTARGET = i386-pc-windows-msvc18.0.0\n". "CCTARGET = i386-pc-windows-msvc18.0.0\n".
"PLATFORMCFLAGS =\n".
"endif\n". "endif\n".
"CC = \$(CCCMD) --target=\$(CCTARGET)\n". "CC = \$(CCCMD) --target=\$(CCTARGET)\n".
"RC = \$(RCCMD) /c 1252 \n". "RC = \$(RCCMD) /c 1252 \n".
@ -539,7 +547,7 @@ if (defined $makefiles{'clangcl'}) {
(join " ", map {"-I$dirpfx$_"} @srcdirs) . (join " ", map {"-I$dirpfx$_"} @srcdirs) .
" /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 ". " /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 ".
"/D_CRT_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS"). "/D_CRT_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS").
"\n". " \$(PLATFORMCFLAGS)\n".
"LFLAGS = /incremental:no /dynamicbase /nxcompat\n". "LFLAGS = /incremental:no /dynamicbase /nxcompat\n".
&splitline("RCPPFLAGS = ".(join " ", map {"-I$dirpfx$_"} @srcdirs). &splitline("RCPPFLAGS = ".(join " ", map {"-I$dirpfx$_"} @srcdirs).
" -DWIN32 -D_WIN32 -DWINVER=0x0400")." \$(RCFL)\n". " -DWIN32 -D_WIN32 -DWINVER=0x0400")." \$(RCFL)\n".