@echo off setlocal set PROJECT_DIR=%~dp0.. set BUILD_DIR=%PROJECT_DIR%\build echo === dstalk CI Build === echo Project: %PROJECT_DIR% :: --- Find vcvarsall.bat for MSVC environment --- set VCVARSALL= for %%d in ( "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" "C:\Program Files\Microsoft Visual Studio\2022\Professional" "C:\Program Files\Microsoft Visual Studio\2022\Community" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ) do ( if exist "%%~d\VC\Auxiliary\Build\vcvarsall.bat" ( set "VCVARSALL=%%~d\VC\Auxiliary\Build\vcvarsall.bat" goto :found_vcvars ) ) :found_vcvars if "%VCVARSALL%"=="" ( echo ERROR: vcvarsall.bat not found - install Visual Studio or set VCVARSALL exit /b 1 ) echo Using vcvarsall: %VCVARSALL% call "%VCVARSALL%" x64 if errorlevel 1 exit /b 1 :: --- Find conan: prefer tools\ local install, fallback to PATH --- set CONAN= if exist "%PROJECT_DIR%\tools\.venv\Scripts\conan.exe" ( set "CONAN=%PROJECT_DIR%\tools\.venv\Scripts\conan.exe" ) else ( where conan >nul 2>&1 if not errorlevel 1 set "CONAN=conan" ) if "%CONAN%"=="" ( echo ERROR: conan not found in tools\ or PATH exit /b 1 ) echo Using conan: %CONAN% :: --- Detect conan profile --- echo --- Conan Profile Detect --- "%CONAN%" profile detect --force if errorlevel 1 exit /b 1 :: --- Install dependencies --- echo --- Conan Install --- if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" cd /d "%BUILD_DIR%" "%CONAN%" install "%PROJECT_DIR%\deps\" --build=missing -s build_type=Release if errorlevel 1 exit /b 1 :: --- Find conan toolchain --- set TOOLCHAIN= if exist "%BUILD_DIR%\build\Release\generators\conan_toolchain.cmake" ( set "TOOLCHAIN=%BUILD_DIR%\build\Release\generators\conan_toolchain.cmake" ) else if exist "%BUILD_DIR%\Release\generators\conan_toolchain.cmake" ( set "TOOLCHAIN=%BUILD_DIR%\Release\generators\conan_toolchain.cmake" ) if "%TOOLCHAIN%"=="" ( echo ERROR: conan_toolchain.cmake not found exit /b 1 ) echo Toolchain: %TOOLCHAIN% :: --- CMake configure --- echo --- CMake Configure --- cmake "%PROJECT_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%TOOLCHAIN%" -DDSTALK_BUILD_TESTS=ON -DDSTALK_BUILD_GUI=OFF if errorlevel 1 exit /b 1 :: --- Build --- echo --- Build --- cmake --build . --parallel if errorlevel 1 exit /b 1 :: --- Test --- echo --- Test --- ctest --output-on-failure --parallel 4 if errorlevel 1 exit /b 1 echo === CI Build PASSED ===