Skip to content

Commit ac98986

Browse files
CuriousGeorgiyalyapunov
authored andcommitted
Test: replace the bundled msgpuck library with a FetchContent call
Replace bundled msgpuck library with `FetchContent` call during test build configuration for simpler maintenance: remove the `MP_LIBRARY` macro definition from EncDecGPerfTest, since we now link directly against the `msgpuck` library target exported by the tarantool/msgpuck project. Unfortunately, the `msgpuck` library target does not have interface headers set, so we need to manually set the header include directory. Closes #60
1 parent ac90048 commit ac98986

File tree

4 files changed

+12
-3894
lines changed

4 files changed

+12
-3894
lines changed

CMakeLists.txt

+12-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ IF (TNTCXX_BUILD_TESTING)
7272
CONFIGURE_FILE(./test/cfg.lua test_cfg.lua COPYONLY)
7373
CONFIGURE_FILE(./test/cfg_ssl.lua test_cfg_ssl.lua COPYONLY)
7474
CONFIGURE_FILE(./test/gen_ssl.sh test_gen_ssl.sh COPYONLY)
75+
76+
INCLUDE(FetchContent)
77+
FETCHCONTENT_DECLARE(
78+
msgpuck
79+
GIT_REPOSITORY https://github.com/tarantool/msgpuck.git
80+
)
81+
# Retrieve the source directory to later get the header path.
82+
FETCHCONTENT_GETPROPERTIES(msgpuck)
83+
FETCHCONTENT_MAKEAVAILABLE(msgpuck)
7584
ENDIF()
7685

7786
OPTION(TNTCXX_ENABLE_SANITIZERS
@@ -126,7 +135,8 @@ FUNCTION (TNTCXX_TEST)
126135
TARGET_SOURCES(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_SOURCES})
127136
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_LIBRARIES})
128137
IF (${TNTCXX_TEST_TYPE} STREQUAL "gperftest")
129-
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE benchmark::benchmark)
138+
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE benchmark::benchmark msgpuck)
139+
TARGET_INCLUDE_DIRECTORIES(${TNTCXX_TEST_NAME} PRIVATE ${msgpuck_SOURCE_DIR})
130140
ENDIF()
131141
TARGET_COMPILE_DEFINITIONS(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_DEFINES})
132142
IF (${TNTCXX_TEST_TYPE} STREQUAL "ctest")
@@ -221,7 +231,7 @@ TNTCXX_TEST(NAME ClientPerf.test TYPE perftest
221231
)
222232

223233
TNTCXX_TEST(NAME EncDecGPerf.test TYPE gperftest
224-
SOURCES src/mpp/mpp.hpp test/EncDecGPerfTest.cpp test/hints.c
234+
SOURCES src/mpp/mpp.hpp test/EncDecGPerfTest.cpp
225235
)
226236

227237
TNTCXX_TEST(NAME SimpleExample TYPE other

test/EncDecGPerfTest.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <random>
3737

3838
#include "../src/mpp/mpp.hpp"
39-
#define MP_LIBRARY 1
4039
#include "msgpuck.h"
4140

4241
enum random_variant {

0 commit comments

Comments
 (0)