-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.bat
More file actions
131 lines (111 loc) · 3.57 KB
/
build.bat
File metadata and controls
131 lines (111 loc) · 3.57 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@echo off
setlocal enabledelayedexpansion
echo ========================================
echo Building PipedProcess Solution
echo ========================================
REM First check if MSBuild is already available (e.g., in Developer Command Prompt)
where msbuild >nul 2>&1
if %errorlevel% equ 0 (
echo MSBuild found in current environment, using existing setup...
goto :build
)
REM Try to find and use Visual Studio Developer Command Prompt
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist "%VSWHERE%" (
echo Finding Visual Studio installation...
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set "VSINSTALLDIR=%%i"
)
if defined VSINSTALLDIR (
echo Found Visual Studio at: !VSINSTALLDIR!
REM Try different approaches to setup Visual Studio environment
echo Setting up Visual Studio environment...
REM Method 1: Try VsDevCmd.bat with specific parameters
if exist "!VSINSTALLDIR!\Common7\Tools\VsDevCmd.bat" (
call "!VSINSTALLDIR!\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 -no_logo >nul 2>&1
REM Check if MSBuild is now available
where msbuild >nul 2>&1
if !errorlevel! equ 0 (
echo ✅ Visual Studio environment setup successful
goto :build
)
)
REM Method 2: Try vcvarsall.bat directly
if exist "!VSINSTALLDIR!\VC\Auxiliary\Build\vcvarsall.bat" (
echo Trying alternate setup method...
call "!VSINSTALLDIR!\VC\Auxiliary\Build\vcvarsall.bat" x64 >nul 2>&1
REM Check if MSBuild is now available
where msbuild >nul 2>&1
if !errorlevel! equ 0 (
echo ✅ Visual Studio environment setup successful
goto :build
)
)
echo ❌ ERROR: Failed to setup Visual Studio environment
echo Try running from a Visual Studio Developer Command Prompt instead
pause
exit /b 1
) else (
echo ❌ ERROR: Visual Studio installation not found
echo Please install Visual Studio 2017 or later with C++ build tools
pause
exit /b 1
)
) else (
echo ❌ ERROR: Visual Studio Installer not found
echo Please install Visual Studio 2017 or later
pause
exit /b 1
)
:build
echo.
echo Cleaning previous builds...
msbuild PipedProcess.sln /p:Configuration=Release /p:Platform=x64 /t:Clean /nologo
if errorlevel 1 (
echo ❌ ERROR: Clean failed
pause
exit /b 1
)
echo.
echo Building solution in Release mode (x64)...
msbuild PipedProcess.sln /p:Configuration=Release /p:Platform=x64 /nologo /v:minimal
if %ERRORLEVEL% neq 0 (
echo.
echo ❌ Build FAILED!
echo Check the output above for errors.
pause
exit /b 1
)
echo.
echo ✅ Build completed successfully!
echo.
echo Running tests to verify build...
if not exist bin\Tests_doctest.exe (
echo ❌ Test executable not found!
pause
exit /b 1
)
pushd bin
Tests_doctest.exe
if %ERRORLEVEL% neq 0 (
popd
echo.
echo ❌ Tests FAILED!
pause
exit /b 1
)
popd
echo.
echo ✅ All tests passed!
echo.
echo Build artifacts available in bin\ directory:
dir bin\*.exe /b
echo.
echo ========================================
echo BUILD SUCCESSFUL!
echo ========================================
echo.
echo Ready to create NuGet package with:
echo .\create-package.bat
echo.
pause