mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
b8288df99b
There are a number of cmake variables and cache variables that need to be passed to all dependencies. This is not only cumbersome, but also fragile as it's easy to miss adding or removing a flag from a dependency by accident. Introducing a global variable that controls all builds makes it much easier to handle our dependencies. Also fixes the currently broken release workflow as we need to pass the CMAKE_OSX_ARCHITECTURES variable to all dependencies built with cmake.
23 lines
962 B
CMake
23 lines
962 B
CMake
function(BuildTSParser LANG TS_URL TS_SHA256 TS_CMAKE_FILE)
|
|
set(NAME treesitter-${LANG})
|
|
if(USE_EXISTING_SRC_DIR)
|
|
unset(TS_URL)
|
|
endif()
|
|
ExternalProject_Add(${NAME}
|
|
URL ${TS_URL}
|
|
URL_HASH SHA256=${TS_SHA256}
|
|
DOWNLOAD_NO_PROGRESS TRUE
|
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
|
|
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
|
|
${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt
|
|
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
|
-DPARSERLANG=${LANG}
|
|
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
|
|
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)
|
|
BuildTSParser(help ${TREESITTER_HELP_URL} ${TREESITTER_HELP_SHA256} TreesitterParserCMakeLists.txt)
|