Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Oleg Piskunov <o.piskunov@tarantool.org>,
	Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org,
	Alexander Turenko <alexander.turenko@tarantool.org>
Subject: [Tarantool-patches] [PATCH v2 7/7] gitlab-ci: add out-of-source build
Date: Tue, 26 May 2020 17:42:38 +0300	[thread overview]
Message-ID: <ff33d08421bcf911922f9af618f05f4e0fbfb3fa.1590503508.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <cover.1590503508.git.avtikhon@tarantool.org>
In-Reply-To: <cover.1590503508.git.avtikhon@tarantool.org>

Implemented out-of-source build at cmake files.
Added out of source build make targets and added
test job to gitlab-ci.

Closes #4874
---
 .gitlab-ci.yml         |  7 +++++++
 .travis.mk             | 26 ++++++++++++++++++++++++++
 cmake/utils.cmake      |  4 ++--
 src/box/CMakeLists.txt |  1 +
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 256b368c4..d05c80692 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -105,6 +105,13 @@ variables:
 
 # Tests
 
+out_of_source:
+  stage: test
+  tags:
+    - deploy_test
+  script:
+    - ${GITLAB_MAKE} test_oos_build
+
 release:
   <<: *docker_test_definition
   script:
diff --git a/.travis.mk b/.travis.mk
index 063537f25..a7717c92a 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -3,9 +3,13 @@
 #
 
 DOCKER_IMAGE?=packpack/packpack:debian-stretch
+DOCKER_TEST_IMAGE?=registry.gitlab.com/tarantool/tarantool/testing/debian-stretch:latest
 TEST_RUN_EXTRA_PARAMS?=
 MAX_FILES?=65534
 MAX_PROC?=2500
+OOS_SRC_PATH?=/source
+OOS_BUILD_PATH?=/rw_bins
+OOS_BUILD_RULE?=test_oos_no_deps
 
 all: package
 
@@ -146,6 +150,28 @@ test_static_build: deps_debian_static
 test_static_docker_build:
 	docker build --no-cache --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .
 
+# Out-Of-Source build
+
+build_oos:
+	mkdir ${OOS_BUILD_PATH} 2>/dev/null || : ; \
+		cd ${OOS_BUILD_PATH} && \
+		cmake ${OOS_SRC_PATH} ${CMAKE_EXTRA_PARAMS} && \
+		make -j
+
+test_oos_no_deps: build_oos
+	cd ${OOS_BUILD_PATH}/test && \
+		OUTOFSRC_BUILD=ON ${OOS_SRC_PATH}/test/test-run.py \
+			--builddir ${OOS_BUILD_PATH} \
+			--vardir ${OOS_BUILD_PATH}/test/var --force
+
+test_oos: deps_debian test_oos_no_deps
+
+test_oos_build:
+	docker run --network=host -w ${OOS_SRC_PATH} \
+		--mount type=bind,source="${PWD}",target=${OOS_SRC_PATH},readonly,bind-propagation=rslave \
+		-i ${DOCKER_TEST_IMAGE} \
+		make -f .travis.mk ${OOS_BUILD_RULE}
+
 #######
 # OSX #
 #######
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index 3ab2d3ff2..eaec821b3 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -70,9 +70,9 @@ endfunction()
 
 function(bin_source varname srcfile dstfile)
     set(var ${${varname}})
-    set(${varname} ${var} ${dstfile} PARENT_SCOPE)
     set (srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
-    set (dstfile "${CMAKE_CURRENT_SOURCE_DIR}/${dstfile}")
+    set (dstfile "${CMAKE_CURRENT_BINARY_DIR}/${dstfile}")
+    set(${varname} ${var} "${dstfile}" PARENT_SCOPE)
     set (tmpfile "${dstfile}.tmp")
     get_filename_component(module ${dstfile} NAME_WE)
 
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index 7dc94d893..feec2de01 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -32,6 +32,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 
 include_directories(${ZSTD_INCLUDE_DIRS})
 include_directories(${CMAKE_BINARY_DIR}/src/box/sql)
+include_directories(${CMAKE_BINARY_DIR}/src/box)
 
 add_library(vclock STATIC vclock.c)
 target_link_libraries(vclock core)
-- 
2.17.1

      parent reply	other threads:[~2020-05-26 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 14:42 [Tarantool-patches] [PATCH v2 0/7] Implement OOS build Alexander V. Tikhonov
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 1/7] build: static build needs more cleanup in sources Alexander V. Tikhonov
2020-06-26 13:51   ` Alexander Turenko
2020-07-03 11:13   ` Kirill Yukhin
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 2/7] build: fix static build w/ dockerfile with cmake Alexander V. Tikhonov
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 3/7] build: enable cmake in curl build Alexander V. Tikhonov
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 4/7] Fix curl repository for out-of-source build Alexander V. Tikhonov
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 5/7] build: change autoconf to cmake in curl build Alexander V. Tikhonov
2020-05-26 14:42 ` [Tarantool-patches] [PATCH v2 6/7] Skip failing test from out-of-source build Alexander V. Tikhonov
2020-05-26 14:42 ` Alexander V. Tikhonov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff33d08421bcf911922f9af618f05f4e0fbfb3fa.1590503508.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 7/7] gitlab-ci: add out-of-source build' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox