Windows で,VTK 最新版をソースコードからビルドして,インストールする手順をスクリーンショット等で説明する. Build Tools for Visual Studio 2022(ビルドツール for Visual Studio 2022)を使用する.
【目次】
VTK の利用条件などは、利用者が確認すること。次のWeb ページを活用してください
https://github.com/Kitware/VTK
謝辞
VTK の作者に感謝します
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) のインストール: 別ページ »で説明
【関連する外部ページ】
Windows での Git のインストール: 別ページ »で説明
【関連する外部ページ】
Git の公式ページ: https://git-scm.com/
Windows での cmake のインストール: 別ページ »で説明
【関連する外部ページ】
cmake の公式ダウンロードページ: https://cmake.org/download/
OpenBLAS と連携させたいときは、前もって OpenBLAS をインストールしておく
起動は,Windows のメニューで「Visual Studio 20..」の下の「x64 Native Tools コマンドプロンプト (x64 Native Tools Command Prompt)」を選ぶ.「x64」は,64ビット版の意味である.
「x64 Native Tools コマンドプロンプト (x64 Native Tools Command Prompt)」がないとき:
C++ ビルドツール (Build Tools) のインストールを行うことで, 「x64 Native Tools コマンドプロンプト (x64 Native Tools Command Prompt)」がインストールされる.その手順は,別ページ »で説明
cd %LOCALAPPDATA% rmdir /s /q VTK
cd %LOCALAPPDATA% git clone --recursive https://github.com/Kitware/VTK
cmake でのオプションについて
cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 17 2022」
cmake の実行手順例は次の通り
cd %LOCALAPPDATA% cd VTK 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:\VTK" ^ ..
※ 下図のとおりになるとは限らない.うまくいっていない場合は、1つ上の「cmake の実行」のところを、設定を変えてやり直す.
cmake --build . --config RELEASE cmake --build . --config RELEASE --target INSTALL
エラーメッセージが出ていないことを確認.最後のほうに「0 エラー」のように表示されるのを確認.
※ 黄色の警告メッセージは無視しても良い
コマンドプロンプトを管理者として実行: 別ページ »で説明
call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\VTK\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
コマンドプロンプトを管理者として実行: 別ページ »で説明
call powershell -command "[System.Environment]::SetEnvironmentVariable(\"VTK_DIR\", \"c:\VTK\", \"Machine\")"