-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathbuild_vs2026.bat
More file actions
57 lines (51 loc) · 2.39 KB
/
Copy pathbuild_vs2026.bat
File metadata and controls
57 lines (51 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
rem ---------------------------------------------------------------------------
rem Build SteamworksPy64.dll against the vendored Steamworks SDK (library\sdk)
rem using whatever Visual Studio (with C++ x64 tools) is installed.
rem
rem Unlike the upstream build_win_64.bat this does NOT assume the "BuildTools"
rem edition / old install layout -- it discovers the install via vswhere and
rem calls vcvars64.bat. No argument required.
rem ---------------------------------------------------------------------------
setlocal enableextensions
cd /d "%~dp0"
echo [*] Locating Visual Studio C++ toolchain
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" (
echo [!] vswhere.exe not found at "%VSWHERE%"
exit /b 5
)
set "VSINSTALL="
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSINSTALL=%%i"
if not defined VSINSTALL (
echo [!] No Visual Studio install with the C++ x64 tools was found.
exit /b 5
)
echo [*] Using: %VSINSTALL%
call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" >nul || (echo [!] vcvars64 failed & exit /b 5)
echo [*] Checking SDK prerequisites
if not exist "library\sdk\steam\steam_api.h" (echo [!] missing library\sdk\steam\*.h & exit /b 5)
if not exist "library\sdk\redist\steam_api64.dll" (echo [!] missing library\sdk\redist\steam_api64.dll & exit /b 5)
if not exist "library\sdk\redist\steam_api64.lib" (echo [!] missing library\sdk\redist\steam_api64.lib & exit /b 5)
set "DIRNAME=_build_%RANDOM%"
echo [*] Building in %DIRNAME%
mkdir "%DIRNAME%"
copy /y "library\SteamworksPy.cpp" "%DIRNAME%\SteamworksPy.cpp" >nul
copy /y "library\sdk\redist\steam_api64.dll" "%DIRNAME%\" >nul
copy /y "library\sdk\redist\steam_api64.lib" "%DIRNAME%\" >nul
mklink /J "%DIRNAME%\sdk" "%CD%\library\sdk" >nul
pushd "%DIRNAME%"
echo [*] Compiling SteamworksPy64.dll
cl.exe /nologo /O2 /EHsc /D_USRDLL /D_WINDLL SteamworksPy.cpp steam_api64.lib /link /DLL /OUT:SteamworksPy64.dll 2>&1
set "RC=%ERRORLEVEL%"
popd
if "%RC%"=="0" (
if not exist "redist\windows" mkdir "redist\windows"
copy /y "%DIRNAME%\SteamworksPy64.dll" "redist\windows\SteamworksPy64.dll" >nul
echo [*] OK -^> redist\windows\SteamworksPy64.dll
) else (
echo [!] Build FAILED with code %RC%
)
echo [*] Cleanup
rmdir /s /q "%DIRNAME%"
exit /b %RC%