mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
build: cmake cleanup
- Change libtermkeyCMakeLists.txt to LibtermkeyCMakeLists.txt - Remove duplicate mark_as_advanced calls in FindLibuv.cmake - Fix "Enabling Clang sanitizer" messages as it's no longer clang-only - Simplify parser installation syntax - Rename tree-sitter to treesitter
This commit is contained in:
parent
a5c572bd44
commit
81f2bce775
@ -187,19 +187,14 @@ set(LIBICONV_SHA256 ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc891
|
||||
|
||||
set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz)
|
||||
set(TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2 )
|
||||
|
||||
set(TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz)
|
||||
set(TREESITTER_LUA_SHA256 930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d)
|
||||
|
||||
set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/e39a7bbcfdcfc7900629962b785c7e14503ae590.tar.gz)
|
||||
set(TREESITTER_VIM_SHA256 7ca85fa1a5a9e4d057ff3b7ae53d13d31371973e734ada87a83f3f6cbe9c0e32)
|
||||
|
||||
set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz)
|
||||
set(TREESITTER_VIMDOC_SHA256 1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274)
|
||||
|
||||
set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz)
|
||||
set(TREESITTER_QUERY_SHA256 e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c)
|
||||
|
||||
set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.20.8.tar.gz)
|
||||
set(TREESITTER_SHA256 6181ede0b7470bfca37e293e7d5dc1d16469b9485d13f13a605baec4a8b1f791)
|
||||
|
||||
|
@ -4,7 +4,7 @@ ExternalProject_Add(libtermkey
|
||||
DOWNLOAD_NO_PROGRESS TRUE
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtermkey
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/libtermkeyCMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibtermkeyCMakeLists.txt
|
||||
${DEPS_BUILD_DIR}/src/libtermkey/CMakeLists.txt
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
-D CMAKE_SHARED_LIBRARY_LINK_C_FLAGS="" # Hack to avoid -rdynamic in Mingw
|
||||
|
@ -1,11 +1,11 @@
|
||||
ExternalProject_Add(tree-sitter
|
||||
ExternalProject_Add(treesitter
|
||||
URL ${TREESITTER_URL}
|
||||
URL_HASH SHA256=${TREESITTER_SHA256}
|
||||
DOWNLOAD_NO_PROGRESS TRUE
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/tree-sitter
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter
|
||||
INSTALL_DIR ${DEPS_INSTALL_DIR}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt
|
||||
${DEPS_BUILD_DIR}/src/tree-sitter/CMakeLists.txt
|
||||
${DEPS_BUILD_DIR}/src/treesitter/CMakeLists.txt
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
|
||||
|
@ -1,14 +1,29 @@
|
||||
# Helper function to download treesitter parsers
|
||||
#
|
||||
# Single value arguments:
|
||||
# LANG - Parser language
|
||||
# CMAKE_FILE - Cmake file to build the parser with. Defaults to
|
||||
# TreesitterParserCMakeLists.txt.
|
||||
function(BuildTSParser)
|
||||
cmake_parse_arguments(TS
|
||||
""
|
||||
"LANG;URL;SHA256;CMAKE_FILE"
|
||||
"LANG;CMAKE_FILE"
|
||||
""
|
||||
${ARGN})
|
||||
|
||||
if(NOT TS_CMAKE_FILE)
|
||||
set(TS_CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
endif()
|
||||
|
||||
set(NAME treesitter-${TS_LANG})
|
||||
string(TOUPPER "TREESITTER_${TS_LANG}_URL" URL_VARNAME)
|
||||
set(URL ${${URL_VARNAME}})
|
||||
string(TOUPPER "TREESITTER_${TS_LANG}_SHA256" HASH_VARNAME)
|
||||
set(HASH ${${HASH_VARNAME}})
|
||||
|
||||
ExternalProject_Add(${NAME}
|
||||
URL ${TS_URL}
|
||||
URL_HASH SHA256=${TS_SHA256}
|
||||
URL ${URL}
|
||||
URL_HASH SHA256=${HASH}
|
||||
DOWNLOAD_NO_PROGRESS TRUE
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
@ -19,32 +34,6 @@ function(BuildTSParser)
|
||||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
|
||||
endfunction()
|
||||
|
||||
BuildTSParser(
|
||||
LANG c
|
||||
URL ${TREESITTER_C_URL}
|
||||
SHA256 ${TREESITTER_C_SHA256}
|
||||
CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
|
||||
BuildTSParser(
|
||||
LANG lua
|
||||
URL ${TREESITTER_LUA_URL}
|
||||
SHA256 ${TREESITTER_LUA_SHA256}
|
||||
CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
|
||||
BuildTSParser(
|
||||
LANG vim
|
||||
URL ${TREESITTER_VIM_URL}
|
||||
SHA256 ${TREESITTER_VIM_SHA256}
|
||||
CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
|
||||
BuildTSParser(
|
||||
LANG vimdoc
|
||||
URL ${TREESITTER_VIMDOC_URL}
|
||||
SHA256 ${TREESITTER_VIMDOC_SHA256}
|
||||
CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
|
||||
BuildTSParser(
|
||||
LANG query
|
||||
URL ${TREESITTER_QUERY_URL}
|
||||
SHA256 ${TREESITTER_QUERY_SHA256}
|
||||
CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
foreach(lang c lua vim vimdoc query)
|
||||
BuildTSParser(LANG ${lang})
|
||||
endforeach()
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(tree-sitter C)
|
||||
project(treesitter C)
|
||||
|
||||
add_library(tree-sitter lib/src/lib.c)
|
||||
target_include_directories(tree-sitter
|
||||
|
@ -4,8 +4,6 @@ list(APPEND LIBUV_NAMES uv_a uv)
|
||||
|
||||
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES})
|
||||
|
||||
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
|
||||
|
||||
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
|
||||
set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
|
||||
|
||||
|
@ -794,7 +794,7 @@ target_compile_definitions(libnvim PRIVATE MAKE_LIB)
|
||||
target_link_libraries(libnvim PRIVATE main_lib PUBLIC libuv)
|
||||
|
||||
if(ENABLE_ASAN_UBSAN)
|
||||
message(STATUS "Enabling Clang address sanitizer and undefined behavior sanitizer for nvim.")
|
||||
message(STATUS "Enabling address sanitizer and undefined behavior sanitizer for nvim.")
|
||||
if(CI_BUILD)
|
||||
# Try to recover from all sanitize issues so we get reports about all failures
|
||||
target_compile_options(nvim PRIVATE -fsanitize-recover=all)
|
||||
@ -808,7 +808,7 @@ if(ENABLE_ASAN_UBSAN)
|
||||
-fsanitize=undefined)
|
||||
target_link_libraries(nvim PRIVATE -fsanitize=address -fsanitize=undefined)
|
||||
elseif(ENABLE_MSAN)
|
||||
message(STATUS "Enabling Clang memory sanitizer for nvim.")
|
||||
message(STATUS "Enabling memory sanitizer for nvim.")
|
||||
target_compile_options(nvim PRIVATE
|
||||
-fsanitize=memory
|
||||
-fsanitize-memory-track-origins
|
||||
@ -816,7 +816,7 @@ elseif(ENABLE_MSAN)
|
||||
-fno-optimize-sibling-calls)
|
||||
target_link_libraries(nvim PRIVATE -fsanitize=memory -fsanitize-memory-track-origins)
|
||||
elseif(ENABLE_TSAN)
|
||||
message(STATUS "Enabling Clang thread sanitizer for nvim.")
|
||||
message(STATUS "Enabling thread sanitizer for nvim.")
|
||||
target_compile_options(nvim PRIVATE -fsanitize=thread -fPIE)
|
||||
target_link_libraries(nvim PRIVATE -fsanitize=thread)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user