Skip to content

Commit

Permalink
识别安装的VS版本 (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
oOtroyOo authored Apr 19, 2024
1 parent ba7f81c commit 745fbf8
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 8 deletions.
23 changes: 21 additions & 2 deletions build/luac/make_win32.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@

set "__VS=Visual Studio 16 2019"
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSDISPLAY="
set "__VSVER="
if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productLineVersion'
) do set __VSDISPLAY=%%p

for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
) do set __VSVER=%%p

)
if "%__VSVER%" neq "" (
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
)

mkdir build32 & pushd build32
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 14 2015" ..
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017" ..
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "%__VS%" -A Win32 ..
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 16 2019" -A Win32 ..
popd
cmake --build build32 --config Release
pause
23 changes: 21 additions & 2 deletions build/luac/make_win64.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@

set "__VS=Visual Studio 16 2019"
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSDISPLAY="
set "__VSVER="
if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productLineVersion'
) do set __VSDISPLAY=%%p

for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
) do set __VSVER=%%p

)
if "%__VSVER%" neq "" (
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
)

mkdir build64 & pushd build64
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 14 2015 Win64" ..
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017 Win64" ..
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "%__VS%" -A x64 ..
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 16 2019" -A x64 ..
popd
cmake --build build64 --config Release
pause
21 changes: 20 additions & 1 deletion build/make_win32_lua53.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@

set "__VS=Visual Studio 16 2019"
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSDISPLAY="
set "__VSVER="
if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productLineVersion'
) do set __VSDISPLAY=%%p

for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
) do set __VSVER=%%p

)
if "%__VSVER%" neq "" (
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
)

mkdir build32 & pushd build32
cmake -G "Visual Studio 16 2019" -A Win32 ..
cmake -G "%__VS%" -A Win32 ..
popd
cmake --build build32 --config Release
md plugin_lua53\Plugins\x86
Expand Down
21 changes: 20 additions & 1 deletion build/make_win64_lua53.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@

set "__VS=Visual Studio 16 2019"
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSDISPLAY="
set "__VSVER="
if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productLineVersion'
) do set __VSDISPLAY=%%p

for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
) do set __VSVER=%%p

)
if "%__VSVER%" neq "" (
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
)

mkdir build64 & pushd build64
cmake -G "Visual Studio 16 2019" -A x64 ..
cmake -G "%__VS%" -A x64 ..
popd
cmake --build build64 --config Release
md plugin_lua53\Plugins\x86_64
Expand Down
25 changes: 23 additions & 2 deletions build/make_win_lua54.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@

set "__VS=Visual Studio 16 2019"
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
set "__VSDISPLAY="
set "__VSVER="

if exist "%__VSWhere%" (
for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productLineVersion'
) do set __VSDISPLAY=%%p

for /f "tokens=*" %%p in (
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
) do set __VSVER=%%p
)

if "%__VSVER%" neq "" (
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
)


mkdir build64_54 & pushd build64_54
cmake -DLUA_VERSION=5.4.1 -G "Visual Studio 16 2019" -A x64 ..
cmake -DLUA_VERSION=5.4.1 -G "%__VS%" -A x64 ..
popd
cmake --build build64_54 --config Release
md plugin_lua54\Plugins\x86_64
copy /Y build64_54\Release\xlua.dll plugin_lua54\Plugins\x86_64\xlua.dll

mkdir build32_54 & pushd build32_54
cmake -DLUA_VERSION=5.4.1 -G "Visual Studio 16 2019" -A Win32 ..
cmake -DLUA_VERSION=5.4.1 -G "%__VS%" -A Win32 ..
popd
cmake --build build32_54 --config Release
md plugin_lua54\Plugins\x86
Expand Down

0 comments on commit 745fbf8

Please sign in to comment.