mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
build: introduce variable DEPS_IGNORE_SHA for skipping dependency hash check
This will reduce friction as developers no longer need to provide a hash when testing out different commits. To skip the hash check, set `DEPS_IGNORE_SHA` to `TRUE` in `cmake.deps/CMakeLists.txt`.
This commit is contained in:
parent
d744876723
commit
187ae67735
@ -17,6 +17,36 @@ include(Deps)
|
||||
include(Find)
|
||||
include(Util)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# User settings
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
set(DEPS_IGNORE_SHA FALSE)
|
||||
|
||||
# Options
|
||||
option(USE_BUNDLED "Use bundled dependencies." ON)
|
||||
|
||||
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED})
|
||||
# PUC Lua is only used for tests, unless explicitly requested.
|
||||
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
|
||||
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_TS "Use the bundled treesitter runtime." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_TS_PARSERS "Use the bundled treesitter parsers." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
|
||||
if(USE_BUNDLED AND MSVC)
|
||||
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON)
|
||||
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." ON)
|
||||
else()
|
||||
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." OFF)
|
||||
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF)
|
||||
endif()
|
||||
|
||||
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
|
||||
|
||||
set_default_buildtype(Release)
|
||||
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT isMultiConfig)
|
||||
@ -32,30 +62,6 @@ endif()
|
||||
|
||||
set(DEPS_INCLUDE_FLAGS "-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
|
||||
|
||||
option(USE_BUNDLED "Use bundled dependencies." ON)
|
||||
|
||||
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED})
|
||||
# PUC Lua is only used for tests, unless explicitly requested.
|
||||
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
|
||||
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_TS "Use the bundled treesitter runtime." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_TS_PARSERS "Use the bundled treesitter parsers." ${USE_BUNDLED})
|
||||
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
|
||||
|
||||
if(USE_BUNDLED AND MSVC)
|
||||
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON)
|
||||
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." ON)
|
||||
else()
|
||||
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." OFF)
|
||||
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF)
|
||||
endif()
|
||||
|
||||
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
|
||||
|
||||
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),
|
||||
# fall back to local system version. Needs to be done here and in top-level CMakeLists.txt.
|
||||
if(APPLE)
|
||||
|
@ -1,7 +1,8 @@
|
||||
if(MSVC)
|
||||
get_sha(gettext ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(gettext
|
||||
URL ${GETTEXT_URL}
|
||||
URL_HASH SHA256=${GETTEXT_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
|
||||
|
@ -1,7 +1,8 @@
|
||||
if(MSVC)
|
||||
get_sha(libiconv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libiconv
|
||||
URL ${LIBICONV_URL}
|
||||
URL_HASH SHA256=${LIBICONV_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libiconv
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibiconvCMakeLists.txt
|
||||
|
@ -1,6 +1,7 @@
|
||||
get_sha(libuv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libuv
|
||||
URL ${LIBUV_URL}
|
||||
URL_HASH SHA256=${LIBUV_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
-D CMAKE_INSTALL_LIBDIR=lib
|
||||
|
@ -1,6 +1,7 @@
|
||||
get_sha(libvterm ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(libvterm
|
||||
URL ${LIBVTERM_URL}
|
||||
URL_HASH SHA256=${LIBVTERM_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
|
||||
|
@ -1,6 +1,7 @@
|
||||
get_sha(lpeg ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lpeg
|
||||
URL ${LPEG_URL}
|
||||
URL_HASH SHA256=${LPEG_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lpeg
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LpegCMakeLists.txt
|
||||
|
@ -40,9 +40,10 @@ 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})
|
||||
ExternalProject_Add(lua
|
||||
URL ${LUA_URL}
|
||||
URL_HASH SHA256=${LUA_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua
|
||||
CONFIGURE_COMMAND "${LUA_CONFIGURE_COMMAND}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
@ -11,9 +11,10 @@ function(BuildLuajit)
|
||||
set(_luajit_TARGET "luajit")
|
||||
endif()
|
||||
|
||||
get_sha(luajit ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(${_luajit_TARGET}
|
||||
URL ${LUAJIT_URL}
|
||||
URL_HASH SHA256=${LUAJIT_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${_luajit_TARGET}
|
||||
CONFIGURE_COMMAND "${_luajit_CONFIGURE_COMMAND}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
@ -1,6 +1,6 @@
|
||||
set(LUV_CMAKE_ARGS
|
||||
-D LUA_BUILD_TYPE=System
|
||||
-D LUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3
|
||||
-D LUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua_compat53
|
||||
-D WITH_SHARED_LIBUV=ON
|
||||
-D BUILD_STATIC_LIBS=ON
|
||||
-D BUILD_MODULE=OFF)
|
||||
@ -17,19 +17,21 @@ if(CMAKE_GENERATOR MATCHES "Unix Makefiles" AND
|
||||
list(APPEND LUV_CMAKE_ARGS -D CMAKE_MAKE_PROGRAM=gmake)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(lua-compat-5.3
|
||||
get_sha(lua_compat53 ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lua_compat53
|
||||
URL ${LUA_COMPAT53_URL}
|
||||
URL_HASH SHA256=${LUA_COMPAT53_SHA256}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-compat-5.3
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_compat53
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
|
||||
get_sha(luv ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(luv
|
||||
DEPENDS lua-compat-5.3
|
||||
DEPENDS lua_compat53
|
||||
URL ${LUV_URL}
|
||||
URL_HASH SHA256=${LUV_SHA256}
|
||||
${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,6 +1,7 @@
|
||||
get_sha(msgpack ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(msgpack
|
||||
URL ${MSGPACK_URL}
|
||||
URL_HASH SHA256=${MSGPACK_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
-D MSGPACK_BUILD_TESTS=OFF
|
||||
|
@ -1,6 +1,7 @@
|
||||
get_sha(treesitter ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(treesitter
|
||||
URL ${TREESITTER_URL}
|
||||
URL_HASH SHA256=${TREESITTER_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt
|
||||
|
@ -18,12 +18,11 @@ function(BuildTSParser)
|
||||
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}})
|
||||
|
||||
get_sha(treesitter_${TS_LANG} ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(${NAME}
|
||||
URL ${URL}
|
||||
URL_HASH SHA256=${HASH}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
|
||||
|
@ -1,6 +1,7 @@
|
||||
get_sha(unibilium ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(unibilium
|
||||
URL ${UNIBILIUM_URL}
|
||||
URL_HASH SHA256=${UNIBILIUM_SHA256}
|
||||
${EXTERNALPROJECT_URL_HASH}
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}
|
||||
|
@ -54,3 +54,11 @@ if(CMAKE_OSX_ARCHITECTURES)
|
||||
set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -arch ${ARCH}")
|
||||
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)
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user