-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_and_run.bat
More file actions
130 lines (110 loc) · 2.7 KB
/
build_and_run.bat
File metadata and controls
130 lines (110 loc) · 2.7 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
@echo off
setlocal enabledelayedexpansion
echo === Cross-Platform Plugin System Build Script ===
echo.
REM 检测操作系统
if "%OS%"=="Windows_NT" (
set OS_TYPE=windows
) else (
set OS_TYPE=unknown
)
echo Operating System: %OS_TYPE%
echo.
REM 检查 CMake
cmake --version >nul 2>&1
if %errorlevel% neq 0 (
echo CMake not found. Please install CMake first:
echo Option 1: Download from https://cmake.org/download/
echo Option 2: Install via Visual Studio Installer
echo Option 3: Install via MSYS2: pacman -S cmake
echo Option 4: Install via Chocolatey: choco install cmake
echo Option 5: Install via Scoop: scoop install cmake
pause
exit /b 1
)
for /f "tokens=*" %%i in ('cmake --version ^| findstr /r "cmake version"') do echo %%i
echo.
REM 检查编译器
set COMPILER_FOUND=0
where cl >nul 2>&1
if %errorlevel% equ 0 (
set COMPILER_FOUND=1
echo Visual Studio compiler found
) else (
where gcc >nul 2>&1
if %errorlevel% equ 0 (
set COMPILER_FOUND=1
echo GCC compiler found
)
)
if %COMPILER_FOUND% equ 0 (
echo No C++ compiler found. Please install one of the following:
echo Option 1: Visual Studio Community (with C++ workload)
echo Option 2: MinGW-w64 (https://www.mingw-w64.org/)
echo Option 3: MSYS2 (https://www.msys2.org/)
echo Option 4: Build Tools for Visual Studio
pause
exit /b 1
)
echo.
echo Building Project A...
cd project_a
if not exist build mkdir build
cd build
cmake ..
if %errorlevel% neq 0 (
echo CMake configuration failed for Project A
pause
exit /b 1
)
cmake --build . --config Release
if %errorlevel% neq 0 (
echo Build failed for Project A
pause
exit /b 1
)
cd ..\..
echo.
echo Building Project B...
cd project_b
if not exist build mkdir build
cd build
cmake ..
if %errorlevel% neq 0 (
echo CMake configuration failed for Project B
pause
exit /b 1
)
cmake --build . --config Release
if %errorlevel% neq 0 (
echo Build failed for Project B
pause
exit /b 1
)
cd ..\..
echo.
echo Running Project A with Project B plugin...
cd project_a\build\bin\Release
if not exist project_a.exe (
echo Project A executable not found. Build may have failed.
pause
exit /b 1
)
set PLUGIN_PATH=..\..\..\..\project_b\build\lib\Release\plugin_b.dll
echo Using plugin path: %PLUGIN_PATH%
if not exist "%PLUGIN_PATH%" (
echo Error: Plugin file not found at %PLUGIN_PATH%
echo Available files in plugin directory:
dir "..\..\..\..\project_b\build\lib\Release\" 2>nul
pause
exit /b 1
)
project_a.exe
if %errorlevel% neq 0 (
echo Program execution failed
pause
exit /b 1
)
echo.
echo Build and run completed successfully!
pause