mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-03 22:04:24 +00:00 
			
		
		
		
	.
							parent
							
								
									27d6b87b0b
								
							
						
					
					
						commit
						19d5330f37
					
				
							
								
								
									
										34
									
								
								Build.md
									
									
									
									
									
								
							
							
								
								
								
								
									
									
								
								
								
							
						
						
									
										34
									
								
								Build.md
									
									
									
									
									
								
							@ -4,35 +4,25 @@
 | 
			
		||||
  * GCC 6 or higher
 | 
			
		||||
  * MSVC 2017 or higher (included with VS2017 Build Tools)
 | 
			
		||||
 | 
			
		||||
After installing the required dependencies, clone the repository along with its
 | 
			
		||||
git submodules using:
 | 
			
		||||
`git clone https://github.com/MaskRay/ccls --recursive`
 | 
			
		||||
See [[Getting-started]] for simple cmake build instructions.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
# create a build directory called `release`
 | 
			
		||||
% cmake -H. -Brelease
 | 
			
		||||
 | 
			
		||||
# build
 | 
			
		||||
% cmake --build release
 | 
			
		||||
```
 | 
			
		||||
You may append `-G Ninja -DCMAKE_CXX_LINK_FLAGS=-fuse-ld=lld -DCMAKE_CXX_COMPILER=clang++`
 | 
			
		||||
 | 
			
		||||
[**Windows**] On Windows you have to explicitly tell CMake to target 64-bit
 | 
			
		||||
architecture by adding the `-DCMAKE_GENERATOR_PLATFORM=x64` option to the
 | 
			
		||||
cmake invocation (`cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..`). 32-bit builds 
 | 
			
		||||
are not supported at the moment.
 | 
			
		||||
 | 
			
		||||
This command generates project files for your system's default generator (Linux:
 | 
			
		||||
make, Windows: MSBuild). CMake defaults to a Release build and links ccls
 | 
			
		||||
against the libclang library which it downloads from <https://releases.llvm.org>.
 | 
			
		||||
 | 
			
		||||
## CMake Options
 | 
			
		||||
 | 
			
		||||
* `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)`
 | 
			
		||||
 | 
			
		||||
Default: Release
 | 
			
		||||
Set the build type. The most important ones are Debug and Release.
 | 
			
		||||
 | 
			
		||||
* `-DSYSTEM_CLANG=(ON|OFF)`
 | 
			
		||||
 | 
			
		||||
Default: ON
 | 
			
		||||
Enable `SYSTEM_CLANG` if you want to link ccls against a system installation
 | 
			
		||||
of Clang instead of downloading Clang from releases.llvm.org during the configure process.
 | 
			
		||||
 | 
			
		||||
@ -43,6 +33,7 @@ of Clang instead of downloading Clang from releases.llvm.org during the configur
 | 
			
		||||
 | 
			
		||||
* `-DCLANG_USE_BUNDLED_LIBC++=on`
 | 
			
		||||
 | 
			
		||||
`clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries.
 | 
			
		||||
`libstdc++ >= 5.3` supports `experimental/filesystem`. If your `libstdc++` is old, you can use `libc++` in the bundled clang+llvm archive:
 | 
			
		||||
 | 
			
		||||
```zsh
 | 
			
		||||
@ -79,15 +70,8 @@ cmake --build release
 | 
			
		||||
```
 | 
			
		||||
~/Dev/llvm/release/include/llvm/Config/config.h
 | 
			
		||||
~/Dev/llvm/release/tools/clang/include/clang/Config/config.h
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
% tree ~/Dev/llvm/static-release/lib/ -L 3
 | 
			
		||||
├── clang
 | 
			
		||||
│   └── 7.0.0
 | 
			
		||||
│       ├── include
 | 
			
		||||
│       └── lib
 | 
			
		||||
├── libclang.so -> libclang.so.7
 | 
			
		||||
├── libclang.so.7 -> libclang.so.7.0
 | 
			
		||||
└── libclang.so.7.0
 | 
			
		||||
# libclang
 | 
			
		||||
~/Dev/llvm/release/lib/libclang.so
 | 
			
		||||
# -resource-dir
 | 
			
		||||
~/Dev/llvm/release/lib/clang/7.0.0
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user