Skip to content

Commit 81b68bb

Browse files
committed
Build - use explicit paths in win bat files
1 parent f4416fb commit 81b68bb

4 files changed

Lines changed: 52 additions & 11 deletions

File tree

‎app/win-build-all.bat‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@ set WORKING_DIR=%CD%
22
set CONFIG=%1
33
if /I "%CONFIG%" == "" (set CONFIG=Release)
44

5-
call win-prebuild.bat
6-
call win-config.bat %CONFIG%
7-
call win-build-gui.bat %CONFIG%
8-
call win-post-tau-prod-release.bat
5+
call "%~dp0win-prebuild.bat"
6+
if errorlevel 1 goto :build_failed
7+
call "%~dp0win-config.bat" %CONFIG%
8+
if errorlevel 1 goto :build_failed
9+
call "%~dp0win-build-gui.bat" %CONFIG%
10+
if errorlevel 1 goto :build_failed
11+
call "%~dp0win-post-tau-prod-release.bat"
12+
if errorlevel 1 goto :build_failed
913

1014
cd %WORKING_DIR%
15+
exit /b 0
16+
17+
:build_failed
18+
@echo.
19+
@echo *** Build FAILED with errorlevel %errorlevel% ***
20+
cd %WORKING_DIR%
21+
exit /b %errorlevel%

‎app/win-config.bat‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ set WORKING_DIR=%CD%
22
set CONFIG=%1
33
set SCRIPT_DIR=%~dp0
44
cd %~dp0
5-
if /I "%CONFIG%" == "" (set CONFIG=Release)
5+
if /I "%CONFIG%" == "" set CONFIG=Release
66

7-
@echo "Creating build directory..."
7+
echo "Creating build directory..."
88
mkdir build > nul
99

10-
@echo "Generating project files..."
10+
echo "Generating project files..."
1111
cd build
1212

1313
@REM Note that we pass the CMAKE_BUILD_TYPE here only to enable the correct
@@ -20,10 +20,15 @@ cd build
2020
if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
2121
set "VCPKG_TRIPLET=arm64-windows-static-md"
2222
set "CMAKE_ARCH=ARM64"
23+
set "QT_ARCH_DIR=msvc2022_arm64"
2324
) else (
2425
set "VCPKG_TRIPLET=x64-windows-static-md"
2526
set "CMAKE_ARCH=x64"
27+
set "QT_ARCH_DIR=msvc2022_64"
2628
)
29+
30+
if "%QT_INSTALL_LOCATION%"=="" call :detect_qt
31+
2732
set "VCPKG_ROOT=%SCRIPT_DIR%vcpkg"
2833
set "VCPKG_TOOLCHAIN=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake"
2934
set "VCPKG_FORCE_SYSTEM_BINARIES=1"
@@ -41,3 +46,23 @@ if %ERRORLEVEL% neq 0 (
4146
)
4247

4348
cd %WORKING_DIR%
49+
exit /b 0
50+
51+
:detect_qt
52+
for /f "delims=" %%V in ('dir /b /ad "C:\Qt" 2^>nul') do call :try_qt_version "%%V"
53+
if not defined QT_INSTALL_LOCATION goto :detect_qt_missing
54+
echo Auto-detected Qt at %QT_INSTALL_LOCATION%
55+
exit /b 0
56+
57+
:detect_qt_missing
58+
echo WARNING: QT_INSTALL_LOCATION not set and no Qt6 found under C:\Qt
59+
echo CMake configure will fail at find_package(Qt6).
60+
exit /b 0
61+
62+
:try_qt_version
63+
echo %~1 | findstr /r "^6\." >nul
64+
if errorlevel 1 exit /b 0
65+
if exist "C:\Qt\%~1\%QT_ARCH_DIR%\lib\cmake\Qt6\Qt6Config.cmake" (
66+
set "QT_INSTALL_LOCATION=C:\Qt\%~1\%QT_ARCH_DIR%"
67+
)
68+
exit /b 0

‎app/win-pre-vcpkg.bat‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set VCPKG_FORCE_SYSTEM_BINARIES=
1717
if not exist "vcpkg\vcpkg.exe" (
1818
cd vcpkg
1919
echo Building vcpkg
20-
call bootstrap-vcpkg.bat -disableMetrics
20+
call .\bootstrap-vcpkg.bat -disableMetrics
2121
cd %~dp0
2222
)
2323

@@ -29,7 +29,12 @@ if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
2929

3030
cd vcpkg
3131
@echo Installing Libraries (%VCPKG_TRIPLET%)
32-
vcpkg install libsndfile[core,external-libs] --triplet %VCPKG_TRIPLET% --recurse
32+
.\vcpkg install libsndfile[core,external-libs] --triplet %VCPKG_TRIPLET% --recurse
33+
if errorlevel 1 (
34+
@echo vcpkg install failed with errorlevel %errorlevel%
35+
cd %WORKING_DIR%
36+
exit /b %errorlevel%
37+
)
3338

3439
REM Diagnostic: list what libsndfile actually installed under share/.
3540
REM If find_package(SndFile) fails downstream, this output makes it

‎app/win-prebuild.bat‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where cmake.exe
3333
echo Fetching submodules (app/external/supersonic)...
3434
git -C .. submodule update --init --recursive
3535

36-
call win-pre-vcpkg.bat
37-
call win-pre-translations.bat
36+
call "%~dp0win-pre-vcpkg.bat"
37+
call "%~dp0win-pre-translations.bat"
3838

3939
cd %WORKING_DIR%

0 commit comments

Comments
 (0)