|
| 1 | +@echo off |
| 2 | +setlocal ENABLEDELAYEDEXPANSION |
| 3 | + |
| 4 | +echo ---------------------------------------- |
| 5 | + |
| 6 | +REM --- Get script directory path --- |
| 7 | +set "ProjDirPath=%~dp0" |
| 8 | +set "DoxyOutput=%ProjDirPath%..\..\Documentation\AdFirmware\Doxygen\doxyOutput" |
| 9 | +set "DoxyPath=%ProjDirPath%..\..\Documentation\AdFirmware\Doxygen" |
| 10 | +set "DoxygenDir=%ProjDirPath%\Output\doxygen" |
| 11 | +set "ZipFile=%ProjDirPath%\Output\doxygen.zip" |
| 12 | + |
| 13 | +REM Remove trailing backslash if present |
| 14 | +if "%ProjDirPath:~-1%"=="\" set "ProjDirPath=%ProjDirPath:~0,-1%" |
| 15 | + |
| 16 | +echo ProjDirPath is: %ProjDirPath% |
| 17 | +echo DoxyPath is: %DoxyPath% |
| 18 | + |
| 19 | +REM Check and create Output directory |
| 20 | +if not exist "%ProjDirPath%\Output" ( |
| 21 | + mkdir "%ProjDirPath%\Output" |
| 22 | +) |
| 23 | + |
| 24 | +REM Copy .srec file |
| 25 | +xcopy /y %ProjDirPath%\..\..\Source\ADFirmware\CM7\Debug\ADFirmware_CM7.srec %ProjDirPath%\Output |
| 26 | + |
| 27 | +where doxygen.exe >nul 2>&1 |
| 28 | + |
| 29 | +if %errorlevel%==0 ( |
| 30 | + echo Doxygen exists |
| 31 | + |
| 32 | + echo Current directory before pushd: %CD% |
| 33 | + |
| 34 | + REM Enter Doxygen directory first |
| 35 | + pushd %DoxyPath% |
| 36 | + |
| 37 | + echo Current directory after pushd: !CD! |
| 38 | + |
| 39 | + REM Run doxygen (relative paths now relative to Doxyfile) |
| 40 | + doxygen.exe doxygen.txt >nul 2>&1 |
| 41 | + |
| 42 | + REM Return to original directory |
| 43 | + popd |
| 44 | + |
| 45 | + REM Remove accidental local doxyOutput if created |
| 46 | + if exist "doxyOutput" ( |
| 47 | + rmdir /s /q "doxyOutput" |
| 48 | + ) |
| 49 | + |
| 50 | + REM Copy from specified source |
| 51 | + |
| 52 | + if exist "%DoxyOutput%" ( |
| 53 | + echo Detected Doxygen output at: %DoxyOutput% |
| 54 | + if exist "%ProjDirPath%\Output\doxygen" ( |
| 55 | + rmdir /s /q "%ProjDirPath%\Output\doxygen" |
| 56 | + ) |
| 57 | + xcopy /s /e /i /y "%DoxyOutput%\*" "%ProjDirPath%\Output\doxygen\" >nul |
| 58 | + if exist "%DoxygenDir%" ( |
| 59 | + echo Zipping Doxygen folder... |
| 60 | + powershell -Command "Compress-Archive -Path '%DoxygenDir%\*' -DestinationPath '%ZipFile%' -Force" |
| 61 | + echo Doxygen folder zipped to: %ZipFile% |
| 62 | + ) else ( |
| 63 | + echo Doxygen folder not found, skipping zip. |
| 64 | + ) |
| 65 | + ) else ( |
| 66 | + echo Doxygen output folder not found at: %DoxyOutput% |
| 67 | + ) |
| 68 | +) else ( |
| 69 | + echo Doxygen dont exists |
| 70 | +) |
| 71 | + |
| 72 | + |
| 73 | +echo Post-build steps completed successfully. |
| 74 | +endlocal |
0 commit comments