金子邦彦研究室インストールWindows の種々のソフトウェア(インストール)SuiteSparse,gflags,glog,Ceres ソルバ(Ceres Solver)のインストール(ソースコードを使用)(Windows 上)

SuiteSparse,gflags,glog,Ceres ソルバ(Ceres Solver)のインストール(ソースコードを使用)(Windows 上)

Ceres ソルバ(Ceres Solver)は,非線形の最適化の機能をもったソフトウェア.

Ceres Solver (Ceres ソルバ)の利用条件などは、利用者が確認すること

前準備

Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022),Visual Studio 2022 のインストール(Windows 上)

関連する外部ページ

Git のインストール(Windows 上)

Windows での Git のインストール: 別ページ »で説明

関連する外部ページ

Git の公式ページ: https://git-scm.com/

cmake のインストール(Windows 上)

Windows での cmake のインストール: 別ページ »で説明

関連する外部ページ

cmake の公式ダウンロードページ: https://cmake.org/download/

Eigen のインストール

SuiteSparse,Metis のインストール(ソースコードを使用)(Windows 上)

次のページに記載の手順を行う.

https://github.com/jlblancoc/suitesparse-metis-for-windows

前もって,SuiteSparse, Metis をインストールするディレクトリを決めておく

このページでは,いずれも,c:\suitesparse 下にインストールするものとして説明する.

  1. Windows で,コマンドプロンプト管理者として実行.
  2. SuiteSparse の作業ディレクトリを削除する(以前作業したときのものが残っていたら削除したいため)
    c:
    cd c:\
    rmdir /s /q suitesparse-metis-for-windows
    

    [image]
  3. ソースコードをダウンロード,環境変数 SP_ROOTにダウンロードしたディレクトリを設定
    cd c:\
    git clone --recursive https://github.com/jlblancoc/suitesparse-metis-for-windows
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"SP_ROOT\", \"c:\suitesparse-metis-for-windows\", \"Machine\")"
    

    [image]
  4. cmake の実行

    cmake でのオプションについて

    cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019

    cmake の実行手順例は次の通り

    cd c:\
    cd suitesparse-metis-for-windows
    rmdir /s /q build
    mkdir build
    cd build
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DBUILD_SHARED_LIBS=ON ^
         -DCMAKE_INSTALL_PREFIX="C:/suitesparse" 
    

    [image]
  5. 実行結果の確認

    エラーメッセージが出ていないこと.

    [image]
  6. インストールの実行
    cmake --build . --config RELEASE
    cmake --build . --config RELEASE --target INSTALL
    
  7. 実行結果の確認

    [image]
  8. Windowsシステム環境変数 Pathに,次を追加することにより,パスを通す

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  9. 次のコマンドを実行
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\lib\lapack_blas_windows\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\lib\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    

    [image]
  10. Windowsシステム環境変数 SUITESPARSE_ROOT に,c:\suitesparse を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  11. 次のコマンドを実行
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"SUITESPARSE_ROOT\", \"c:\suitesparse\", \"Machine\")"
    
  12. Windowsシステム環境変数 METIS_ROOT に,c:\suitesparse を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  13. 次のコマンドを実行
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"METIS_ROOT\", \"c:\suitesparse\", \"Machine\")"
    

gflags, glog, Ceres ソルバ(Ceres Solver)のインストール(ソースコードを使用)(Windows 上)

gflags のインストール(ソースコードを使用)(Windows 上)

  1. Windows で,コマンドプロンプト管理者として実行.
  2. gflags のインストール

    gflags の GitHub のページ: https://github.com/gflags/gflags

    cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019

    C:
    cd %HOMEPATH%
    rmdir /s /q gflags
    git clone https://github.com/gflags/gflags
    cd gflags
    rmdir /s /q a
    mkdir a
    cd a
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DCMAKE_INSTALL_PREFIX="C:/gflags" ^
        -DBUILD_STATIC_LIBS=ON ^
        -DBUILD_SHARED_LIBS=ON 
    cmake --build . --config RELEASE
    cmake --build . --config RELEASE --target INSTALL
    

    エラーメッセージが出ていないことを確認

    [image]
  3. Windowsシステム環境変数 GFLAGS_ROOT に,c:\gflags-solver を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  4. 次のコマンドを実行
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"GFLAGS_ROOT\", \"c:\gflags\", \"Machine\")"
    

    [image]

glog のインストール(ソースコードを使用)(Windows 上)

glog のインストールの前に,gflags のインストールが終わっていること.

  1. Windows で,コマンドプロンプト管理者として実行.
  2. glog のインストール

    glog の GitHub のページ: https://github.com/google/glog

    cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019

    C:
    cd %HOMEPATH%
    rmdir /s /q glog
    git clone https://github.com/google/glog
    cd glog
    rmdir /s /q build
    mkdir build
    cd build
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DCMAKE_INSTALL_PREFIX="C:/glog" 
    cmake --build . --config RELEASE
    cmake --build . --config RELEASE --target INSTALL
    

    エラーメッセージが出ていないことを確認

    [image]
  3. Windowsシステム環境変数 GLOG_ROOT に,c:\glog を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  4. 次のコマンドを実行
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"GLOG_ROOT\", \"c:\glog\", \"Machine\")"
    

[image]

Ceres ソルバ(Ceres Solver)のインストール(ソースコードを使用)(Windows 上)

次のページに記載の手順を行う.

http://ceres-solver.org/installation.html

前もって,Ceres ソルバ(Ceres Solver)をインストールするディレクトリを決めておく

このページでは,c:\ceres 下にインストールするものとして説明する.

  1. Windows で,コマンドプロンプト管理者として実行.
  2. Ceres ソルバ(Ceres Solver)の作業ディレクトリを削除する(以前作業したときのものが残っていたら削除したいため)
    C:
    cd %HOMEPATH%
    rmdir /s /q ceres-solver
    

    [image]
  3. Ceres ソルバ(Ceres Solver)のバージョンの確認

    次のページで確認

    https://github.com/ceres-solver/ceres-solver/tags

  4. Ceres ソルバ(Ceres Solver)のソースコードをダウンロード

    「-b 2.1.0」でバージョン指定している.

    cd %HOMEPATH%
    git clone --recursive -b 2.1.0 https://github.com/ceres-solver/ceres-solver
    

    [image]
  5. cmake の実行

    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 ceres-solver
    rmdir /s /q a
    mkdir a
    cd a
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DCMAKE_INSTALL_PREFIX="C:/ceres-solver" ^
        -DBUILD_SHARED_LIBS=ON ^
        -Dglog_DIR="C:/glog" ^
        -Dgflags_DIR="C:/gflags" ^
        -DBLAS_openblas_LIBRARY="C:/OpenBLAS/lib/openblas.lib" ^
        -DSuiteSparse_DIR="C:/suitesparse" ^
        -DMETIS_INCLUDE_DIR="C:/suitesparse/include" ^
        -DMETIS_LIBRARY="C:/suitesparse/lib/metis.lib" ^
        -DCXSparse_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DCXSparse_LIBRARY="C:/suitesparse/lib/libcxsparse.lib" ^
        -DSuiteSparse_AMD_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_CAMD_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_CCOLAMD_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_CHOLMOD_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_COLAMD_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_Config_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_SPQR_INCLUDE_DIR="C:/suitesparse/include/suitesparse" ^
        -DSuiteSparse_AMD_LIBRARY="C:/suitesparse/lib/libamd.lib" ^
        -DSuiteSparse_CAMD_LIBRARY="C:/suitesparse/lib/libcamd.lib" ^
        -DSuiteSparse_CCOLAMD_LIBRARY="C:/suitesparse/lib/libccolamd.lib" ^
        -DSuiteSparse_CHOLMOD_LIBRARY="C:/suitesparse/lib/libcholmod.lib" ^
        -DSuiteSparse_COLAMD_LIBRARY="C:/suitesparse/lib/libcolamd.lib" ^
        -DSuiteSparse_Config_LIBRARY="C:/suitesparse/lib/suitesparseconfig.lib" ^
        -DSuiteSparse_SPQR_LIBRARY="C:/suitesparse/lib/libspqr.lib" 
    

    [image]
  6. 実行結果の確認

    エラーメッセージが出ていないこと.

    [image]
  7. インストールの実行
    cmake --build . --config RELEASE
    cmake --build . --config RELEASE --target INSTALL
    
  8. 実行結果の確認

    エラーメッセージが出ていないこと.

    [image]
  9. Windowsシステム環境変数 CERES_ROOT に,c:\ceres-solver を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  10. 次のコマンドを実行
    call powershell -command "[System.Environment]::SetEnvironmentVariable(\"CERES_ROOT\", \"c:\ceres-solver\", \"Machine\")"
    

    [image]
  11. Windowsシステム環境変数 Pathに,次を追加することにより,パスを通す

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  12. 次のコマンドを実行
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\gflags\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\glog\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\ceres-solver\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    call powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\ceres-solver\lib\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    

    [image]