beginnings. Now the video can be played correctly. feat(build): add build script for Windows.
60 lines
2.4 KiB
Batchfile
60 lines
2.4 KiB
Batchfile
@echo off
|
|
rem =====================================================================
|
|
rem build-win.bat - Build the project on Windows (MSYS2 UCRT64 + MinGW).
|
|
rem
|
|
rem Builds build\hatsune-miku-shoshitsu.exe and build\hatsune-miku-demo.exe
|
|
rem
|
|
rem Requirements (install once with MSYS2's pacman, using a proxy if needed):
|
|
rem pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-libs ^
|
|
rem mingw-w64-ucrt-x86_64-ffmpeg mingw-w64-ucrt-x86_64-cmake
|
|
rem
|
|
rem The FFmpeg dev libraries must be installed together with the gcc
|
|
rem toolchain (FFmpeg 9 needs newer gcc-libs than a stock older gcc).
|
|
rem =====================================================================
|
|
setlocal EnableDelayedExpansion
|
|
|
|
set "SCRIPT_DIR=%~dp0"
|
|
cd /d "%SCRIPT_DIR%"
|
|
|
|
rem ---- locate the MSYS2 UCRT64 toolchain ----------------------------------
|
|
rem (note: an inherited MSYS2_ROOT env var is respected; don't pre-set it here
|
|
rem to empty, or "if not defined" below would never match)
|
|
if not defined MSYS2_ROOT if exist "D:\SDKs\msys64\ucrt64\bin\g++.exe" set "MSYS2_ROOT=D:\SDKs\msys64"
|
|
if not defined MSYS2_ROOT if exist "C:\msys64\ucrt64\bin\g++.exe" set "MSYS2_ROOT=C:\msys64"
|
|
if not defined MSYS2_ROOT (
|
|
echo [build-win] MSYS2 UCRT64 not found.
|
|
echo Set the MSYS2_ROOT environment variable, e.g.:
|
|
echo set MSYS2_ROOT=D:\SDK\msys64
|
|
exit /b 1
|
|
)
|
|
set "PATH=%MSYS2_ROOT%\ucrt64\bin;%PATH%"
|
|
echo [build-win] MSYS2 UCRT64 : %MSYS2_ROOT%
|
|
|
|
rem ---- sanity checks --------------------------------------------------------
|
|
where cmake.exe >nul 2>&1 || (
|
|
echo [build-win] cmake not found. Install mingw-w64-ucrt-x86_64-cmake.
|
|
exit /b 1
|
|
)
|
|
pkg-config --exists libavformat || (
|
|
echo [build-win] FFmpeg dev libraries not found.
|
|
echo Install mingw-w64-ucrt-x86_64-ffmpeg.
|
|
exit /b 1
|
|
)
|
|
|
|
rem ---- configure + build ----------------------------------------------------
|
|
cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
|
|
if errorlevel 1 exit /b 1
|
|
|
|
cmake --build build -j
|
|
if errorlevel 1 exit /b 1
|
|
|
|
echo.
|
|
echo [build-win] Done.
|
|
echo %SCRIPT_DIR%build\hatsune-miku-shoshitsu.exe
|
|
echo %SCRIPT_DIR%build\hatsune-miku-demo.exe
|
|
echo.
|
|
echo Run with the MSYS2 UCRT64 bin dir on PATH so the FFmpeg DLLs resolve:
|
|
echo set PATH=%MSYS2_ROOT%\ucrt64\bin;%%PATH%%
|
|
echo build\hatsune-miku-shoshitsu.exe --video ^<file^> --audio ^<file^> --lyrics ^<file^>
|
|
exit /b 0
|