2020/8/17

build CMake

18.04 的 cmake 是 3.10.2
在 cuda version 大於 10.2(?) 之後,會出現 CUDA_cublas 找步道的問題。
所以要手動安裝 大於 3.14 的 cmake

那就從 source checkout 開始吧..

cmake 的 source 放在gitlab。下面剛好就是 build instruction..
目標是build 出執行檔,然後放在local (PATH 順序)

checkout 最新的 release v3.18,follow 說明,先 run bootstrap 看說明..
charles-chang@penguin1:~/githubgitlab/cmake$ ./bootstrap --help

Usage: ./bootstrap [<options>...] [-- <cmake-options>...]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
  --version               only print version information
  --verbose               display more information
  --parallel=n            bootstrap cmake in parallel, where n is
                          number of nodes [1]
  --generator=<generator> generator to use (MSYS Makefiles, Unix Makefiles,
                          or Ninja)
  --enable-ccache         Enable ccache when building cmake
  --init=FILE             load FILE as script to populate cache
  --system-libs           use all system-installed third-party libraries
                          (for use only by package maintainers)
  --no-system-libs        use all cmake-provided third-party libraries
                          (default)
  --system-curl           use system-installed curl library
  --no-system-curl        use cmake-provided curl library (default)
  --system-expat          use system-installed expat library
  --no-system-expat       use cmake-provided expat library (default)
  --system-jsoncpp        use system-installed jsoncpp library
  --no-system-jsoncpp     use cmake-provided jsoncpp library (default)
  --system-zlib           use system-installed zlib library
  --no-system-zlib        use cmake-provided zlib library (default)
  --system-bzip2          use system-installed bzip2 library
  --no-system-bzip2       use cmake-provided bzip2 library (default)
  --system-liblzma        use system-installed liblzma library
  --no-system-liblzma     use cmake-provided liblzma library (default)
  --system-nghttp2        use system-installed nghttp2 library
  --no-system-nghttp2     use cmake-provided nghttp2 library (default)
  --system-zstd           use system-installed zstd library
  --no-system-zstd        use cmake-provided zstd library (default)
  --system-libarchive     use system-installed libarchive library
  --no-system-libarchive  use cmake-provided libarchive library (default)
  --system-librhash       use system-installed librhash library
  --no-system-librhash    use cmake-provided librhash library (default)
  --system-libuv          use system-installed libuv library
  --no-system-libuv       use cmake-provided libuv library (default)

  --bootstrap-system-libuv use system-installed libuv library for bootstrap
  --bootstrap-system-jsoncpp use system-installed jsoncpp library for bootstrap
  --bootstrap-system-librhash use system-installed librhash library for bootstrap

  --qt-gui                build the Qt-based GUI (requires Qt >= 4.2)
  --no-qt-gui             do not build the Qt-based GUI (default)
  --qt-qmake=<qmake>      use <qmake> as the qmake executable to find Qt

  --sphinx-info           build Info manual with Sphinx
  --sphinx-man            build man pages with Sphinx
  --sphinx-html           build html help with Sphinx
  --sphinx-qthelp         build qch help with Sphinx
  --sphinx-build=<sb>     use <sb> as the sphinx-build executable
  --sphinx-flags=<flags>  pass <flags> to sphinx-build executable

Directory and file names:
  --prefix=PREFIX         install files in tree rooted at PREFIX
                          [/usr/local]
  --bindir=DIR            install binaries in PREFIX/DIR
                          [bin]
  --datadir=DIR           install data files in PREFIX/DIR
                          [share/cmake-3.18]
  --docdir=DIR            install documentation files in PREFIX/DIR
                          [doc/cmake-3.18]
  --mandir=DIR            install man pages files in PREFIX/DIR/manN
                          [man]
  --xdgdatadir=DIR        install XDG specific files in PREFIX/DIR
只有要改 install path 而已,所以...
$./bootstrap --prefix=/home/charles-chang/cmaketool
...
...
$ make
...
$ make install

寫一個 addcmake18path.sh:
#!/bin/bash
export CMAKE_ROOT=/home/charles-chang/cmaketool
export PATH="/home/charles-chang/cmaketool/bin:$PATH"
要用 3.18 舊先 source ..


其他

原來 Caffe 也有 cmake,source folder 有 CMakeList.txt
所以可以follow 標準..
mkdir build && cd build
cmake ..
make 

沒有留言:

張貼留言