-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild_wx.cmd
More file actions
131 lines (111 loc) · 3.57 KB
/
build_wx.cmd
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 === Building wxWidgets if needed ===
REM --- Locate wx build folder ---
set "WX_BUILD_DIR=%~dp0external\wxWidgets\build\msw"
if not exist "%WX_BUILD_DIR%" (
echo ERROR: wxWidgets build folder not found at %WX_BUILD_DIR%
exit /b 1
)
REM --- Resolve latest wxWidgets .sln dynamically (highest vcXX) ---
set "WX_SLN="
set "WX_MAX_VER=0"
for %%F in ("%WX_BUILD_DIR%\wx_vc*.sln") do (
REM Example filename (no ext): wx_vc17
set "FILE=%%~nF"
set "WX_VER=!FILE:wx_vc=!"
REM Ensure WX_VER is numeric only
set "BAD="
for /f "delims=0123456789" %%X in ("!WX_VER!") do set "BAD=%%X"
if defined BAD (
set "WX_VER="
)
if defined WX_VER (
if !WX_VER! GTR !WX_MAX_VER! (
set "WX_MAX_VER=!WX_VER!"
set "WX_SLN=%%F"
)
)
)
if not defined WX_SLN (
echo ERROR: Could not find wxWidgets Visual Studio solution in %WX_BUILD_DIR%
exit /b 1
)
echo [wxWidgets] Using solution: %WX_SLN%
echo [wxWidgets] PlatformToolset will be selected by wx_config.props
REM --- Get current submodule commit hash ---
pushd "%~dp0external\wxWidgets" >nul
for /f %%H in ('git rev-parse HEAD') do set "WX_HASH=%%H"
if not defined WX_HASH (
echo ERROR: Could not read wxWidgets git hash. Is the submodule initialized?
popd >nul
exit /b 1
)
popd >nul
REM --- Paths for artifacts and stored hash ---
set "WX_LIB_DIR=%WX_BUILD_DIR%\..\..\lib\vc_x64_lib"
set "HASH_FILE=%WX_LIB_DIR%\.wx_build_hash"
REM --- Flags ---
set "NEED_RELEASE_BUILD=0"
set "NEED_DEBUG_BUILD=0"
set "DID_REBUILD=0"
REM --- Check Release needs rebuild ---
if not exist "%WX_LIB_DIR%\mswu\wx\setup.h" set "NEED_RELEASE_BUILD=1"
if not exist "%HASH_FILE%" set "NEED_RELEASE_BUILD=1"
if exist "%HASH_FILE%" (
set "OLD_HASH="
set /p OLD_HASH=<"%HASH_FILE%"
if not "!OLD_HASH!"=="%WX_HASH%" set "NEED_RELEASE_BUILD=1"
)
REM --- If Release rebuilds, force Debug too ---
if "%NEED_RELEASE_BUILD%"=="1" set "NEED_DEBUG_BUILD=1"
REM --- Otherwise check Debug independently (only if not CI) ---
if /i not "%CI%"=="true" (
if not exist "%WX_LIB_DIR%\mswud\wx\setup.h" set "NEED_DEBUG_BUILD=1"
if not exist "%HASH_FILE%" set "NEED_DEBUG_BUILD=1"
if exist "%HASH_FILE%" (
set "OLD_HASH="
set /p OLD_HASH=<"%HASH_FILE%"
if not "!OLD_HASH!"=="%WX_HASH%" set "NEED_DEBUG_BUILD=1"
)
)
REM --- If hash is outdated, wipe the lib folder ---
if "%NEED_RELEASE_BUILD%"=="1" (
echo [wxWidgets] Clearing old libraries...
rmdir /s /q "%WX_LIB_DIR%" 2>nul
mkdir "%WX_LIB_DIR%" 2>nul
)
REM --- Build Release ---
if "%NEED_RELEASE_BUILD%"=="1" (
echo [wxWidgets] Building Release...
msbuild "%WX_SLN%" /p:Configuration=Release /p:Platform=x64 /m /t:Rebuild
if errorlevel 1 (
echo ERROR: Release build failed.
exit /b 1
)
set "DID_REBUILD=1"
) else (
echo [wxWidgets] Release build up to date, skipping.
)
REM --- Build Debug (only if not CI) ---
if /i not "%CI%"=="true" (
if "%NEED_DEBUG_BUILD%"=="1" (
echo [wxWidgets] Building Debug...
msbuild "%WX_SLN%" /p:Configuration=Debug /p:Platform=x64 /m /t:Rebuild
if errorlevel 1 (
echo ERROR: Debug build failed.
exit /b 1
)
set "DID_REBUILD=1"
) else (
echo [wxWidgets] Debug build up to date, skipping.
)
) else (
echo [wxWidgets] Skipping Debug build in CI.
)
REM --- Update hash only after all builds succeed ---
if "%DID_REBUILD%"=="1" (
>"%HASH_FILE%" echo %WX_HASH%
)
echo === wxWidgets build check complete ===
endlocal