mirror of
https://github.com/neovim/neovim.git
synced 2024-12-27 14:21:31 -07:00
build: use GIT_REPOSITORY
for local URLs
`GIT_REPOSITORY` will cause cmake to rebuild if local dependency changes, which isn't the case for `URL`. Also document how to test a different commits of a dependency.
This commit is contained in:
parent
881f5e5917
commit
2c1e8f7e96
@ -309,7 +309,7 @@ ExternalProject_Add(uncrustify
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
|
||||
option(USE_BUNDLED_BUSTED "Use bundled busted" ON)
|
||||
if(USE_BUNDLED_BUSTED)
|
||||
@ -322,7 +322,7 @@ if(USE_BUNDLED_BUSTED)
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
else()
|
||||
add_custom_target(lua-dev-deps)
|
||||
endif()
|
||||
|
@ -318,6 +318,30 @@ types, etc. See [:help dev-lua-doc][dev-lua-doc].
|
||||
- Private functions usually should be underscore-prefixed (named "_foo", not "foo").
|
||||
- Mark deprecated functions with `@deprecated`.
|
||||
|
||||
Third-party dependencies
|
||||
------------------------
|
||||
|
||||
To build Nvim using a different commit of a dependency change the appropriate
|
||||
URL in `cmake.deps/deps.txt`. For example, to use a different version of luajit
|
||||
replace the value in `LUAJIT_URL` with the wanted commit hash:
|
||||
|
||||
```bash
|
||||
LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/<sha>.tar.gz
|
||||
```
|
||||
|
||||
Set `DEPS_IGNORE_SHA` to `TRUE` in `cmake.deps/CMakeLists.txt` to skip hash
|
||||
check from cmake.
|
||||
|
||||
Alternatively, you may point the URL as a local path where the repository is.
|
||||
This is convenient when bisecting a problem in a dependency with `git bisect`.
|
||||
This requires running `make distclean` the first time once to remove traces of
|
||||
the previous build. Hash checking is always skipped in this case regardless of
|
||||
`DEPS_IGNORE_SHA`.
|
||||
|
||||
```bash
|
||||
LUAJIT_URL /home/user/luajit
|
||||
```
|
||||
|
||||
Reviewing
|
||||
---------
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
if(MSVC)
|
||||
get_sha(gettext ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(gettext ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(gettext
|
||||
URL ${GETTEXT_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
|
||||
|
@ -1,8 +1,6 @@
|
||||
if(MSVC)
|
||||
get_sha(libiconv ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(libiconv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libiconv
|
||||
URL ${LIBICONV_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libiconv
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibiconvCMakeLists.txt
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(libuv ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(libuv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libuv
|
||||
URL ${LIBUV_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
-D CMAKE_INSTALL_LIBDIR=lib
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(libvterm ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(libvterm ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libvterm
|
||||
URL ${LIBVTERM_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(lpeg ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(lpeg ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lpeg
|
||||
URL ${LPEG_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lpeg
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LpegCMakeLists.txt
|
||||
|
@ -40,10 +40,8 @@ set(LUA_CONFIGURE_COMMAND
|
||||
-i ${DEPS_BUILD_DIR}/src/lua/src/luaconf.h)
|
||||
set(LUA_INSTALL_TOP_ARG "INSTALL_TOP=${DEPS_INSTALL_DIR}")
|
||||
|
||||
get_sha(lua ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(lua ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lua
|
||||
URL ${LUA_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua
|
||||
CONFIGURE_COMMAND "${LUA_CONFIGURE_COMMAND}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
@ -11,10 +11,8 @@ function(BuildLuajit)
|
||||
set(_luajit_TARGET "luajit")
|
||||
endif()
|
||||
|
||||
get_sha(luajit ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(luajit ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(${_luajit_TARGET}
|
||||
URL ${LUAJIT_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${_luajit_TARGET}
|
||||
CONFIGURE_COMMAND "${_luajit_CONFIGURE_COMMAND}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
@ -17,21 +17,17 @@ if(CMAKE_GENERATOR MATCHES "Unix Makefiles" AND
|
||||
list(APPEND LUV_CMAKE_ARGS -D CMAKE_MAKE_PROGRAM=gmake)
|
||||
endif()
|
||||
|
||||
get_sha(lua_compat53 ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(lua_compat53 ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lua_compat53
|
||||
URL ${LUA_COMPAT53_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_compat53
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
|
||||
get_sha(luv ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(luv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(luv
|
||||
DEPENDS lua_compat53
|
||||
URL ${LUV_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luv
|
||||
SOURCE_DIR ${DEPS_BUILD_DIR}/src/luv
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${LUV_CMAKE_ARGS}
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(msgpack ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(msgpack ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(msgpack
|
||||
URL ${MSGPACK_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
-D MSGPACK_BUILD_TESTS=OFF
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(treesitter ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(treesitter ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(treesitter
|
||||
URL ${TREESITTER_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt
|
||||
|
@ -15,14 +15,10 @@ function(BuildTSParser)
|
||||
set(TS_CMAKE_FILE TreesitterParserCMakeLists.txt)
|
||||
endif()
|
||||
|
||||
set(NAME treesitter-${TS_LANG})
|
||||
string(TOUPPER "TREESITTER_${TS_LANG}_URL" URL_VARNAME)
|
||||
set(URL ${${URL_VARNAME}})
|
||||
set(NAME treesitter_${TS_LANG})
|
||||
|
||||
get_sha(treesitter_${TS_LANG} ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(${NAME} ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(${NAME}
|
||||
URL ${URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
|
||||
|
@ -1,7 +1,5 @@
|
||||
get_sha(unibilium ${DEPS_IGNORE_SHA})
|
||||
get_externalproject_options(unibilium ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(unibilium
|
||||
URL ${UNIBILIUM_URL}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}
|
||||
|
@ -24,7 +24,7 @@ function(GetBinaryDep)
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BIN_DIR}
|
||||
COMMAND "${_gettool_INSTALL_COMMAND}"
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
endfunction()
|
||||
|
||||
# Download executable and move it to DEPS_BIN_DIR
|
||||
@ -49,5 +49,5 @@ function(GetExecutable)
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BIN_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy <DOWNLOADED_FILE> ${DEPS_BIN_DIR}
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
endfunction()
|
||||
|
@ -19,7 +19,6 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
|
||||
set(EXTERNALPROJECT_OPTIONS DOWNLOAD_NO_PROGRESS TRUE)
|
||||
|
||||
# MAKE_PRG
|
||||
if(UNIX)
|
||||
@ -55,10 +54,24 @@ if(CMAKE_OSX_ARCHITECTURES)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
function(get_sha name ignore)
|
||||
unset(EXTERNALPROJECT_URL_HASH)
|
||||
if(NOT ${ignore})
|
||||
string(TOUPPER ${name} name_allcaps)
|
||||
set(EXTERNALPROJECT_URL_HASH URL_HASH SHA256=${${name_allcaps}_SHA256} PARENT_SCOPE)
|
||||
function(get_externalproject_options name DEPS_IGNORE_SHA)
|
||||
string(TOUPPER ${name} name_allcaps)
|
||||
set(url ${${name_allcaps}_URL})
|
||||
|
||||
set(EXTERNALPROJECT_OPTIONS DOWNLOAD_NO_PROGRESS TRUE)
|
||||
|
||||
if(EXISTS ${url})
|
||||
list(APPEND EXTERNALPROJECT_OPTIONS
|
||||
GIT_REPOSITORY ${${name_allcaps}_URL})
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
|
||||
list(APPEND EXTERNALPROJECT_OPTIONS GIT_REMOTE_UPDATE_STRATEGY CHECKOUT)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTERNALPROJECT_OPTIONS URL ${${name_allcaps}_URL})
|
||||
if(NOT ${DEPS_IGNORE_SHA})
|
||||
list(APPEND EXTERNALPROJECT_OPTIONS URL_HASH SHA256=${${name_allcaps}_SHA256})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(EXTERNALPROJECT_OPTIONS ${EXTERNALPROJECT_OPTIONS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user