vimではないですが同様のことをされていました
バージョン
ubuntu: 19.04
openframeworks: 0.10.1
ドライバとCUDA
プロプライエタリ・ドライバのインストール
ubuntu-drivers devices
でインストールされるドライバを確認
sudo ubuntu-drivers install
でインストール。nvidiaドライバもインストールされる
nvidia driverインストール後注意
nvidiaドライバをインストールした後、下記をコメント解除してから再起動しないと、起動しなくなった
# WaylandEnable=false
これを
WaylandEnable=false
こうする
CUDA
sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev
CUDA ZONEからrunfileをダウンロード
wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run
export CUDA_HOME="/usr/local/cuda"
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/lib:$CUDA_HOME/lib64:$LD_LIBRARY_PATH"
export CPATH="/usr/local/include:$CUDA_HOME/include:$CPATH"
export INCLUDE_PATH="$CUDA_HOME/include"
Vim
gVim
sudo apt update
sudo apt install vim-gtk3
Vundle
vimのプラグイン管理にVundleを使うことにした
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"プラグインはここに追加していく
call vundle#end() " required
filetype plugin indent on " required
YouCompleteMe
sudo apt install build-essential cmake python3-dev
自動補完
下記を追加
...
Plugin 'Valloric/YouCompleteMe'
...
:source %
:PluginInstall
sudo apt install build-essential cmake python3-dev
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clangd-completer
clangd
YouCompleteMeにバンドルされているclangdは更新されていないそうなのでシステムにインストールしたバージョンを使う
sudo apt install clang-tools-8
let g:ycm_clangd_uses_ycmd_caching = 0
let g:ycm_clangd_binary_path = exepath("clangd")
Bear
clangdは completion database、すなわちcompile_commands.jsonを参照して補完してくれる。compile_commands.jsonを作成するためにBearをインストールする
sudo apt install bear
用例 bear make
vim-glsl
glslのシンタックスハイライト
...
Plugin 'tikhomirov/vim-glsl'
...
autocmd! BufNewFile,BufRead *.vs,*.fs,*.glslinc set ft=glsl
:source %
:PluginInstall
glslincファイルもシンタックスハイライトしたい
autocmd! BufNewFile,BufRead *.vs,*.fs,*.glslinc set ft=glsl
その他
clang-format
自動でフォーマットしたい
sudo apt install clang-format
用例として下記
find . -iname *.h -o -iname *.cpp | xargs clang-format -i
openframeworks
解凍したフォルダをof
という名前でホームフォルダに置いた前提で下記読んでください
cd ~of/scripts/linux/ubuntu
sudo ./install_dependencies.sh
sudo ./install_codecs.sh
cd ~of/scripts/linux
./compileOF.sh -j3
例として:NoiseWorkshop
ver0.10で動くように修正してくれている(完全ではないようでした)
cd ~/of/apps
git clone https://github.com/wasawi/NoiseWorkshop.git
cd ~/of/apps/NoiseWorkshop
git checkout update_OF1.0
NoiseWorkshopで使われているアドオン
cd ~/of/addons
git clone https://github.com/kylemcdonald/ofxCv.git
git clone https://github.com/bakercp/ofxIO.git
git clone https://github.com/bakercp/ofxSerial.git
git clone https://github.com/andreasmuller/ofxAutoReloadedShader.git
git clone https://github.com/memo/ofxMSAOpenCL.git
git clone https://github.com/memo/ofxMSAPingPong.git
開発手順
空のプロジェクトをコピー
~/of/myApps/emptyExample
をコピーして好きなプロジェクト名に変える
アドオンの追記
addons.makeに使用するアドオンを改行区切りで入力
過剰だが下記のようにすればNoiseWorkshopすべての例が動く
ofxGui
ofxOpenCv
ofxOsc
ofxCv
ofxPoco
ofxIO
ofxSerial
ofxAutoReloadedShader
ofxKinect
ofxMSAOpenCL
ofxMSAPingPong
bear make
clangdで補完できるように、vimを起動するまえにbear make
する。compile_commands.json
ができる
準備完了!
cd src
gvim ofApp.h