Skip to content

Commit

Permalink
[build] Pre-build x86 viosock libraries as needed
Browse files Browse the repository at this point in the history
1. Pre-builds x86 viosock libraries when building virtio-win.sln or
   viosock.sln for amd64 in the circumstances the required x86 libraries
   do not already exist.

Split from PR virtio-win#1212.

Signed-off-by: benyamin-codez <[email protected]>
  • Loading branch information
benyamin-codez committed Dec 24, 2024
1 parent a01c696 commit cec3f9c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions build/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ set BUILD_SPEC=
set BUILD_ARCH=
set BUILD_FAILED=

rem VSCMD_VER version specific buildtime vars
set VIOSOCK_PREBUILD_X86_LIBS=

rem Parse arguments
:argloop
shift /2
Expand Down Expand Up @@ -162,6 +165,42 @@ set TARGET_VS_CONFIG="%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%|%BUILD_ARCH%"
pushd %BUILD_DIR%
call "%~dp0\SetVsEnv.bat" %TARGET_PROJ_CONFIG%

rem Check for x86 viosock libraries and build them if needed...
if "%BUILD_FILE%"=="virtio-win.sln" (
set VIOSOCK_PREBUILD_X86_LIBS=1
)
if "%BUILD_FILE%"=="viosock.sln" (
set VIOSOCK_PREBUILD_X86_LIBS=1
)
if "%VIOSOCK_PREBUILD_X86_LIBS%" EQU "1" (
if %BUILD_ARCH%==x64 (
if not exist "%BUILD_DIR%viosock\lib\x86\%TARGET%%BUILD_FLAVOR%\viosocklib.dll" (
echo.
echo ATTENTION ^: Need to build x86 viosock libraries before building for amd64...
setlocal
set VIRTIO_WIN_NO_ARM=1
if "%BUILD_FILE%"=="virtio-win.sln" (
pushd "%BUILD_DIR%viosock\lib"
)
if "%BUILD_FILE%"=="viosock.sln" (
pushd "%BUILD_DIR%lib"
)
call ..\..\build\build.bat viosocklib.vcxproj %TARGET% x86
if ERRORLEVEL 1 (
set BUILD_FAILED=1
)
popd
if "%BUILD_FAILED%" EQU "1" (
goto :build_arch_done
)
echo Successfully built the x86 viosock libraries.
echo.
echo Continuing with amd64 build...
endlocal
)
)
)

if /I "!TAG!"=="SDV" (
echo Running SDV for %BUILD_FILE%, configuration %TARGET_VS_CONFIG%
call :runsdv "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
Expand All @@ -177,6 +216,7 @@ if /I "!TAG!"=="SDV" (
echo Building %BUILD_FILE%, configuration %TARGET_VS_CONFIG%, command %BUILD_COMMAND%
call :runbuild "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
)
:build_arch_done
popd
endlocal

Expand Down

0 comments on commit cec3f9c

Please sign in to comment.