@echo off echo ======================================== echo D330Viewer MSI Installer Builder echo ======================================== echo. REM 检查WiX Toolset是否安装 where candle.exe >nul 2>&1 if %ERRORLEVEL% NEQ 0 ( echo ERROR: WiX Toolset not found! echo Please install WiX Toolset from: https://wixtoolset.org/ echo After installation, add WiX bin directory to PATH pause exit /b 1 ) echo [1/5] Checking build output... if not exist "bin\D330Viewer.exe" ( echo ERROR: D330Viewer.exe not found in bin directory echo Please build the project first: cmake --build build --config Release pause exit /b 1 ) echo [2/5] Creating installer directory... if not exist "installer\output" mkdir installer\output echo [3/5] Harvesting DLL files... REM 使用heat.exe自动收集bin目录下的所有文件 heat.exe dir bin -cg BinFiles -gg -scom -sreg -sfrag -srd -dr INSTALLFOLDER -var var.BinDir -out installer\BinFiles.wxs echo [4/5] Compiling WiX source... candle.exe -dBinDir=bin installer\UpperControl.wxs installer\BinFiles.wxs -out installer\output\ echo [5/5] Linking MSI package... light.exe -ext WixUIExtension installer\output\UpperControl.wixobj installer\output\BinFiles.wixobj -out installer\output\D330Viewer.msi if exist "installer\output\D330Viewer.msi" ( echo. echo ======================================== echo SUCCESS! MSI installer created: echo installer\output\D330Viewer.msi echo ======================================== ) else ( echo. echo ERROR: Failed to create MSI installer pause exit /b 1 ) pause