Skip to content

Commit 1088f21

Browse files
benyamin-codezYanVugenfirer
authored andcommitted
[build] Pre-build x86 viosock libraries as needed
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. 2. Provides framework for other drivers requiring pre-built x86 libraries. Implemented in new file: prebuild_x86_libs.bat Split from PR #1212. Signed-off-by: benyamin-codez <115509179+benyamin-codez@users.noreply.github.com>
1 parent 6607ef3 commit 1088f21

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

build/build.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ echo.
179179
pushd %BUILD_DIR%
180180
call "%~dp0SetVsEnv.bat" %TARGET_PROJ_CONFIG%
181181

182+
rem Check for any prerequisite x86 libraries and build them if needed...
183+
call "%~dp0prebuild_x86_libs.bat" %BUILD_FILE% %BUILD_ARCH% "%BUILD_DIR%" %TARGET% %BUILD_FLAVOUR%
184+
IF ERRORLEVEL 1 (
185+
set BUILD_FAILED=1
186+
goto :build_arch_done
187+
)
188+
182189
rem Split builds between Code Analysis and No-Analyis...
183190
if /I "!TAG!"=="SDV" (
184191
echo.

build/prebuild_x86_libs.bat

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@echo off
2+
setlocal
3+
rem Check for x86 viosock libraries and build them if needed...
4+
call :do_viosock %*
5+
if ERRORLEVEL 1 (
6+
endlocal
7+
exit /B 1
8+
)
9+
endlocal
10+
goto :eof
11+
12+
:do_viosock
13+
rem Lay up some variables
14+
set BUILD_FILE=%~1
15+
set BUILD_ARCH=%~2
16+
set BUILD_DIR=%~3
17+
set TARGET=%~4
18+
set BUILD_FLAVOUR=%~5
19+
set VIOSOCK_PREBUILD_X86_LIBS=
20+
set BUILD_FAILED=
21+
22+
rem Which solutions need this?
23+
if "%BUILD_FILE%"=="virtio-win.sln" (
24+
set VIOSOCK_PREBUILD_X86_LIBS=1
25+
)
26+
if "%BUILD_FILE%"=="viosock.sln" (
27+
set VIOSOCK_PREBUILD_X86_LIBS=1
28+
)
29+
30+
if "%VIOSOCK_PREBUILD_X86_LIBS%" EQU "1" (
31+
rem Only proceed if we are building for x64
32+
if %BUILD_ARCH%==x64 (
33+
rem Check for x86 viosock libraries and build them if needed...
34+
if not exist "%BUILD_DIR%viosock\lib\x86\%TARGET%%BUILD_FLAVOR%\viosocklib.dll" (
35+
echo.
36+
echo ATTENTION ^: Need to build x86 viosock libraries before building for amd64...
37+
setlocal
38+
set VIRTIO_WIN_NO_ARM=1
39+
if "%BUILD_FILE%"=="virtio-win.sln" (
40+
pushd "%BUILD_DIR%viosock\lib"
41+
)
42+
if "%BUILD_FILE%"=="viosock.sln" (
43+
pushd "%BUILD_DIR%lib"
44+
)
45+
call ..\..\build\build.bat viosocklib.vcxproj %TARGET% x86
46+
if ERRORLEVEL 1 (
47+
set BUILD_FAILED=1
48+
)
49+
popd
50+
if "%BUILD_FAILED%" EQU "1" (
51+
exit /B 1
52+
)
53+
echo Successfully built the x86 viosock libraries.
54+
echo.
55+
echo Continuing with amd64 build...
56+
endlocal
57+
)
58+
)
59+
)
60+
goto :eof

0 commit comments

Comments
 (0)