Created Getting started (markdown)

Fangrui Song 2018-03-31 17:42:35 -07:00
parent 92590449a4
commit 3a0d6c6ac4

56
Getting-started.md Normal file

@ -0,0 +1,56 @@
### Outline
1. Build ccls / prebuilt binary (below)
2. Setup your editor [[Editor configuration]]
3. Project setup: generate `compile_commands.json` or `.ccls`
### Build the language server
Detailed instructions at [[Build (Waf)]] and [[Build (CMake)]].
```bash
1 $ git clone https://github.com/ccls-project/ccls --single-branch --depth=1
2 $ cd ccls
3 $ git submodule update --init && ./waf configure build # --variant=debug if you want to report issues.
```
If syncing, only `3` needs to be rerun.
The executable is at `build/release/bin/ccls`.
There are also prebuilt binaries on <https://github.com/ccls-project/ccls/releases>. "Source code" tarballs do not include submodules and do not build by themselves.
If you come across crashes, **please [[build with --variant=debug|Build (Waf)]] and report issues with detailed stack trace**.
### Project setup
#### [[compile_commands.json]] (Best)
Remember to copy/symlink it to the project root.
#### `.ccls`
Another way is to create a file named `.ccls` located in the project root. ccls recursively finds source files and indexes them. `.ccls` can also exist in subdirectories which will affect the options in its subtree. *Notice* If you use emacs-ccls, read the document of `ccls-project-root-matchers` to locate the project root correctly.
If `%clang` is used, it expands to `clang/clang++` according to the extension name. Prefix options with `%c ` or `%cpp ` to make it specific to C or C++.
Example `.ccls`:
```
%clang
%c -std=gnu11
%cpp -std=gnu++14
-pthread
# Includes
-I/work/ccls/third_party
-I/work/ccls/another_third_party
# -I space_is_not_allowed
```
Note:
`.ccls` does not do `word` splitting or `command` substitution for you,
you cannot use `` `command` `` or space-separated arguments like `%cpp -std=gnu++14 -pthread`
### Windows
`-fms-extensions -fms-compatibility -fdelayed-template-parsing` in clang-cl mode.