neovim/cmake.deps/cmake/BuildTreesitterParsers.cmake
Christian Clason 97f38f0a9b fix(treesitter): do not link @error by default
The @error capture is used for tree-sitter's ERROR node, which indicates
a parsing error -- which can be quite frequent (and jarring) while typing.

Users can still manually `hi link @error Error` in their config.
2022-09-06 07:57:46 +02:00

26 lines
1.0 KiB
CMake

function(BuildTSParser LANG TS_URL TS_SHA256 TS_CMAKE_FILE)
set(NAME treesitter-${LANG})
ExternalProject_Add(${NAME}
PREFIX ${DEPS_BUILD_DIR}
URL ${TREESITTER_C_URL}
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
DOWNLOAD_COMMAND ${CMAKE_COMMAND}
-DPREFIX=${DEPS_BUILD_DIR}
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/${NAME}
-DURL=${TS_URL}
-DEXPECTED_SHA256=${TS_SHA256}
-DTARGET=${NAME}
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DPARSERLANG=${LANG})
endfunction()
BuildTSParser(c ${TREESITTER_C_URL} ${TREESITTER_C_SHA256} TreesitterParserCMakeLists.txt)
BuildTSParser(lua ${TREESITTER_LUA_URL} ${TREESITTER_LUA_SHA256} TreesitterParserCMakeLists.txt)
BuildTSParser(vim ${TREESITTER_VIM_URL} ${TREESITTER_VIM_SHA256} TreesitterParserCMakeLists.txt)