build: respect $DEPS_BUILD_DIR

Without this, the CI_TARGET=lint travis job cant't find the cached deps
(in $HOME/nvim-deps), nor can it update the cache.
This commit is contained in:
Justin M. Keyes 2018-03-11 13:15:42 +01:00
parent 45e81e03f8
commit 9a0147754c
2 changed files with 17 additions and 7 deletions

View File

@ -12,7 +12,11 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(PreventInTreeBuilds) include(PreventInTreeBuilds)
# Prefer our bundled versions of dependencies. # Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR})
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
else()
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies") set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
if(CMAKE_CROSSCOMPILING AND NOT UNIX) if(CMAKE_CROSSCOMPILING AND NOT UNIX)
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX}) list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin) list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)

View File

@ -1,3 +1,4 @@
THIS_DIR = $(shell pwd)
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1)) filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1)) filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
@ -11,6 +12,11 @@ CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles") echo "Unix Makefiles")
DEPS_BUILD_DIR ?= .deps
ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
$(error DEPS_BUILD_DIR must not contain whitespace)
endif
ifeq (,$(BUILD_TOOL)) ifeq (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE)) ifeq (Ninja,$(BUILD_TYPE))
@ -46,7 +52,7 @@ endif
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS))) ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
$(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*) $(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*)
endif endif
# For use where we want to make sure only a single job is run. This does issue # For use where we want to make sure only a single job is run. This does issue
@ -66,20 +72,20 @@ cmake:
$(MAKE) build/.ran-cmake $(MAKE) build/.ran-cmake
build/.ran-cmake: | deps build/.ran-cmake: | deps
cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) .. cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(THIS_DIR)
touch $@ touch $@
deps: | build/.ran-third-party-cmake deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
+$(BUILD_CMD) -C .deps +$(BUILD_CMD) -C $(DEPS_BUILD_DIR)
endif endif
build/.ran-third-party-cmake: build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps mkdir -p $(DEPS_BUILD_DIR)
cd .deps && \ cd $(DEPS_BUILD_DIR) && \
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party $(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party
endif endif
mkdir -p build mkdir -p build
touch $@ touch $@
@ -122,7 +128,7 @@ clean:
$(MAKE) -C runtime/doc clean $(MAKE) -C runtime/doc clean
distclean: clean distclean: clean
rm -rf .deps build rm -rf $(DEPS_BUILD_DIR) build
install: | nvim install: | nvim
+$(BUILD_CMD) -C build install +$(BUILD_CMD) -C build install