This is a script which generates a list of compiler flags from a project with an arbitrary build system. It can be used to:
.ycm_extra_conf.py
file for use with YouCompleteMe
.color_coded
file for use with color_coded
It works by building the project with a fake toolchain, which simply and filters compiler flags to be stored in the resulting file.
It is reasonably fast, taking ~10 seconds to generate a configuration file for the Linux kernel.
This plugin is in maintenance mode. I am happy to merge PRs and triage bug reports, but am not actively working on it.
Add NeoBundle 'rdnetto/YCM-Generator'
to your vimrc (or the equivalent for your plugin manager).
For vim-plug users, add Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'}
to your vimrc.
Alternatively, Arch Linux users can install YCM-Generator using the (unofficial) AUR package.
Run ./config_gen.py PROJECT_DIRECTORY
, where PROJECT_DIRECTORY
is the root directory of your project's build system (i.e. the one containing the root Makefile, etc.)
You can also invoke it from within Vim using the :YcmGenerateConfig
or :CCGenerateConfig
commands to generate a config file for the current directory. These commands accept the same arguments as ./config_gen.py
, but do not require the project directory to be specified (it defaults to the current working directory).
Requirements:
Supported build systems:
Your build system should support specifying the compiler through the CC
/CXX
environment variables, or not use an absolute path to the compiler.
Some flags present in the resulting configuration file may be mutually exclusive with each other - reading the generated file prior to use is recommended.
The script assumes that executables with the names clang
and clang++
exist in your PATH
. This has been known to cause issues under Ubuntu, where the C++ compiler may be called clang++-3.6
(see #50).
./config_gen.py --help
to see the complete list of supported options.ERROR: No commands were logged to the build logs
, try using the --verbose
flag to see any error messages
--preserve-environment
is used--verbose
and a link to the project repo (if possible)Patches are welcome. Please submit pull requests against the develop
branch.
The script is currently supported under Unices (Linux, NixOS[1], BSD, OS X) only.
Implementing Windows support consists of porting the contents of fake-toolchain/Unix
.
If you are interested in implementing/testing this, please open a pull request.
[1] May require --preserve-environment
- see #19
The following projects are used for testing:
Project | Build system | Notes |
---|---|---|
Linux kernel | Kbuild (Make) | |
Vim-qt | Autotools | |
Clementine | Cmake | |
ExtPlane | Qmake | Should be tested with both versions of Qt. |
OpenFOAM | wmake |
YCM-Generator is published under the GNU GPLv3.
Sign in to post a comment
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Repository Comments ( 0 )