介紹如何從原始碼自行編譯並安裝 OpenImageIO 影像讀寫函式庫。
安裝 CMake
首先下載、編譯並安裝最新版的 CMake:
# 下載、編譯、安裝 CMake wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz tar zxvf cmake-3.17.3.tar.gz cd cmake-3.17.3 ./configure make -j8 && sudo make install
安裝編譯用系統套件
安裝一些編譯 OpenImageIO 所需的系統套件:
# 安裝必要套件 sudo apt install libboost-all-dev libjpeg-dev libtiff-dev libpng-dev # 安裝選用套件 sudo apt install libopenexr-dev libtiff5-dev libopenvdb-dev \ libdcmtk-dev libopenjp2-7-dev libraw-dev libtbb-dev ffmpeg \ libturbojpeg0-dev libbz2-dev libfreetype6-dev \ libopencolorio-dev libopencv-dev libgif-dev \ libwebp-dev libsquish-dev # 安裝 QT 套件 sudo apt install qtbase5-dev libqt5opengl5-dev
編譯與安裝 OpenImageIO
從 OpenImageIO 的 GitHub 下載原始碼:
# 下載 OpenImageIO 原始碼
git clone https://github.com/OpenImageIO/oiio.git
先安裝 pybind11
:
# 安裝 pybind11 cd oiio/ bash src/build-scripts/build_pybind11.bash
編譯並安裝 OpenImageIO:
# 編譯 OpenImageIO make INSTALL_PREFIX=/opt/OpenImageIO # 安裝 OpenImageIO sudo make install