diff options
author | Mike Pall <mike> | 2023-09-17 10:44:04 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-09-17 10:44:04 +0200 |
commit | e897c5743f97a6b05c59852709092e7da4119914 (patch) | |
tree | 53e74687899e4c8d1aa0cef79c797260189bc918 | |
parent | 7a2b83a0c5d980bf3db0aeda33c79e7bb4b3da01 (diff) | |
download | luajit-e897c5743f97a6b05c59852709092e7da4119914.tar.gz luajit-e897c5743f97a6b05c59852709092e7da4119914.tar.bz2 luajit-e897c5743f97a6b05c59852709092e7da4119914.zip |
Windows/ARM64: Add MSVC cross-build support for x64 to ARM64.
Thanks to invertego. #1081
-rw-r--r-- | doc/install.html | 3 | ||||
-rw-r--r-- | src/msvcbuild.bat | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/doc/install.html b/doc/install.html index 2c685c85..04bfe26d 100644 --- a/doc/install.html +++ b/doc/install.html | |||
@@ -214,6 +214,9 @@ msvcbuild | |||
214 | Check the <tt>msvcbuild.bat</tt> file for more options. | 214 | Check the <tt>msvcbuild.bat</tt> file for more options. |
215 | Then follow the installation instructions below. | 215 | Then follow the installation instructions below. |
216 | </p> | 216 | </p> |
217 | <p> | ||
218 | For an x64 to ARM64 cross-build run this first: <tt>vcvarsall.bat x64_arm64</tt> | ||
219 | </p> | ||
217 | <h3>Building with MinGW or Cygwin</h3> | 220 | <h3>Building with MinGW or Cygwin</h3> |
218 | <p> | 221 | <p> |
219 | Open a command prompt window and make sure the MinGW or Cygwin programs | 222 | Open a command prompt window and make sure the MinGW or Cygwin programs |
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat index 2cfcf26e..cd25beee 100644 --- a/src/msvcbuild.bat +++ b/src/msvcbuild.bat | |||
@@ -27,12 +27,15 @@ | |||
27 | @set BUILDTYPE=release | 27 | @set BUILDTYPE=release |
28 | @set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_buffer.c | 28 | @set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_buffer.c |
29 | 29 | ||
30 | @setlocal | ||
31 | @call :SETHOSTVARS | ||
30 | %LJCOMPILE% host\minilua.c | 32 | %LJCOMPILE% host\minilua.c |
31 | @if errorlevel 1 goto :BAD | 33 | @if errorlevel 1 goto :BAD |
32 | %LJLINK% /out:minilua.exe minilua.obj | 34 | %LJLINK% /out:minilua.exe minilua.obj |
33 | @if errorlevel 1 goto :BAD | 35 | @if errorlevel 1 goto :BAD |
34 | if exist minilua.exe.manifest^ | 36 | if exist minilua.exe.manifest^ |
35 | %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe | 37 | %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe |
38 | @endlocal | ||
36 | 39 | ||
37 | @set DASMFLAGS=-D WIN -D JIT -D FFI -D ENDIAN_LE -D FPU -D P64 | 40 | @set DASMFLAGS=-D WIN -D JIT -D FFI -D ENDIAN_LE -D FPU -D P64 |
38 | @set LJARCH=x64 | 41 | @set LJARCH=x64 |
@@ -46,6 +49,7 @@ if exist minilua.exe.manifest^ | |||
46 | :NO32 | 49 | :NO32 |
47 | @if "%VSCMD_ARG_TGT_ARCH%" neq "arm64" goto :X64 | 50 | @if "%VSCMD_ARG_TGT_ARCH%" neq "arm64" goto :X64 |
48 | @set DASC=vm_arm64.dasc | 51 | @set DASC=vm_arm64.dasc |
52 | @set DASMTARGET=-D LUAJIT_TARGET=LUAJIT_ARCH_ARM64 | ||
49 | @set LJARCH=arm64 | 53 | @set LJARCH=arm64 |
50 | @goto :DA | 54 | @goto :DA |
51 | :X64 | 55 | :X64 |
@@ -60,12 +64,15 @@ minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC% | |||
60 | if exist ..\.git ( git show -s --format=%%ct >luajit_relver.txt ) else ( type ..\.relver >luajit_relver.txt ) | 64 | if exist ..\.git ( git show -s --format=%%ct >luajit_relver.txt ) else ( type ..\.relver >luajit_relver.txt ) |
61 | minilua host\genversion.lua | 65 | minilua host\genversion.lua |
62 | 66 | ||
63 | %LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c | 67 | @setlocal |
68 | @call :SETHOSTVARS | ||
69 | %LJCOMPILE% /I "." /I %DASMDIR% %DASMTARGET% host\buildvm*.c | ||
64 | @if errorlevel 1 goto :BAD | 70 | @if errorlevel 1 goto :BAD |
65 | %LJLINK% /out:buildvm.exe buildvm*.obj | 71 | %LJLINK% /out:buildvm.exe buildvm*.obj |
66 | @if errorlevel 1 goto :BAD | 72 | @if errorlevel 1 goto :BAD |
67 | if exist buildvm.exe.manifest^ | 73 | if exist buildvm.exe.manifest^ |
68 | %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe | 74 | %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe |
75 | @endlocal | ||
69 | 76 | ||
70 | buildvm -m peobj -o lj_vm.obj | 77 | buildvm -m peobj -o lj_vm.obj |
71 | @if errorlevel 1 goto :BAD | 78 | @if errorlevel 1 goto :BAD |
@@ -125,6 +132,12 @@ if exist luajit.exe.manifest^ | |||
125 | @echo === Successfully built LuaJIT for Windows/%LJARCH% === | 132 | @echo === Successfully built LuaJIT for Windows/%LJARCH% === |
126 | 133 | ||
127 | @goto :END | 134 | @goto :END |
135 | :SETHOSTVARS | ||
136 | @if "%VSCMD_ARG_HOST_ARCH%_%VSCMD_ARG_TGT_ARCH%" equ "x64_arm64" ( | ||
137 | call "%VSINSTALLDIR%Common7\Tools\VsDevCmd.bat" -arch=%VSCMD_ARG_HOST_ARCH% -no_logo | ||
138 | echo on | ||
139 | ) | ||
140 | @goto :END | ||
128 | :BAD | 141 | :BAD |
129 | @echo. | 142 | @echo. |
130 | @echo ******************************************************* | 143 | @echo ******************************************************* |