mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-21 15:15:07 +00:00
cmake: for -DSYSTEM_CLANG=off, 6.0.0 -> 6.0.1
This commit is contained in:
parent
1c0bf0af65
commit
af881dff18
149
CMakeLists.txt
149
CMakeLists.txt
@ -5,7 +5,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
||||
include(DefaultCMakeBuildType)
|
||||
|
||||
# Required Clang version
|
||||
set(CLANG_VERSION 6.0.0 CACHE STRING "Clang version")
|
||||
set(CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}
|
||||
CACHE STRING "Downloaded Clang location")
|
||||
option(SYSTEM_CLANG "Use system installation of Clang instead of \
|
||||
@ -42,18 +41,20 @@ target_compile_options(ccls PRIVATE -fno-rtti)
|
||||
if(MSVC)
|
||||
# Common MSVC/Clang(Windows) options
|
||||
target_compile_options(ccls PRIVATE
|
||||
/nologo
|
||||
/EHsc
|
||||
/W3 # roughly -Wall
|
||||
/wd4996 # disable loguru unsafe warnings
|
||||
/wd4722 # ignores warning C4722
|
||||
# (destructor never returns) in loguru
|
||||
/wd4267 # ignores warning C4267
|
||||
# (conversion from 'size_t' to 'type'),
|
||||
# roughly -Wno-sign-compare
|
||||
/wd4800
|
||||
$<$<CONFIG:Debug>:/FS>
|
||||
)
|
||||
/nologo
|
||||
/EHsc
|
||||
/D_CRT_SECURE_NO_WARNINGS # don't try to use MSVC std replacements
|
||||
/W3 # roughly -Wall
|
||||
/wd4996 # disable loguru unsafe warnings
|
||||
/wd4722 # ignores warning C4722
|
||||
# (destructor never returns) in loguru
|
||||
/wd4267 # ignores warning C4267
|
||||
# (conversion from 'size_t' to 'type'),
|
||||
# roughly -Wno-sign-compare
|
||||
/wd4800
|
||||
/wd4068 # Disable unknown pragma warning
|
||||
$<$<CONFIG:Debug>:/FS>
|
||||
)
|
||||
else()
|
||||
# Common GCC/Clang(Linux) options
|
||||
target_compile_options(ccls PRIVATE
|
||||
@ -83,7 +84,7 @@ if(NOT SYSTEM_CLANG)
|
||||
message(STATUS "Using downloaded Clang")
|
||||
|
||||
include(DownloadAndExtractClang)
|
||||
download_and_extract_clang(${CLANG_VERSION} ${CLANG_DOWNLOAD_LOCATION})
|
||||
download_and_extract_clang(${CLANG_DOWNLOAD_LOCATION})
|
||||
# Used by FindClang
|
||||
set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR})
|
||||
|
||||
@ -105,7 +106,7 @@ endif()
|
||||
### Libraries
|
||||
|
||||
# See cmake/FindClang.cmake
|
||||
find_package(Clang ${CLANG_VERSION} REQUIRED)
|
||||
find_package(Clang 6.0.0)
|
||||
target_link_libraries(ccls PRIVATE Clang::Clang)
|
||||
|
||||
# Enable threading support
|
||||
@ -136,7 +137,6 @@ target_include_directories(ccls SYSTEM PRIVATE
|
||||
|
||||
install(TARGETS ccls RUNTIME DESTINATION bin)
|
||||
|
||||
# TODO: install libclang.dll on Windows as well
|
||||
if(NOT SYSTEM_CLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES Linux|FreeBSD)
|
||||
@ -174,63 +174,64 @@ file(GLOB SOURCES src/*.cc src/*.h src/serializers/*.cc src/serializers/*.h
|
||||
target_sources(ccls PRIVATE third_party/siphash.cc)
|
||||
|
||||
target_sources(ccls PRIVATE
|
||||
src/clang_complete.cc
|
||||
src/clang_tu.cc
|
||||
src/clang_utils.cc
|
||||
src/config.cc
|
||||
src/file_consumer.cc
|
||||
src/filesystem.cc
|
||||
src/fuzzy_match.cc
|
||||
src/main.cc
|
||||
src/include_complete.cc
|
||||
src/indexer.cc
|
||||
src/method.cc
|
||||
src/language.cc
|
||||
src/log.cc
|
||||
src/lsp.cc
|
||||
src/match.cc
|
||||
src/message_handler.cc
|
||||
src/pipeline.cc
|
||||
src/platform_posix.cc
|
||||
src/platform_win.cc
|
||||
src/position.cc
|
||||
src/project.cc
|
||||
src/query_utils.cc
|
||||
src/query.cc
|
||||
src/serializer.cc
|
||||
src/test.cc
|
||||
src/utils.cc
|
||||
src/working_files.cc)
|
||||
src/clang_complete.cc
|
||||
src/clang_tu.cc
|
||||
src/clang_utils.cc
|
||||
src/config.cc
|
||||
src/file_consumer.cc
|
||||
src/filesystem.cc
|
||||
src/fuzzy_match.cc
|
||||
src/main.cc
|
||||
src/include_complete.cc
|
||||
src/indexer.cc
|
||||
src/method.cc
|
||||
src/language.cc
|
||||
src/log.cc
|
||||
src/lsp.cc
|
||||
src/match.cc
|
||||
src/message_handler.cc
|
||||
src/pipeline.cc
|
||||
src/platform_posix.cc
|
||||
src/platform_win.cc
|
||||
src/position.cc
|
||||
src/project.cc
|
||||
src/query_utils.cc
|
||||
src/query.cc
|
||||
src/serializer.cc
|
||||
src/test.cc
|
||||
src/utils.cc
|
||||
src/working_files.cc
|
||||
)
|
||||
|
||||
target_sources(ccls PRIVATE
|
||||
src/messages/ccls_base.cc
|
||||
src/messages/ccls_callHierarchy.cc
|
||||
src/messages/ccls_callers.cc
|
||||
src/messages/ccls_fileInfo.cc
|
||||
src/messages/ccls_freshenIndex.cc
|
||||
src/messages/ccls_inheritanceHierarchy.cc
|
||||
src/messages/ccls_memberHierarchy.cc
|
||||
src/messages/ccls_vars.cc
|
||||
src/messages/exit.cc
|
||||
src/messages/initialize.cc
|
||||
src/messages/shutdown.cc
|
||||
src/messages/textDocument_codeAction.cc
|
||||
src/messages/textDocument_codeLens.cc
|
||||
src/messages/textDocument_completion.cc
|
||||
src/messages/textDocument_definition.cc
|
||||
src/messages/textDocument_didChange.cc
|
||||
src/messages/textDocument_didClose.cc
|
||||
src/messages/textDocument_didOpen.cc
|
||||
src/messages/textDocument_didSave.cc
|
||||
src/messages/textDocument_documentHighlight.cc
|
||||
src/messages/textDocument_documentSymbol.cc
|
||||
src/messages/textDocument_hover.cc
|
||||
src/messages/textDocument_implementation.cc
|
||||
src/messages/textDocument_references.cc
|
||||
src/messages/textDocument_rename.cc
|
||||
src/messages/textDocument_signatureHelp.cc
|
||||
src/messages/textDocument_typeDefinition.cc
|
||||
src/messages/workspace_didChangeConfiguration.cc
|
||||
src/messages/workspace_didChangeWatchedFiles.cc
|
||||
src/messages/workspace_symbol.cc
|
||||
)
|
||||
src/messages/ccls_base.cc
|
||||
src/messages/ccls_callHierarchy.cc
|
||||
src/messages/ccls_callers.cc
|
||||
src/messages/ccls_fileInfo.cc
|
||||
src/messages/ccls_freshenIndex.cc
|
||||
src/messages/ccls_inheritanceHierarchy.cc
|
||||
src/messages/ccls_memberHierarchy.cc
|
||||
src/messages/ccls_vars.cc
|
||||
src/messages/exit.cc
|
||||
src/messages/initialize.cc
|
||||
src/messages/shutdown.cc
|
||||
src/messages/textDocument_codeAction.cc
|
||||
src/messages/textDocument_codeLens.cc
|
||||
src/messages/textDocument_completion.cc
|
||||
src/messages/textDocument_definition.cc
|
||||
src/messages/textDocument_didChange.cc
|
||||
src/messages/textDocument_didClose.cc
|
||||
src/messages/textDocument_didOpen.cc
|
||||
src/messages/textDocument_didSave.cc
|
||||
src/messages/textDocument_documentHighlight.cc
|
||||
src/messages/textDocument_documentSymbol.cc
|
||||
src/messages/textDocument_hover.cc
|
||||
src/messages/textDocument_implementation.cc
|
||||
src/messages/textDocument_references.cc
|
||||
src/messages/textDocument_rename.cc
|
||||
src/messages/textDocument_signatureHelp.cc
|
||||
src/messages/textDocument_typeDefinition.cc
|
||||
src/messages/workspace_didChangeConfiguration.cc
|
||||
src/messages/workspace_didChangeWatchedFiles.cc
|
||||
src/messages/workspace_symbol.cc
|
||||
)
|
||||
|
@ -1 +0,0 @@
|
||||
2501887b2f638d3f65b0336f354b96f8108b563522d81e841d5c88c34af283dd
|
1
clang_archive_hashes/LLVM-6.0.1-win64.exe.SHA256
Normal file
1
clang_archive_hashes/LLVM-6.0.1-win64.exe.SHA256
Normal file
@ -0,0 +1 @@
|
||||
780276221635aa08120187ffc2c72ff7873dee37f5609455ee7bba6fcdd91d79
|
@ -1 +0,0 @@
|
||||
fee8352f5dee2e38fa2bb80ab0b5ef9efef578cbc6892e5c724a1187498119b7
|
@ -1 +0,0 @@
|
||||
114e78b2f6db61aaee314c572e07b0d635f653adc5d31bd1cd0bf31a3db4a6e5
|
@ -1 +0,0 @@
|
||||
cc99fda45b4c740f35d0a367985a2bf55491065a501e2dd5d1ad3f97dcac89da
|
@ -0,0 +1 @@
|
||||
6d1f67c9e7c3481106d5c9bfcb8a75e3876eb17a446a14c59c13cafd000c21d2
|
@ -0,0 +1 @@
|
||||
7ea204ecd78c39154d72dfc0d4a79f7cce1b2264da2551bb2eef10e266d54d91
|
@ -4,17 +4,21 @@
|
||||
# Returns the extracted Clang archive directory in DOWNLOADED_CLANG_DIR
|
||||
#
|
||||
# Downloads 7-Zip to extract Clang if it isn't available in the PATH
|
||||
function(download_and_extract_clang CLANG_VERSION CLANG_DOWNLOAD_LOCATION)
|
||||
function(download_and_extract_clang CLANG_DOWNLOAD_LOCATION)
|
||||
|
||||
set(CLANG_VERSION 6.0.1)
|
||||
set(CLANG_ARCHIVE_EXT .tar.xz)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
|
||||
# Default to Ubuntu 16.04
|
||||
set(CLANG_ARCHIVE_NAME
|
||||
clang+llvm-${CLANG_VERSION}-x86_64-linux-gnu-ubuntu-16.04)
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
||||
|
||||
# No Darwin binaries were released for LLVM 6.0.1
|
||||
set(CLANG_VERSION 6.0.0)
|
||||
set(CLANG_ARCHIVE_NAME clang+llvm-${CLANG_VERSION}-x86_64-apple-darwin)
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
@ -24,11 +28,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
|
||||
|
||||
if(${CLANG_VERSION} STREQUAL 6.0.0)
|
||||
set(CLANG_ARCHIVE_NAME clang+llvm-${CLANG_VERSION}-amd64-unknown-freebsd-10)
|
||||
else()
|
||||
set(CLANG_ARCHIVE_NAME clang+llvm-${CLANG_VERSION}-amd64-unknown-freebsd10)
|
||||
endif()
|
||||
set(CLANG_ARCHIVE_NAME clang+llvm-${CLANG_VERSION}-amd64-unknown-freebsd10)
|
||||
|
||||
endif()
|
||||
|
||||
@ -92,8 +92,11 @@ if(${CLANG_ARCHIVE_EXT} STREQUAL .exe)
|
||||
|
||||
include(DownloadAndExtract7zip)
|
||||
download_and_extract_7zip(${CLANG_DOWNLOAD_LOCATION})
|
||||
find_program(7ZIP_EXECUTABLE 7z NO_DEFAULT_PATH
|
||||
PATHS ${DOWNLOADED_7ZIP_DIR})
|
||||
find_program(7ZIP_EXECUTABLE
|
||||
NAMES 7z
|
||||
NO_DEFAULT_PATH
|
||||
PATHS ${DOWNLOADED_7ZIP_DIR}
|
||||
)
|
||||
else()
|
||||
message(STATUS "7-Zip found in PATH")
|
||||
endif()
|
||||
@ -101,22 +104,26 @@ if(${CLANG_ARCHIVE_EXT} STREQUAL .exe)
|
||||
message(STATUS "Extracting downloaded Clang with 7-Zip ...")
|
||||
|
||||
# Avoid running the Clang installer by extracting the exe with 7-Zip
|
||||
execute_process(COMMAND ${7ZIP_EXECUTABLE} x
|
||||
-o${CLANG_ARCHIVE_EXTRACT_DIR}
|
||||
-xr!$PLUGINSDIR ${CLANG_ARCHIVE_FILE}
|
||||
WORKING_DIRECTORY ${CLANG_DOWNLOAD_LOCATION}
|
||||
OUTPUT_QUIET)
|
||||
execute_process(
|
||||
COMMAND ${7ZIP_EXECUTABLE} x
|
||||
-o${CLANG_ARCHIVE_EXTRACT_DIR}
|
||||
-xr!$PLUGINSDIR ${CLANG_ARCHIVE_FILE}
|
||||
WORKING_DIRECTORY ${CLANG_DOWNLOAD_LOCATION}
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
|
||||
elseif(${CLANG_ARCHIVE_EXT} STREQUAL .tar.xz)
|
||||
message(STATUS "Extracting downloaded Clang with CMake built-in tar ...")
|
||||
|
||||
# CMake has builtin support for tar via the -E flag
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${CLANG_ARCHIVE_FILE}
|
||||
# Specify working directory to allow running cmake from
|
||||
# everywhere
|
||||
# (example: cmake -H"$HOME/ccls" -B"$home/ccls/build")
|
||||
WORKING_DIRECTORY ${CLANG_DOWNLOAD_LOCATION}
|
||||
OUTPUT_QUIET)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar -xf ${CLANG_ARCHIVE_FILE}
|
||||
# Specify working directory to allow running cmake from
|
||||
# everywhere
|
||||
# (example: cmake -H"$HOME/cquery" -B"$home/cquery/build")
|
||||
WORKING_DIRECTORY ${CLANG_DOWNLOAD_LOCATION}
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
endif()
|
||||
|
||||
set(DOWNLOADED_CLANG_DIR ${CLANG_ARCHIVE_EXTRACT_DIR} PARENT_SCOPE)
|
||||
|
@ -114,8 +114,10 @@ executable. Output:\n ${_Clang_FIND_RESOURCE_DIR_ERROR}")
|
||||
|
||||
# Find Clang version
|
||||
set(_Clang_VERSION_REGEX "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
execute_process(COMMAND ${Clang_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE Clang_VERSION)
|
||||
execute_process(
|
||||
COMMAND ${Clang_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE Clang_VERSION
|
||||
)
|
||||
string(REGEX MATCH ${_Clang_VERSION_REGEX} Clang_VERSION ${Clang_VERSION})
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user