|
| 1 | +@echo off |
| 2 | +setlocal |
| 3 | +pushd "%~dp0" |
| 4 | + |
| 5 | +if "%VCVARSALL%"=="" set "VCVARSALL=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" |
| 6 | +if "%VCTOOLSET%"=="" set "VCTOOLSET=VC143" |
| 7 | + |
| 8 | +if not exist "%VCVARSALL%" ( |
| 9 | + echo vcvarsall.bat not found, set VCVARSALL to its path |
| 10 | + exit /b 1 |
| 11 | +) |
| 12 | + |
| 13 | +if "%1"=="" ( |
| 14 | + echo No version specified, using current |
| 15 | + set "version=current" |
| 16 | +) else ( |
| 17 | + set "version=%1" |
| 18 | +) |
| 19 | +set "builddir=%~dp0\build\release-%version%" |
| 20 | + |
| 21 | +if exist "%builddir%" ( |
| 22 | + echo Deleting contents of %builddir% |
| 23 | + rd /s /q "%builddir%" |
| 24 | +) |
| 25 | + |
| 26 | +cmake --preset win32 -B "%builddir%\build-win32" |
| 27 | +cmake --preset win32-omp -B "%builddir%\build-win32-omp" |
| 28 | +cmake --preset win64 -B "%builddir%\build-win64" |
| 29 | +cmake --preset win64-omp -B "%builddir%\build-win64-omp" |
| 30 | + |
| 31 | +cmake --build "%builddir%\build-win32" --config Release |
| 32 | +cmake --build "%builddir%\build-win32-omp" --config Release |
| 33 | +cmake --build "%builddir%\build-win64" --config Release |
| 34 | +cmake --build "%builddir%\build-win64-omp" --config Release |
| 35 | + |
| 36 | +mkdir "%builddir%\rel-win32\msdfgen" |
| 37 | +mkdir "%builddir%\rel-win32-omp\msdfgen" |
| 38 | +mkdir "%builddir%\rel-win64\msdfgen" |
| 39 | +mkdir "%builddir%\rel-win64-omp\msdfgen" |
| 40 | + |
| 41 | +copy "%builddir%\build-win32\Release\msdfgen.exe" "%builddir%\rel-win32\msdfgen" |
| 42 | +copy "%builddir%\build-win32-omp\Release\msdfgen.exe" "%builddir%\rel-win32-omp\msdfgen" |
| 43 | +copy "%builddir%\build-win64\Release\msdfgen.exe" "%builddir%\rel-win64\msdfgen" |
| 44 | +copy "%builddir%\build-win64-omp\Release\msdfgen.exe" "%builddir%\rel-win64-omp\msdfgen" |
| 45 | + |
| 46 | +echo msdfgen.exe -defineshape "{ 1471,0; 1149,0; 1021,333; 435,333; 314,0; 0,0; 571,1466; 884,1466; # }{ 926,580; 724,1124; 526,580; # }" -size 16 16 -autoframe -testrender render.png 1024 1024 > "%builddir%\example.bat" |
| 47 | + |
| 48 | +copy "%builddir%\example.bat" "%builddir%\rel-win32\msdfgen" |
| 49 | +copy "%builddir%\example.bat" "%builddir%\rel-win32-omp\msdfgen" |
| 50 | +copy "%builddir%\example.bat" "%builddir%\rel-win64\msdfgen" |
| 51 | +copy "%builddir%\example.bat" "%builddir%\rel-win64-omp\msdfgen" |
| 52 | + |
| 53 | +call "%VCVARSALL%" x64 |
| 54 | + |
| 55 | +set "omp32dll=%VCToolsRedistDir%\x86\Microsoft.%VCTOOLSET%.OPENMP\vcomp140.dll" |
| 56 | +set "omp64dll=%VCToolsRedistDir%\x64\Microsoft.%VCTOOLSET%.OPENMP\vcomp140.dll" |
| 57 | + |
| 58 | +if not exist "%omp32dll%" ( |
| 59 | + echo vcomp140.dll [x86] not found, make sure to set VCTOOLSET or update this script |
| 60 | + exit /b 1 |
| 61 | +) |
| 62 | +if not exist "%omp64dll%" ( |
| 63 | + echo vcomp140.dll [x64] not found, make sure to set VCTOOLSET or update this script |
| 64 | + exit /b 1 |
| 65 | +) |
| 66 | + |
| 67 | +copy "%omp32dll%" "%builddir%\rel-win32-omp\msdfgen" |
| 68 | +copy "%omp64dll%" "%builddir%\rel-win64-omp\msdfgen" |
| 69 | + |
| 70 | +if not exist "C:\Program Files\7-Zip\7z.exe" ( |
| 71 | + echo 7-Zip not found, you have to package it manually |
| 72 | + exit /b 0 |
| 73 | +) |
| 74 | + |
| 75 | +pushd "%builddir%\rel-win32" |
| 76 | +"C:\Program Files\7-Zip\7z.exe" a "..\msdfgen-%version%-win32.zip" msdfgen |
| 77 | +cd msdfgen |
| 78 | +call example.bat |
| 79 | +popd |
| 80 | +pushd "%builddir%\rel-win32-omp" |
| 81 | +"C:\Program Files\7-Zip\7z.exe" a "..\msdfgen-%version%-win32-openmp.zip" msdfgen |
| 82 | +cd msdfgen |
| 83 | +call example.bat |
| 84 | +popd |
| 85 | +pushd "%builddir%\rel-win64" |
| 86 | +"C:\Program Files\7-Zip\7z.exe" a "..\msdfgen-%version%-win64.zip" msdfgen |
| 87 | +cd msdfgen |
| 88 | +call example.bat |
| 89 | +popd |
| 90 | +pushd "%builddir%\rel-win64-omp" |
| 91 | +"C:\Program Files\7-Zip\7z.exe" a "..\msdfgen-%version%-win64-openmp.zip" msdfgen |
| 92 | +cd msdfgen |
| 93 | +call example.bat |
| 94 | +popd |
| 95 | + |
| 96 | +popd |
0 commit comments