Skip to content

Instantly share code, notes, and snippets.

@k-takata
Created March 13, 2019 04:16
Show Gist options
  • Save k-takata/069e03689379c0ba1993898f35134886 to your computer and use it in GitHub Desktop.
Save k-takata/069e03689379c0ba1993898f35134886 to your computer and use it in GitHub Desktop.
Batch file for building (g)Vim using MSVC
@echo off
setlocal
:: Default I/F versions.
set LUA_VER=51
set PERL_VER=528
set PYTHON_VER=27
set PYTHON3_VER=37
set RUBY_VER=25
set RUBY_API_VER_LONG=2.5.0
:: Parse PYTHON*_VER=XXX.
:: Strangely, XXX=YYY is passed as %1 and %2 separately.
:retry
if not "%1"=="" (
if "%1"=="PYTHON_VER" set %1=%2
if "%1"=="PYTHON3_VER" set %1=%2
shift && shift
goto retry
)
if /i "%Platform%"=="x64" (
set PERL_SUF=64
set PY3_SUF=
set PY_REG=64
set RUBY_SUF=-x64
) else (
set PERL_SUF=
if "%PYTHON3_VER%" geq "35" (
set PY3_SUF=-32
) else (
set PY3_SUF=
)
set PY_REG=32
set RUBY_SUF=
)
:: Find Python 2
for /f "tokens=3" %%i in ('reg query HKLM\SOFTWARE\Python\PythonCore\%PYTHON_VER:~0,1%.%PYTHON_VER:~1%\InstallPath /reg:%PY_REG% /ve') do set PYTHON=%%i
set PYTHON=%PYTHON:~0,-1%
if "%PYTHON%"=="" (
echo Python not found.
goto :eof
)
:: Find Python 3
for /f "tokens=3" %%i in ('reg query HKLM\SOFTWARE\Python\PythonCore\%PYTHON3_VER:~0,1%.%PYTHON3_VER:~1%%PY3_SUF%\InstallPath /reg:%PY_REG% /ve') do set PYTHON3=%%i
set PYTHON3=%PYTHON3:~0,-1%
if "%PYTHON3%"=="" (
echo Python3 not found.
goto :eof
)
echo on
nmake -f Make_mvc.mak %* ^
GUI=yes IME=yes MBYTE=yes ICONV=yes ^
DYNAMIC_PERL=yes PERL=c:\Strawberry$(PERL_SUF)\perl ^
DYNAMIC_PYTHON=yes ^
DYNAMIC_PYTHON3=yes ^
DYNAMIC_LUA=yes LUA=C:\work\vim-kaoriya\contrib\luajit-2.0\src ^
DIRECTX=yes ^
USERNAME=kentkt USERDOMAIN=csc.jp ^
"DEFINES=-DDYNAMIC_MSVCRT_DLL=\\\"msvcr100.dll\\\" -DMODIFIED_BY=\\\"$(USERNAME)@$(USERDOMAIN)\\\"" ^
DYNAMIC_RUBY=yes RUBY=c:\Ruby$(RUBY_VER)$(RUBY_SUF) ^
RUBY_MSVCRT_NAME=msvcrt
:: RUBY_INC="/I $(RUBY)\include /I $(RUBY)\.ext\include\$(RUBY_PLATFORM)" ^
@k-takata
Copy link
Author

To build gvim.exe:

> buildvim.bat

To build vim.exe:

> buildvim.bat GUI=no

To change python3 version:

> buildvim.bat PYTHON3_VER=36

To build debug version:

> buildvim.bat DEBUG=yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment