Last active
March 9, 2024 03:08
-
-
Save t-mat/c0de3b35fb92675bffa7c6181c5b0fa8 to your computer and use it in GitHub Desktop.
Build JPEG XL with VC++2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@rem Build JpegXL for Windows x64 Desktop, VC++2019 | |
@setlocal enabledelayedexpansion | |
@echo off | |
pushd . | |
set /a errorno=1 | |
set "TAG=v0.10.2" | |
git --version || echo "git" not found && goto :ERROR | |
rem | |
rem Set Visual C++ environment for Windows, desktop, x64. | |
rem | |
rem https://github.com/Microsoft/vswhere | |
rem https://github.com/microsoft/vswhere/wiki/Find-VC#batch | |
rem | |
set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" | |
if not exist "%vswhere%" ( | |
echo Can't find "vswhere.exe". Please install the latest version of Visual Studio. | |
goto :ERROR | |
) | |
set "InstallDir=" | |
for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( | |
set "InstallDir=%%i" | |
) | |
if "%InstallDir%" == "" ( | |
echo Can't find Visual C++. Please install the latest version of Visual C++. | |
goto :ERROR | |
) | |
rem Set -no_logo | |
rem For details, see %InstallDir%\Common7\Tools\vsdevcmd\core\parse_cmd.bat | |
set __VSCMD_ARG_NO_LOGO=1 | |
rem Disable warning C4244, C4267 C4806, C4305 | |
set "_CL_=/utf-8 /wd4244 /wd4267 /wd4305 /wd4806 /I%CD%/libjxl/lib/include" | |
echo call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" | |
call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" || goto :ERROR | |
msbuild -version || goto : ERROR | |
rem Clone repo | |
if not exist "libjxl" ( | |
git clone -q --depth=1 --branch=%TAG% https://github.com/libjxl/libjxl.git || goto :ERROR | |
) | |
cd libjxl || goto :ERROR | |
if not exist "third_party\googletst\README.md" ( | |
git submodule update --init --recursive || goto :ERROR | |
) | |
rem Build | |
if not exist build ( mkdir build ) | |
cd build || goto :ERROR | |
cmake .. -A x64 -DBUILD_TESTING=OFF -DCXX_FUZZERS_SUPPORTED=OFF -DJPEGXL_ENABLE_DEVTOOLS=OFF -DJPEGXL_ENABLE_FUZZERS=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_STATIC=ON || goto :ERROR | |
msbuild LIBJXL.sln /nologo /v:minimal /m /p:Configuration=Release /p:Platform=x64 /t:Clean,Build || goto :ERROR | |
echo. | |
echo All .lib files are in %CD%\lib\Release\*.lib | |
echo. | |
echo Build Status - SUCCEEDED | |
set /a errorno=0 | |
goto :END | |
:ERROR | |
echo Abort by error. | |
echo Build Status - ERROR | |
:END | |
popd | |
exit /B %errorno% |
Author
t-mat
commented
Mar 29, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment