-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.bat
More file actions
114 lines (96 loc) · 2.93 KB
/
Copy pathbuild.bat
File metadata and controls
114 lines (96 loc) · 2.93 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
@echo off
setlocal enabledelayedexpansion
REM OneSDK Windows Build Script
REM This script builds the OneSDK project on Windows
echo ========================================
echo OneSDK Windows Build Script
echo ========================================
REM Check CMake version
echo Checking CMake version...
cmake --version >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: CMake is not installed or not in PATH!
exit /b 1
)
REM Get CMake version - extract from the first line
for /f "tokens=3 delims= " %%a in ('cmake --version 2^>nul') do (
set CMAKE_VERSION=%%a
goto :version_extracted
)
:version_extracted
echo Detected CMake version: %CMAKE_VERSION%
REM Extract major and minor version numbers
for /f "tokens=1,2 delims=." %%a in ("%CMAKE_VERSION%") do (
set CMAKE_MAJOR=%%a
set CMAKE_MINOR=%%b
)
REM Convert minor version to number for comparison
set /a CMAKE_MINOR_NUM=%CMAKE_MINOR%
REM Check version compatibility
if %CMAKE_MAJOR%==3 (
if %CMAKE_MINOR_NUM% geq 10 (
echo CMake version is compatible (3.x)
goto :version_check_done
) else (
echo Warning: CMake version %CMAKE_VERSION% is below 3.10
echo Minimum recommended: 3.10
echo Continuing with build...
goto :version_check_done
)
) else if %CMAKE_MAJOR%==4 (
echo Warning: CMake version %CMAKE_VERSION% is 4.x
echo This may cause compatibility issues with cJSON
echo Recommended: Use CMake 3.26.x for best compatibility
echo Continuing with build...
goto :version_check_done
) else if %CMAKE_MAJOR% gtr 4 (
echo Error: CMake version %CMAKE_VERSION% is too new. Maximum supported: 4.x
echo Please use CMake 3.10-4.x for compatibility
exit /b 1
) else (
echo Error: CMake version %CMAKE_VERSION% is too old. Minimum required: 3.10
exit /b 1
)
:version_check_done
REM Check if clean-build parameter is provided
set CLEAN_BUILD=0
if "%1"=="clean-build" (
set CLEAN_BUILD=1
shift
)
REM Clean build directory if requested
if %CLEAN_BUILD%==1 (
echo Cleaning build directory...
if exist build rmdir /s /q build
)
REM Create build directory
if not exist build mkdir build
cd build
REM Configure with CMake
echo Configuring with CMake...
cmake %* ..
REM Check if CMake configuration was successful
if %ERRORLEVEL% neq 0 (
echo Error: CMake configuration failed!
cd ..
exit /b 1
)
REM Build the project
echo Building the project...
cmake --build . --config Release
REM Check if build was successful
if %ERRORLEVEL% neq 0 (
echo Error: Build failed!
cd ..
exit /b 1
)
echo ========================================
echo Build completed successfully!
echo ========================================
echo.
echo Build artifacts are located in:
echo - Libraries: build\Release\
echo - Executables: build\Release\
echo - Headers: build\include\
echo.
cd ..