Windows で,liblz4 最新版をソースコードからビルドして,インストールする手順を説明する.Build Tools for Visual Studio 2022(ビルドツール for Visual Studio 2022)を使用する.
【目次】
利用条件などは、利用者が確認すること
【サイト内の関連ページ】
Windows での Git のインストール: 別ページ »で説明
【関連する外部ページ】
Git の公式ページ: https://git-scm.com/
【サイト内の関連ページ】
Windows での cmake のインストール: 別ページ »で説明
【関連する外部ページ】
cmake の公式ダウンロードページ: https://cmake.org/download/
Windows での Visual Studio Community 2022 のインストール: 別ページ »で説明
Visual Studio Community 2022 に, Build Tools for Visual Studio 2022の機能が含まれている.
Windows での Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022) のインストール: 別ページ »で説明
【関連する外部ページ】
コマンドプロンプトを管理者として実行: 別ページ »で説明
C: cd %HOMEPATH% rmdir /s /q lz4
cd %HOMEPATH% git clone https://github.com/lz4/lz4
cmake でのオプションについて
cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019」
cmake の実行手順例は次の通り
cd %HOMEPATH% cd lz4\build\cmake rmdir /s /q build mkdir build cd build del CMakeCache.txt cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^ -DCMAKE_INSTALL_PREFIX="c:/lz4"
※ 下の通りになるとは限らない.エラーメッセージが出るなど場合は,前で cmake を実行したときの設定を変えてやり直す.
cmake --build . --config RELEASE cmake --build . --config RELEASE --target INSTALL
次のコマンドを実行
call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\lz4\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
次のコマンドを実行
call powershell -command "[System.Environment]::SetEnvironmentVariable(\"LIBLZ4_ROOT\", \"C:\lz4\", \"Machine\")"
次のコマンドを実行
call powershell -command "[System.Environment]::SetEnvironmentVariable(\"LZ4_INCLUDE_DIRS\", \"c:\lz4\include\", \"Machine\")"