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