Skip to content

Commit e4927d2

Browse files
committed
cmake: delete SYSTEM_CLANG and auto-download mechanism
1 parent 216d8c1 commit e4927d2

9 files changed

+2
-253
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ install:
1515
- 7z x llvm.tar
1616
- git submodule update --init --recursive
1717
build_script:
18-
- cmake -G"Visual Studio 15 2017 Win64" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DSYSTEM_CLANG=ON -DCLANG_ROOT=C:\projects\ccls\llvm+clang-7.0.0-win64-msvc-release
18+
- cmake -G"Visual Studio 15 2017 Win64" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:\projects\ccls\llvm+clang-7.0.0-win64-msvc-release
1919
- cmake --build build --target ccls --config Release
2020

2121
artifacts:

CMakeLists.txt

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
55
include(DefaultCMakeBuildType)
66

77
# Required Clang version
8-
set(CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}
9-
CACHE STRING "Downloaded Clang location")
10-
option(SYSTEM_CLANG "Use system installation of Clang instead of \
11-
downloading Clang" OFF)
12-
option(ASAN "Compile with address sanitizers" OFF)
138
option(LLVM_ENABLE_RTTI "-fno-rtti if OFF. This should match LLVM libraries" OFF)
14-
option(CLANG_USE_BUNDLED_LIBC++ "Let Clang use bundled libc++" OFF)
159
option(USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF)
1610

1711
# Sources for the executable are specified at end of CMakeLists.txt
@@ -30,10 +24,7 @@ add_executable(ccls "")
3024
# Enable C++17 (Required)
3125
set_property(TARGET ccls PROPERTY CXX_STANDARD 17)
3226
set_property(TARGET ccls PROPERTY CXX_STANDARD_REQUIRED ON)
33-
# Disable gnu extensions except for Cygwin which needs them to build properly
34-
if(NOT CYGWIN)
35-
set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF)
36-
endif()
27+
set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF)
3728

3829
if(NOT LLVM_ENABLE_RTTI)
3930
# releases.llvm.org libraries are compiled with -fno-rtti
@@ -76,37 +67,6 @@ else()
7667
target_compile_options(ccls PRIVATE
7768
$<$<CONFIG:Debug>:-fno-limit-debug-info>)
7869
endif()
79-
80-
if(ASAN)
81-
target_compile_options(ccls PRIVATE -fsanitize=address,undefined)
82-
# target_link_libraries also takes linker flags
83-
target_link_libraries(ccls PRIVATE -fsanitize=address,undefined)
84-
endif()
85-
endif()
86-
87-
### Download Clang if required
88-
89-
if(NOT SYSTEM_CLANG)
90-
message(STATUS "Using downloaded Clang")
91-
92-
include(DownloadAndExtractClang)
93-
download_and_extract_clang(${CLANG_DOWNLOAD_LOCATION})
94-
# Used by FindClang
95-
set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR})
96-
97-
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang AND CLANG_USE_BUNDLED_LIBC++)
98-
message(STATUS "Using bundled libc++")
99-
target_compile_options(ccls PRIVATE -nostdinc++ -cxx-isystem ${CLANG_ROOT}/include/c++/v1)
100-
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
101-
# Don't use -stdlib=libc++ because while ccls is linked with libc++, bundled clang+llvm require libstdc++
102-
target_link_libraries(ccls PRIVATE -L${CLANG_ROOT}/lib c++ c++abi)
103-
104-
# FreeBSD defaults to -stdlib=libc++ and uses system libcxxrt.a
105-
endif()
106-
endif()
107-
108-
else()
109-
message(STATUS "Using system Clang")
11070
endif()
11171

11272
### Libraries
@@ -143,31 +103,6 @@ target_include_directories(ccls SYSTEM PRIVATE
143103

144104
install(TARGETS ccls RUNTIME DESTINATION bin)
145105

146-
if(NOT SYSTEM_CLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
147-
148-
if(${CMAKE_SYSTEM_NAME} MATCHES Linux|FreeBSD)
149-
set_property(TARGET ccls APPEND PROPERTY
150-
INSTALL_RPATH $ORIGIN/../lib)
151-
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
152-
set_property(TARGET ccls APPEND PROPERTY
153-
INSTALL_RPATH @loader_path/../lib)
154-
endif()
155-
156-
file(GLOB LIBCLANG_PLUS_SYMLINKS
157-
${DOWNLOADED_CLANG_DIR}/lib/libclang.[so,dylib]*)
158-
install(FILES ${LIBCLANG_PLUS_SYMLINKS} DESTINATION lib)
159-
endif()
160-
161-
# Allow running from build Windows by copying libclang.dll to build directory
162-
if(NOT SYSTEM_CLANG AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
163-
add_custom_command(TARGET ccls
164-
POST_BUILD
165-
COMMAND ${CMAKE_COMMAND} -E copy
166-
${DOWNLOADED_CLANG_DIR}/bin/libclang.dll
167-
$<TARGET_FILE_DIR:ccls>
168-
COMMENT "Copying libclang.dll to build directory ...")
169-
endif()
170-
171106
### Tools
172107

173108
# We use glob here since source files are already manually added with

clang_archive_hashes/LLVM-7.0.0-win64.exe.SHA256

Lines changed: 0 additions & 1 deletion
This file was deleted.

clang_archive_hashes/clang+llvm-7.0.0-amd64-unknown-freebsd11.tar.xz.SHA256

Lines changed: 0 additions & 1 deletion
This file was deleted.

clang_archive_hashes/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz.SHA256

Lines changed: 0 additions & 1 deletion
This file was deleted.

clang_archive_hashes/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz.SHA256

Lines changed: 0 additions & 1 deletion
This file was deleted.

clang_archive_hashes/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz.SHA256

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmake/DownloadAndExtract7zip.cmake

Lines changed: 0 additions & 52 deletions
This file was deleted.

cmake/DownloadAndExtractClang.cmake

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)