From c6c6e3b416635a528a711ed1986b054287a7c491 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sun, 8 Dec 2019 18:52:41 +0100 Subject: [PATCH] Update MSVC build script and docs. --- doc/install.html | 45 ++++++--------------------------------------- src/msvcbuild.bat | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 51 deletions(-) diff --git a/doc/install.html b/doc/install.html index befffa73..58a2a757 100644 --- a/doc/install.html +++ b/doc/install.html @@ -114,14 +114,14 @@ operating systems, CPUs and compilers: GCC 4.x+
GCC 3.4 GCC 4.x+
GCC 3.4 XCode 5.0+
Clang -MSVC, MSVC/EE
WinSDK
MinGW, Cygwin +MSVC
MinGW, Cygwin x64 (64 bit) GCC 4.x+ ORBIS (PS4) XCode 5.0+
Clang -MSVC + SDK v7.0
WinSDK v7.0 +MSVC ARMv5+
ARM9E+
@@ -166,7 +166,7 @@ only).
  • src/Makefile has settings for compiling LuaJIT under POSIX, MinGW or Cygwin.
  • src/msvcbuild.bat has settings for compiling LuaJIT with -MSVC or WinSDK.
  • +MSVC (Visual Studio).

    Please read the instructions given in these files, before changing @@ -243,17 +243,7 @@ Either install one of the open source SDKs (» MinGW or » Cygwin), which come with a modified GCC plus the required development headers. -

    -

    -Or install Microsoft's Visual C++ (MSVC). The freely downloadable -» Express Edition -works just fine, but only contains an x86 compiler. -

    -

    -The freely downloadable -» Windows SDK -only comes with command line tools, but this is all you need to build LuaJIT. -It contains x86 and x64 compilers. +Or install Microsoft's Visual Studio (MSVC).

    Next, download the source package and unpack it using an archive manager @@ -261,7 +251,7 @@ Next, download the source package and unpack it using an archive manager

    Building with MSVC

    -Open a "Visual Studio .NET Command Prompt", cd to the +Open a "Visual Studio Command Prompt" (either x86 or x64), cd to the directory where you've unpacked the sources and run these commands:

    @@ -269,30 +259,7 @@ cd src
     msvcbuild
     

    -Then follow the installation instructions below. -

    -

    Building with the Windows SDK

    -

    -Open a "Windows SDK Command Shell" and select the x86 compiler: -

    -
    -setenv /release /x86
    -
    -

    -Or select the x64 compiler: -

    -
    -setenv /release /x64
    -
    -

    -Then cd to the directory where you've unpacked the sources -and run these commands: -

    -
    -cd src
    -msvcbuild
    -
    -

    +Check the msvcbuild.bat file for more options. Then follow the installation instructions below.

    Building with MinGW or Cygwin

    diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat index bd0c4c5f..9db76275 100644 --- a/src/msvcbuild.bat +++ b/src/msvcbuild.bat @@ -1,19 +1,19 @@ @rem Script to build LuaJIT with MSVC. -@rem Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h +@rem Copyright (C) 2005-2019 Mike Pall. See Copyright Notice in luajit.h @rem -@rem Either open a "Visual Studio .NET Command Prompt" -@rem (Note that the Express Edition does not contain an x64 compiler) -@rem -or- -@rem Open a "Windows SDK Command Shell" and set the compiler environment: -@rem setenv /release /x86 -@rem -or- -@rem setenv /release /x64 +@rem Open a "Visual Studio Command Prompt" (either x86 or x64). +@rem Then cd to this directory and run this script. Use the following +@rem options (in order), if needed. The default is a dynamic release build. @rem -@rem Then cd to this directory and run this script. +@rem debug emit debug symbols +@rem amalg amalgamated build +@rem static static linkage @if not defined INCLUDE goto :FAIL @setlocal +@rem Add more debug flags here, e.g. DEBUGCFLAGS=/DLUA_USE_APICHECK +@set DEBUGCFLAGS= @set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline @set LJLINK=link /nologo @set LJMT=mt /nologo @@ -22,6 +22,7 @@ @set DASM=%DASMDIR%\dynasm.lua @set LJDLLNAME=lua51.dll @set LJLIBNAME=lua51.lib +@set BUILDTYPE=release @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 %LJCOMPILE% host\minilua.c @@ -65,9 +66,10 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c @if "%1" neq "debug" goto :NODEBUG @shift -@set LJCOMPILE=%LJCOMPILE% /Zi -@set LJLINK=%LJLINK% /debug +@set BUILDTYPE=debug +@set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS% :NODEBUG +@set LJLINK=%LJLINK% /%BUILDTYPE% @if "%1"=="amalg" goto :AMALGDLL @if "%1"=="static" goto :STATIC %LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c @@ -111,5 +113,5 @@ if exist luajit.exe.manifest^ @echo ******************************************************* @goto :END :FAIL -@echo You must open a "Visual Studio .NET Command Prompt" to run this script +@echo You must open a "Visual Studio Command Prompt" to run this script :END