From cd034c36bc541b17bfd657abe98ceb42c973b848 Mon Sep 17 00:00:00 2001 From: Sebastian Godelet Date: Fri, 24 Apr 2026 22:06:36 +1000 Subject: [PATCH] Support targeting Windows on ARM64 with MSVC. NT_MAKEFILE: Accept CPU=ARM64 (or arm64/AARCH64/aarch64) in addition to the existing i386 and AMD64 cases. Define _ARM64_=1 and the Win64/Win32 convention macros for ARM64 builds, and set CVTRES_CPU=ARM64 so resource handling mirrors the other 64-bit target. --- NT_MAKEFILE | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NT_MAKEFILE b/NT_MAKEFILE index 416081883..2374666f2 100644 --- a/NT_MAKEFILE +++ b/NT_MAKEFILE @@ -1,6 +1,7 @@ # Makefile for Windows (Win32/64). Assumes Microsoft compiler. # Should be invoked as "nmake -f NT_MAKEFILE []"; the optional arguments # are: "cpu=AMD64" - to target x64, "cpu=i386" - to target x86, +# "cpu=ARM64" - to target Windows on ARM64, # "enable_static=1" - to build it as a static library, "nodebug=1" - to produce # the release variant of the library, "disable_threads=1" - to build the # library and the tests without threads support. @@ -16,6 +17,8 @@ CPU = $(PROCESSOR_ARCHITECTURE) CPU = i386 !ELSEIF "$(CPU)" == "X64" || "$(CPU)" == "x64" || "$(CPU)" == "amd64" CPU = AMD64 +!ELSEIF "$(CPU)" == "arm64" || "$(CPU)" == "AARCH64" || "$(CPU)" == "aarch64" +CPU = ARM64 !ENDIF !IF !DEFINED(NMAKE_WINVER) @@ -27,6 +30,8 @@ cflags = $(cflags) -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -GS -D_WINNT -W4 cflags = $(cflags) -D_X86_=1 -DWIN32 -D_WIN32 !ELSEIF "$(CPU)" == "AMD64" cflags = $(cflags) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 +!ELSEIF "$(CPU)" == "ARM64" +cflags = $(cflags) -D_ARM64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 !ENDIF cflags = $(cflags) -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER) @@ -46,6 +51,8 @@ ldebug = /DEBUG /DEBUGTYPE:cv CVTRES_CPU=X86 !ELSEIF "$(CPU)" == "AMD64" CVTRES_CPU=X64 +!ELSEIF "$(CPU)" == "ARM64" +CVTRES_CPU=ARM64 !ENDIF !IFNDEF NODEBUG