Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] build: support build using Ninja
@ 2022-05-23 12:01 Sergey Bronnikov via Tarantool-patches
  2022-05-26 16:21 ` Igor Munkin via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2022-05-23 12:01 UTC (permalink / raw)
  To: tarantool-patches

By default CMake generates files suitable for building a project with
Make. However, it allows to generate files for Ninja too. Ninja [1] may
build project a bit faster than Make, see [2]. Patch adds changes
required for building with Ninja.

How-to build wit Ninja:

$ cmake -G Ninja -B build -S .
$ ninja -C build luajit

On my laptop Ninja reduces building time by 14% (with Make it takes 5.7
sec, with Ninja 3.9 sec). It is not so much, but without Ninja support in
LuaJIT it is not possible to build Tarantool with Ninja.

1. https://ninja-build.org/
2. https://mesonbuild.com/Simple-comparison.html
---
 src/CMakeLists.txt      | 4 ++--
 src/host/CMakeLists.txt | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1a3f106a..338878fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -315,7 +315,7 @@ target_link_libraries(libluajit_shared ${TARGET_LIBS})
 
 add_executable(luajit_static EXCLUDE_FROM_ALL ${CLI_SOURCES})
 set_target_properties(luajit_static PROPERTIES
-  OUTPUT_NAME "${LUAJIT_CLI_NAME}"
+  OUTPUT_NAME "${LUAJIT_CLI_NAME}-static"
   COMPILE_FLAGS "${TARGET_C_FLAGS}"
   LINK_FLAGS "${TARGET_BIN_FLAGS}"
   RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
@@ -327,7 +327,7 @@ target_link_libraries(luajit_static libluajit_static ${TARGET_LIBS})
 
 add_executable(luajit_shared EXCLUDE_FROM_ALL ${CLI_SOURCES})
 set_target_properties(luajit_shared PROPERTIES
-  OUTPUT_NAME "${LUAJIT_CLI_NAME}"
+  OUTPUT_NAME "${LUAJIT_CLI_NAME}-shared"
   COMPILE_FLAGS "${TARGET_C_FLAGS}"
   LINK_FLAGS "${TARGET_BIN_FLAGS}"
   RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt
index e01db87d..1ce3e224 100644
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -25,11 +25,12 @@ set(DYNASM_DIR ${PROJECT_SOURCE_DIR}/dynasm)
 set(DYNASM_DASC "${LUAJIT_SOURCE_DIR}/vm_${DYNASM_ARCH}.dasc")
 set(DYNASM ${HOST_LUA} ${DYNASM_DIR}/dynasm.lua)
 
+file(GLOB DYNASM_LUA ${DYNASM_DIR}/*.lua)
 add_custom_command(
   COMMENT "Generating buildvm_arch.h"
   OUTPUT buildvm_arch.h
   COMMAND ${DYNASM} ${DYNASM_FLAGS} -o buildvm_arch.h ${DYNASM_DASC}
-  DEPENDS ${MINILUA} ${DYNASM_DASC} ${DYNASM_DIR}/*.lua
+  DEPENDS ${MINILUA} ${DYNASM_DASC} ${DYNASM_LUA}
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 )
 
@@ -47,8 +48,9 @@ add_executable(buildvm EXCLUDE_FROM_ALL
   # *sources* list.
   buildvm_arch.h
 )
+file(GLOB DASM_HEADERS ${DYNASM_DIR}/dasm_*.h)
 set_source_files_properties(buildvm.c PROPERTIES
-  OBJECT_DEPENDS ${DYNASM_DIR}/dasm_*.h
+  OBJECT_DEPENDS "${DASM_HEADERS}"
 )
 set_target_properties(buildvm PROPERTIES
   COMPILE_FLAGS "${HOST_C_FLAGS} ${TARGET_C_FLAGS}"
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] build: support build using Ninja
  2022-05-23 12:01 [Tarantool-patches] [PATCH] build: support build using Ninja Sergey Bronnikov via Tarantool-patches
@ 2022-05-26 16:21 ` Igor Munkin via Tarantool-patches
  2022-06-02 13:21   ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2022-05-26 16:21 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches

Sergey,

Thanks for the patch! I only dump our offline discussion:
* We decided to add a separate CI pipeline to prevent ninja build to be
  broken again. It will be run on Linux/x86_64 with no CMake
  specification at all (i.e. -DLUAJIT_ENABLE_GC64=OFF and
  -DCMAKE_BUILD_TYPE=Release).
* We decided to refactor the targets related to LuaJIT executable, since
  ninja forbids using different targets building the same name. Hence
  instead of using parameterized dependencies of the fixed targets,
  let's use parameterized targets with fixed dependencies (hope it's
  not too tricky wording for you).

On 23.05.22, Sergey Bronnikov wrote:
> By default CMake generates files suitable for building a project with
> Make. However, it allows to generate files for Ninja too. Ninja [1] may
> build project a bit faster than Make, see [2]. Patch adds changes
> required for building with Ninja.

Minor: Please, describe these changes in detail.

> 
> How-to build wit Ninja:

Typo: s/wit/with/.

> 
> $ cmake -G Ninja -B build -S .
> $ ninja -C build luajit
> 
> On my laptop Ninja reduces building time by 14% (with Make it takes 5.7
> sec, with Ninja 3.9 sec). It is not so much, but without Ninja support in
> LuaJIT it is not possible to build Tarantool with Ninja.

Minor: This rationale can be moved below (after ---), since I see no
reason to mention particular results in the commit message. The links
below are more than enough.

> 
> 1. https://ninja-build.org/
> 2. https://mesonbuild.com/Simple-comparison.html
> ---
>  src/CMakeLists.txt      | 4 ++--
>  src/host/CMakeLists.txt | 6 ++++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 

<snipped>

> -- 
> 2.25.1
> 

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] build: support build using Ninja
  2022-05-26 16:21 ` Igor Munkin via Tarantool-patches
@ 2022-06-02 13:21   ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2022-06-02 13:21 UTC (permalink / raw)
  To: Igor Munkin; +Cc: tarantool-patches

Igor, thanks for your review!

I have addressed all issues in patch series v2 (send in a separate thread).


Sergey

On 26.05.2022 19:21, Igor Munkin wrote:
> Sergey,
>
> Thanks for the patch! I only dump our offline discussion:
> * We decided to add a separate CI pipeline to prevent ninja build to be
>    broken again. It will be run on Linux/x86_64 with no CMake
>    specification at all (i.e. -DLUAJIT_ENABLE_GC64=OFF and
>    -DCMAKE_BUILD_TYPE=Release).

Added in a separate commit.

> * We decided to refactor the targets related to LuaJIT executable, since
>    ninja forbids using different targets building the same name. Hence
>    instead of using parameterized dependencies of the fixed targets,
>    let's use parameterized targets with fixed dependencies (hope it's
>    not too tricky wording for you).

We discussed it at least two times and to avoid conflict by names

I have renamed default target and create target for building cli binary 
only once.

>
> On 23.05.22, Sergey Bronnikov wrote:
>> By default CMake generates files suitable for building a project with
>> Make. However, it allows to generate files for Ninja too. Ninja [1] may
>> build project a bit faster than Make, see [2]. Patch adds changes
>> required for building with Ninja.
> Minor: Please, describe these changes in detail.
Every change for fixing Ninja build added as a separate commit with a 
short problem description.
>
>> How-to build wit Ninja:
> Typo: s/wit/with/.


Fixed.

>
>> $ cmake -G Ninja -B build -S .
>> $ ninja -C build luajit
>>
>> On my laptop Ninja reduces building time by 14% (with Make it takes 5.7
>> sec, with Ninja 3.9 sec). It is not so much, but without Ninja support in
>> LuaJIT it is not possible to build Tarantool with Ninja.
> Minor: This rationale can be moved below (after ---), since I see no
> reason to mention particular results in the commit message. The links
> below are more than enough.
Moved to a cover letter.
>> 1. https://ninja-build.org/
>> 2. https://mesonbuild.com/Simple-comparison.html
>> ---
>>   src/CMakeLists.txt      | 4 ++--
>>   src/host/CMakeLists.txt | 6 ++++--
>>   2 files changed, 6 insertions(+), 4 deletions(-)
>>
> <snipped>
>
>> -- 
>> 2.25.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-02 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 12:01 [Tarantool-patches] [PATCH] build: support build using Ninja Sergey Bronnikov via Tarantool-patches
2022-05-26 16:21 ` Igor Munkin via Tarantool-patches
2022-06-02 13:21   ` Sergey Bronnikov via Tarantool-patches

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