From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id B38677346C0; Thu, 1 Feb 2024 17:20:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B38677346C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1706797218; bh=LEZJC7PsKSuietu7AY7AQex9AJvdw4q83dPNh+7kKBI=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=D9nIB9hhVf4IUrifukPJIRNKT0he1njw6ZUjaLj1gfATLkrXHqSo84Y9M7KDD7Ddt y7Nx2b8TmoNRbPt3HGF5wMutkyfHsvrTo7DZ4nfp6Y8Pa1qkYpKDvMnXmKrHtBuDM8 3z429e5y94Txfm11K1jEpT9cbPWNyR7zkt1BXSk0= Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [95.163.41.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E029F7346C0 for ; Thu, 1 Feb 2024 17:20:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E029F7346C0 Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1rVXvL-00000007Xf7-1kJM; Thu, 01 Feb 2024 17:20:15 +0300 Message-ID: <654211a6-6763-4c44-b2b5-c117897523d1@tarantool.org> Date: Thu, 1 Feb 2024 17:20:14 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: <9075481da3fd5f4d2d4f7b5bb99eb3590b104693.1706520765.git.skaplun@tarantool.org> In-Reply-To: <9075481da3fd5f4d2d4f7b5bb99eb3590b104693.1706520765.git.skaplun@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9010253A383FA2A7567C599F0FBB4D1E9FC8419B02EE499C3182A05F5380850407FDBFDA798B0E2F891417EB218679B82FB2E5179766C77024F260441819476B8A035D568507C15B2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AB524098FB2F2222EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FBAD23C389CEF1EB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88D05E916BCFADF73642719B5198A0977CA99B3046DB7D9BBCC7F00164DA146DAFE8445B8C89999728AA50765F79006370BDB19F53EE528DD389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8ED96AA85C75E140D117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF37F46C620FF2CAEE76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B2BE06DBDC430765AD81D268191BDAD3D3666184CF4C3C14F3FC91FA280E0CE3D1A620F70A64A45A98AA50765F7900637A451E1E29F2EDBED6D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637E62180BDA7F10F15EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5839C76A08F6E0FBB5002B1117B3ED696F199EDF4BBFDD0B21BDDAE3D1EA49BEA823CB91A9FED034534781492E4B8EEAD543F342AA183667FBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFFC43265DFB86BE146AE65A154E5ABE3EB33F4B96ED1E81BF8665E4F9658FC2E5A96D85E4AF70DF37BAF4CF3B87E910B1631A2D52B829B5C928FDC85E3899D27913177D2D8A2220495F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojqJaWtPsRtykQDe0XcGNu+w== X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F258845846B2B0E28F025C33582B80AE0CC324093793791EC9B95B459DEF538F1029BAD6645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 01/26] cmake: introduce AddTestLib macro X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey thanks for the patch! LGTM On 1/29/24 13:45, Sergey Kaplun wrote: > This patch removes copy-pasting in macros used to add a new library for > testing and places this in the include test file. > > Needed for tarantool/tarantool#9398 > --- > test/CMakeLists.txt | 3 ++ > .../PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt | 25 +---------------- > test/cmake/AddTestLib.cmake | 28 +++++++++++++++++++ > test/tarantool-tests/CMakeLists.txt | 27 +----------------- > 4 files changed, 33 insertions(+), 50 deletions(-) > create mode 100644 test/cmake/AddTestLib.cmake > > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt > index 8afc42df..3ad5d15f 100644 > --- a/test/CMakeLists.txt > +++ b/test/CMakeLists.txt > @@ -74,6 +74,9 @@ add_custom_target(${PROJECT_NAME}-lint DEPENDS > set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]") > separate_arguments(LUAJIT_TEST_COMMAND) > > +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") > +include(AddTestLib) > + > add_subdirectory(LuaJIT-tests) > add_subdirectory(PUC-Rio-Lua-5.1-tests) > add_subdirectory(lua-Harness-tests) > diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt > index 8501b767..e68e6aef 100644 > --- a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt > +++ b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt > @@ -6,30 +6,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) > > # Build additional C libraries for tests. > macro(BuildTestCLib lib sources) > - add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources}) > - target_include_directories(${lib} PRIVATE > - ${LUAJIT_SOURCE_DIR} > - ) > - set_target_properties(${lib} PROPERTIES > - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" > - PREFIX "" > - ) > - # XXX: The dynamic libraries are loaded with LuaJIT binary and > - # use symbols from it. So it is totally OK to have unresolved > - # symbols at build time. > - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > - set_target_properties(${lib} PROPERTIES > - LINK_FLAGS "-undefined dynamic_lookup" > - ) > - elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") > - # XXX: This is necessary mostly for openSUSE builds, see also > - # https://bugzilla.suse.com/show_bug.cgi?id=1012388. > - # Just strip out the linker flag to suppress this linker > - # option. > - string(REPLACE "-Wl,--no-undefined" "" > - CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" > - ) > - endif() > + AddTestLib(${lib} ${sources}) > list(APPEND TESTLIBS ${lib}) > endmacro() > > diff --git a/test/cmake/AddTestLib.cmake b/test/cmake/AddTestLib.cmake > new file mode 100644 > index 00000000..3764ee5c > --- /dev/null > +++ b/test/cmake/AddTestLib.cmake > @@ -0,0 +1,28 @@ > +macro(AddTestLib lib sources) > + add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources}) > + target_include_directories(${lib} PRIVATE > + ${LUAJIT_SOURCE_DIR} > + ${CMAKE_CURRENT_SOURCE_DIR} > + ) > + set_target_properties(${lib} PROPERTIES > + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" > + PREFIX "" > + ) > + > + # XXX: This change affects the current cmake variable scope and > + # so a user should care to don't use it in a top level scope. > + # The dynamic libraries are loaded with LuaJIT binary and use > + # symbols from it. So it is totally OK to have unresolved > + # symbols at build time. > + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > + set_target_properties(${lib} PROPERTIES > + LINK_FLAGS "-undefined dynamic_lookup" > + ) > + else() > + # FIXME: Unfortunately, there is no another way to suppress > + # this linker option, so just strip it out from the flags. > + string(REPLACE "-Wl,--no-undefined" "" > + CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" > + ) > + endif() > +endmacro() > diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt > index 6d686876..80d94a78 100644 > --- a/test/tarantool-tests/CMakeLists.txt > +++ b/test/tarantool-tests/CMakeLists.txt > @@ -11,32 +11,7 @@ if(NOT PROVE) > endif() > > macro(BuildTestCLib lib sources) > - add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources}) > - target_include_directories(${lib} PRIVATE > - ${LUAJIT_SOURCE_DIR} > - ${CMAKE_CURRENT_SOURCE_DIR} > - ) > - set_target_properties(${lib} PROPERTIES > - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" > - PREFIX "" > - ) > - > - # XXX: This change affects the current cmake variable scope and > - # so a user should care to don't use it in a top level scope. > - # The dynamic libraries are loaded with LuaJIT binary and use > - # symbols from it. So it is totally OK to have unresolved > - # symbols at build time. > - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > - set_target_properties(${lib} PROPERTIES > - LINK_FLAGS "-undefined dynamic_lookup" > - ) > - else() > - # FIXME: Unfortunately, there is no another way to suppress > - # this linker option, so just strip it out from the flags. > - string(REPLACE "-Wl,--no-undefined" "" > - CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" > - ) > - endif() > + AddTestLib(${lib} ${sources}) > # XXX: Append the lib to be built to the dependency list. > # Unfortunately, there is no convenient way in CMake to extend > # the list in parent scope other than join two strings with