在Ubuntu操作系统中,使用vim编辑器进行openframeworks开发
虽然不是使用vim,但是做了类似的事情。
版本
Ubuntu: 19.04
OpenFrameworks: 0.10.1
Ubuntu:19.04
OpenFrameworks:0.10.1
驱动程序和CUDA
安装专有驱动程序。
ubuntu-drivers devices
确认安装的驱动程序
sudo ubuntu-drivers install
安装时会同时安装NVIDIA驱动。
英伟达驱动程序的安装后需要注意的事项。
安装完Nvidia驱动后,如果不取消下面的注释并重新启动,系统将无法正常启动。
#WaylandEnable=false
这个
WaylandEnable=false
这样做
CUDA是一个由NVIDIA开发的并行计算平台和应用程序编程接口。
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"
威姆
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
你完善了自己
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")
熊
clangd可以引用完成数据库,即compile_commands.json文件来提供补全功能。为了创建compile_commands.json文件,需要安装Bear。
sudo apt install bear
熊制造使用案例
维格编辑器-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
打开框架
假设你已经在主文件夹中用名为”of”的名称放置了解压后的文件夹,请阅读下面的内容。
cd ~of/scripts/linux/ubuntu
sudo ./install_dependencies.sh
sudo ./install_codecs.sh
cd ~of/scripts/linux
./compileOF.sh -j3
作为一个例子:噪声工作室
我們修正了它能在 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
熊制造
在启动vim之前,使用bear make来生成compile_commands.json,以便能够在clangd中进行补全。
准备好了!
cd src
gvim ofApp.h