-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows.bat
More file actions
139 lines (121 loc) · 3.04 KB
/
build_windows.bat
File metadata and controls
139 lines (121 loc) · 3.04 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
132
133
134
135
136
137
138
139
@echo off
REM Quick build script for Windows
REM Requires vcpkg to be installed and VCPKG_ROOT environment variable set
echo ========================================
echo QR Generator - Quick Build for Windows
echo ========================================
echo.
REM Check if VCPKG_ROOT is set
if not defined VCPKG_ROOT (
echo ERROR: VCPKG_ROOT environment variable is not set!
echo.
echo Please install vcpkg and set VCPKG_ROOT:
echo 1. git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
echo 2. cd C:\vcpkg
echo 3. bootstrap-vcpkg.bat
echo 4. setx VCPKG_ROOT "C:\vcpkg"
echo.
pause
exit /b 1
)
echo VCPKG_ROOT: %VCPKG_ROOT%
echo.
REM Ask user for build type
echo Select build configuration:
echo 1. Debug (with tests and logging)
echo 2. Release (optimized)
echo 3. Release without tests (for distribution)
echo.
set /p BUILD_CHOICE="Enter choice (1-3): "
if "%BUILD_CHOICE%"=="1" (
set BUILD_TYPE=Debug
set BUILD_DIR=build\windows-debug
set BUILD_TESTS=ON
) else if "%BUILD_CHOICE%"=="2" (
set BUILD_TYPE=Release
set BUILD_DIR=build\windows-release
set BUILD_TESTS=ON
) else if "%BUILD_CHOICE%"=="3" (
set BUILD_TYPE=Release
set BUILD_DIR=build\windows-release-no-tests
set BUILD_TESTS=OFF
) else (
echo Invalid choice!
pause
exit /b 1
)
echo.
echo Configuration: %BUILD_TYPE%
echo Build directory: %BUILD_DIR%
echo Tests: %BUILD_TESTS%
echo.
REM Create build directory
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%"
REM Configure CMake
echo [1/3] Configuring CMake...
cmake ..\.. ^
-G "Visual Studio 16 2019" ^
-A x64 ^
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DBUILD_TESTS=%BUILD_TESTS% ^
-DENABLE_I18N=ON
if errorlevel 1 (
echo.
echo ERROR: CMake configuration failed!
cd ..\..
pause
exit /b 1
)
echo.
echo [2/3] Building project...
cmake --build . --config %BUILD_TYPE% --parallel
if errorlevel 1 (
echo.
echo ERROR: Build failed!
cd ..\..
pause
exit /b 1
)
REM Run tests if enabled
if "%BUILD_TESTS%"=="ON" (
echo.
echo [3/3] Running tests...
ctest -C %BUILD_TYPE% --output-on-failure
if errorlevel 1 (
echo.
echo WARNING: Some tests failed!
) else (
echo.
echo All tests passed!
)
) else (
echo.
echo [3/3] Tests disabled.
)
cd ..\..
echo.
echo ========================================
echo Build completed successfully!
echo ========================================
echo.
echo Executable location:
echo %BUILD_DIR%\%BUILD_TYPE%\qr-generator.exe
echo.
echo Visual Studio solution:
echo %BUILD_DIR%\QRGenerator.sln
echo.
echo To run the application:
echo %BUILD_DIR%\%BUILD_TYPE%\qr-generator.exe
echo.
echo To run tests:
echo cd %BUILD_DIR%
echo ctest -C %BUILD_TYPE%
echo.
REM Ask if user wants to open in Visual Studio
set /p OPEN_VS="Open project in Visual Studio 2019? (y/n): "
if /i "%OPEN_VS%"=="y" (
start "" "%BUILD_DIR%\QRGenerator.sln"
)
pause