diff --git CMakeLists.txt CMakeLists.txt index 12e0d6e6a..27fe5c50d 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -102,6 +102,19 @@ endif() list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) +# Reading deps.txt adapted from cmake.deps/CMakeLists.txt +file(READ cmake.deps/deps.txt DEPENDENCIES) +STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}") +foreach(dep ${DEPENDENCIES}) + STRING(REGEX REPLACE " " ";" dep "${dep}") + list(GET dep 0 name) + list(GET dep 1 value) + set(${name} ${value}) +endforeach() +set(DEPS_IGNORE_SHA FALSE) +list(APPEND DEPS_CMAKE_ARGS -D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -D "CMAKE_C_FLAGS=${CMAKE_C_FLAGS}") +include(cmake.deps/cmake/BuildTreesitterParsers.cmake) + if(APPLE) # If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET), # fall back to local system version. Needs to be done both here and in cmake.deps. diff --git cmake.deps/cmake/BuildTreesitterParsers.cmake cmake.deps/cmake/BuildTreesitterParsers.cmake index 060447e6f..9c3f7165e 100644 --- cmake.deps/cmake/BuildTreesitterParsers.cmake +++ cmake.deps/cmake/BuildTreesitterParsers.cmake @@ -21,13 +21,15 @@ function(BuildTSParser) ExternalProject_Add(${NAME} DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME} PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE} + ${CMAKE_CURRENT_LIST_DIR}/${TS_CMAKE_FILE} ${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt CMAKE_ARGS ${DEPS_CMAKE_ARGS} -D PARSERLANG=${TS_LANG} ${EXTERNALPROJECT_OPTIONS}) endfunction() +set(ALL_BUNDLED_TS_PARSER_TARGETS c lua vim vimdoc query markdown) # All parsers built in the lines directly below. +list(TRANSFORM ALL_BUNDLED_TS_PARSER_TARGETS PREPEND treesitter_) foreach(lang c lua vim vimdoc query) BuildTSParser(LANG ${lang}) endforeach() diff --git src/nvim/CMakeLists.txt src/nvim/CMakeLists.txt index a100e733d..6e05f66cf 100644 --- src/nvim/CMakeLists.txt +++ src/nvim/CMakeLists.txt @@ -770,10 +770,8 @@ endif() file(MAKE_DIRECTORY ${BINARY_LIB_DIR}) -# install treesitter parser if bundled -if(EXISTS ${DEPS_PREFIX}/lib/nvim/parser) - add_custom_command(TARGET nvim_runtime_deps COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_PREFIX}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) -endif() +add_dependencies(nvim_runtime_deps ${ALL_BUNDLED_TS_PARSER_TARGETS}) +add_custom_command(TARGET nvim_runtime_deps COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_INSTALL_DIR}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) install(DIRECTORY ${BINARY_LIB_DIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}