Skip to content

Commit 745fbf8

Browse files
authored
识别安装的VS版本 (#1124)
1 parent ba7f81c commit 745fbf8

File tree

5 files changed

+105
-8
lines changed

5 files changed

+105
-8
lines changed

build/luac/make_win32.bat

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
2+
set "__VS=Visual Studio 16 2019"
3+
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
4+
set "__VSDISPLAY="
5+
set "__VSVER="
6+
if exist "%__VSWhere%" (
7+
for /f "tokens=*" %%p in (
8+
'"%__VSWhere%" -latest -property catalog_productLineVersion'
9+
) do set __VSDISPLAY=%%p
10+
11+
for /f "tokens=*" %%p in (
12+
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
13+
) do set __VSVER=%%p
14+
15+
)
16+
if "%__VSVER%" neq "" (
17+
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
18+
)
19+
120
mkdir build32 & pushd build32
2-
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 14 2015" ..
3-
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017" ..
21+
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "%__VS%" -A Win32 ..
22+
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 16 2019" -A Win32 ..
423
popd
524
cmake --build build32 --config Release
625
pause

build/luac/make_win64.bat

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
2+
set "__VS=Visual Studio 16 2019"
3+
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
4+
set "__VSDISPLAY="
5+
set "__VSVER="
6+
if exist "%__VSWhere%" (
7+
for /f "tokens=*" %%p in (
8+
'"%__VSWhere%" -latest -property catalog_productLineVersion'
9+
) do set __VSDISPLAY=%%p
10+
11+
for /f "tokens=*" %%p in (
12+
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
13+
) do set __VSVER=%%p
14+
15+
)
16+
if "%__VSVER%" neq "" (
17+
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
18+
)
19+
120
mkdir build64 & pushd build64
2-
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 14 2015 Win64" ..
3-
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017 Win64" ..
21+
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "%__VS%" -A x64 ..
22+
IF %ERRORLEVEL% NEQ 0 cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 16 2019" -A x64 ..
423
popd
524
cmake --build build64 --config Release
625
pause

build/make_win32_lua53.bat

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
2+
set "__VS=Visual Studio 16 2019"
3+
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
4+
set "__VSDISPLAY="
5+
set "__VSVER="
6+
if exist "%__VSWhere%" (
7+
for /f "tokens=*" %%p in (
8+
'"%__VSWhere%" -latest -property catalog_productLineVersion'
9+
) do set __VSDISPLAY=%%p
10+
11+
for /f "tokens=*" %%p in (
12+
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
13+
) do set __VSVER=%%p
14+
15+
)
16+
if "%__VSVER%" neq "" (
17+
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
18+
)
19+
120
mkdir build32 & pushd build32
2-
cmake -G "Visual Studio 16 2019" -A Win32 ..
21+
cmake -G "%__VS%" -A Win32 ..
322
popd
423
cmake --build build32 --config Release
524
md plugin_lua53\Plugins\x86

build/make_win64_lua53.bat

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
2+
set "__VS=Visual Studio 16 2019"
3+
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
4+
set "__VSDISPLAY="
5+
set "__VSVER="
6+
if exist "%__VSWhere%" (
7+
for /f "tokens=*" %%p in (
8+
'"%__VSWhere%" -latest -property catalog_productLineVersion'
9+
) do set __VSDISPLAY=%%p
10+
11+
for /f "tokens=*" %%p in (
12+
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
13+
) do set __VSVER=%%p
14+
15+
)
16+
if "%__VSVER%" neq "" (
17+
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
18+
)
19+
120
mkdir build64 & pushd build64
2-
cmake -G "Visual Studio 16 2019" -A x64 ..
21+
cmake -G "%__VS%" -A x64 ..
322
popd
423
cmake --build build64 --config Release
524
md plugin_lua53\Plugins\x86_64

build/make_win_lua54.bat

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1+
2+
set "__VS=Visual Studio 16 2019"
3+
set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
4+
set "__VSDISPLAY="
5+
set "__VSVER="
6+
7+
if exist "%__VSWhere%" (
8+
for /f "tokens=*" %%p in (
9+
'"%__VSWhere%" -latest -property catalog_productLineVersion'
10+
) do set __VSDISPLAY=%%p
11+
12+
for /f "tokens=*" %%p in (
13+
'"%__VSWhere%" -latest -property catalog_productDisplayVersion'
14+
) do set __VSVER=%%p
15+
)
16+
17+
if "%__VSVER%" neq "" (
18+
set __VS=Visual Studio %__VSVER:~0,2% %__VSDisplay%
19+
)
20+
21+
122
mkdir build64_54 & pushd build64_54
2-
cmake -DLUA_VERSION=5.4.1 -G "Visual Studio 16 2019" -A x64 ..
23+
cmake -DLUA_VERSION=5.4.1 -G "%__VS%" -A x64 ..
324
popd
425
cmake --build build64_54 --config Release
526
md plugin_lua54\Plugins\x86_64
627
copy /Y build64_54\Release\xlua.dll plugin_lua54\Plugins\x86_64\xlua.dll
728

829
mkdir build32_54 & pushd build32_54
9-
cmake -DLUA_VERSION=5.4.1 -G "Visual Studio 16 2019" -A Win32 ..
30+
cmake -DLUA_VERSION=5.4.1 -G "%__VS%" -A Win32 ..
1031
popd
1132
cmake --build build32_54 --config Release
1233
md plugin_lua54\Plugins\x86

0 commit comments

Comments
 (0)