Add option USE_BUNDLED_BUSTED to third-party

- When not running the unit tests, building the third-party busted,
  nvim-client and other dependencies can be skipped by passing
  -DUSE_BUNDLED_BUSTED=FALSE to the third-party project.
This commit is contained in:
Rui Abreu Ferreira
2015-04-18 00:02:28 +01:00
parent 84891f2802
commit fe9ec9c299

View File

@@ -1,3 +1,5 @@
option(USE_BUNDLED_BUSTED "Use the bundled version of busted to run tests." ON)
if(USE_BUNDLED_LUAJIT) if(USE_BUNDLED_LUAJIT)
list(APPEND LUAROCKS_OPTS list(APPEND LUAROCKS_OPTS
--with-lua=${DEPS_INSTALL_DIR} --with-lua=${DEPS_INSTALL_DIR}
@@ -28,6 +30,30 @@ if(USE_BUNDLED_LUAJIT)
add_dependencies(luarocks luajit) add_dependencies(luarocks luajit)
endif() endif()
# Each target depends on the previous module, this serializes all calls to
# luarocks since it is unhappy to be called in parallel.
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack
COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build lua-messagepack CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
DEPENDS luarocks)
add_custom_target(lua-messagepack
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack)
# Like before, depend on lua-messagepack to ensure serialization of install
# commands
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lpeg
COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build lpeg CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
DEPENDS lua-messagepack)
add_custom_target(lpeg
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lpeg)
list(APPEND THIRD_PARTY_DEPS lua-messagepack lpeg)
if(USE_BUNDLED_BUSTED)
# The following are only required if we want to run tests
# with busted
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps
COMMAND ${DEPS_BIN_DIR}/luarocks COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build lua_cliargs 2.3-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} ARGS build lua_cliargs 2.3-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
@@ -50,7 +76,7 @@ add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps
COMMAND ${DEPS_BIN_DIR}/luarocks COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build xml 1.1.1-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} ARGS build xml 1.1.1-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
COMMAND touch ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps COMMAND touch ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps
DEPENDS luarocks) DEPENDS lpeg)
add_custom_target(stable-busted-deps add_custom_target(stable-busted-deps
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps) DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps)
@@ -61,30 +87,12 @@ add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted
add_custom_target(busted add_custom_target(busted
DEPENDS ${DEPS_BIN_DIR}/busted) DEPENDS ${DEPS_BIN_DIR}/busted)
# lua-messagepack doesn't depend on busted, but luarocks is unhappy to have
# two instances running in parallel. So we depend on busted to force it to
# be serialized.
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack
COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build lua-messagepack CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
DEPENDS busted)
add_custom_target(lua-messagepack
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack)
# Like before, depend on lua-messagepack to ensure serialization of install
# commands
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lpeg
COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build lpeg CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
DEPENDS lua-messagepack)
add_custom_target(lpeg
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lpeg)
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client
COMMAND ${DEPS_BIN_DIR}/luarocks COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build https://raw.githubusercontent.com/neovim/lua-client/8cc5b6090ac61cd0bba53ba984f15792fbb64573/nvim-client-0.0.1-11.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR} ARGS build https://raw.githubusercontent.com/neovim/lua-client/8cc5b6090ac61cd0bba53ba984f15792fbb64573/nvim-client-0.0.1-11.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR}
DEPENDS lpeg libuv) DEPENDS busted libuv)
add_custom_target(nvim-client add_custom_target(nvim-client
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client) DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client)
list(APPEND THIRD_PARTY_DEPS stable-busted-deps busted lua-messagepack lpeg nvim-client) list(APPEND THIRD_PARTY_DEPS stable-busted-deps busted nvim-client)
endif()