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
Subject: [Tarantool-patches] [PATCH v2 2/3] gitlab-ci: add out-of-source build
Date: Wed, 22 Apr 2020 20:44:44 +0300	[thread overview]
Message-ID: <a4e3e096397448219d25a44772aee8bba9b20ce2.1587577457.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <cover.1587577066.git.avtikhon@tarantool.org>
In-Reply-To: <cover.1587577457.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.

Part of #4258
---
 .gitlab-ci.yml           |  7 +++++++
 .travis.mk               | 18 ++++++++++++++++++
 cmake/BuildLibCURL.cmake |  6 +++---
 cmake/utils.cmake        |  4 ++--
 src/box/CMakeLists.txt   |  3 ++-
 5 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fd265aa60..cbf02f8f5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -98,6 +98,13 @@ variables:
 
 # Tests
 
+out_of_source:
+  stage: test
+  tags:
+    - deploy_test
+  script:
+    - docker run -w /tmp/ro_src --mount type=bind,source="${PWD}",target=/tmp/ro_src,readonly,bind-propagation=rslave -i registry.gitlab.com/tarantool/tarantool/testing/debian-stretch:latest make -f /tmp/ro_src/.travis.mk test_outofsrc_no_deps
+
 release:
   <<: *docker_test_definition
   script:
diff --git a/.travis.mk b/.travis.mk
index 8aa0e6116..5cde9d22e 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -6,6 +6,8 @@ DOCKER_IMAGE?=packpack/packpack:debian-stretch
 TEST_RUN_EXTRA_PARAMS?=
 MAX_FILES?=65534
 MAX_PROC?=2500
+STARTED_AT_PATH=$(shell pwd)
+OUT_OF_SRC_BLD_PATH=/tmp/rw_bins
 
 all: package
 
@@ -74,6 +76,22 @@ deps_buster_clang_8: deps_debian
 	apt-get update
 	apt-get install -y clang-8 llvm-8-dev
 
+# Out-of-source build
+
+build_outofsrc:
+	rm -rf ${OUT_OF_SRC_BLD_PATH} && \
+		mkdir ${OUT_OF_SRC_BLD_PATH} && \
+		cd ${OUT_OF_SRC_BLD_PATH} && \
+		cmake ${STARTED_AT_PATH} \
+			-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+			-DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS} && \
+		make -j
+
+test_outofsrc_no_deps: build_outofsrc
+	cd ${OUT_OF_SRC_BLD_PATH} && make test-force
+
+test_outofsrc: deps_debian test_outofsrc_no_deps
+
 # Release
 
 build_debian:
diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake
index 5f8b15a63..753b7293a 100644
--- a/cmake/BuildLibCURL.cmake
+++ b/cmake/BuildLibCURL.cmake
@@ -56,10 +56,10 @@ macro(curl_build)
         DOWNLOAD_DIR ${LIBCURL_BINARY_DIR}
         TMP_DIR ${LIBCURL_BINARY_DIR}/tmp
         STAMP_DIR ${LIBCURL_BINARY_DIR}/stamp
-        BINARY_DIR ${LIBCURL_BINARY_DIR}
+        BINARY_DIR ${LIBCURL_BINARY_DIR}/curl
         CONFIGURE_COMMAND
-            cd <SOURCE_DIR> && ./buildconf &&
-            cd <BINARY_DIR> && <SOURCE_DIR>/configure
+            rm -rf <BINARY_DIR> && cp -rf <SOURCE_DIR> <BINARY_DIR> &&
+            cd <BINARY_DIR> && ./buildconf && ./configure
                 # Pass the same toolchain as is used to build
                 # tarantool itself, because they can be
                 # incompatible.
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index 3ab2d3ff2..6044ea7c0 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(${varname} ${var} "${CMAKE_BINARY_DIR}/${dstfile}" PARENT_SCOPE)
     set (srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
-    set (dstfile "${CMAKE_CURRENT_SOURCE_DIR}/${dstfile}")
+    set (dstfile "${CMAKE_BINARY_DIR}/${dstfile}")
     set (tmpfile "${dstfile}.tmp")
     get_filename_component(module ${dstfile} NAME_WE)
 
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index c931ecdfe..51b0006b1 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -23,7 +23,7 @@ lua_source(lua_sources lua/xlog.lua)
 lua_source(lua_sources lua/key_def.lua)
 lua_source(lua_sources lua/merger.lua)
 set(bin_sources)
-bin_source(bin_sources bootstrap.snap bootstrap.h)
+bin_source(bin_sources bootstrap.snap src/box/bootstrap.h)
 
 add_custom_target(box_generate_lua_sources
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/box
@@ -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(box_error STATIC error.cc errcode.c vclock.c mp_error.cc)
 target_link_libraries(box_error core stat mpstream)
-- 
2.17.1

  parent reply	other threads:[~2020-04-22 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 17:44 [Tarantool-patches] [PATCH v2 0/3] " Alexander V. Tikhonov
     [not found] ` <cover.1587577457.git.avtikhon@tarantool.org>
2020-04-22 17:44   ` [Tarantool-patches] [PATCH v2 1/3] Fix curl repository for " Alexander V. Tikhonov
2020-04-22 17:44   ` Alexander V. Tikhonov [this message]
2020-04-25  7:17     ` [Tarantool-patches] [PATCH v2 2/3] gitlab-ci: add " Alexander Turenko
2020-05-13  7:40       ` Alexander V. Tikhonov
2020-06-08 13:32         ` Alexander Turenko
2020-04-22 17:44   ` [Tarantool-patches] [PATCH v2 3/3] Skip failing test from " Alexander V. Tikhonov
2020-04-25  7:24     ` Alexander Turenko

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=a4e3e096397448219d25a44772aee8bba9b20ce2.1587577457.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/3] 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