Skip to content

Commit

Permalink
Test: replace the bundled msgpuck library with a FetchContent call
Browse files Browse the repository at this point in the history
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
  • Loading branch information
CuriousGeorgiy authored and alyapunov committed Dec 7, 2023
1 parent ac90048 commit ac98986
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3,894 deletions.
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ IF (TNTCXX_BUILD_TESTING)
CONFIGURE_FILE(./test/cfg.lua test_cfg.lua COPYONLY)
CONFIGURE_FILE(./test/cfg_ssl.lua test_cfg_ssl.lua COPYONLY)
CONFIGURE_FILE(./test/gen_ssl.sh test_gen_ssl.sh COPYONLY)

INCLUDE(FetchContent)
FETCHCONTENT_DECLARE(
msgpuck
GIT_REPOSITORY https://github.com/tarantool/msgpuck.git
)
# Retrieve the source directory to later get the header path.
FETCHCONTENT_GETPROPERTIES(msgpuck)
FETCHCONTENT_MAKEAVAILABLE(msgpuck)
ENDIF()

OPTION(TNTCXX_ENABLE_SANITIZERS
Expand Down Expand Up @@ -126,7 +135,8 @@ FUNCTION (TNTCXX_TEST)
TARGET_SOURCES(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_SOURCES})
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_LIBRARIES})
IF (${TNTCXX_TEST_TYPE} STREQUAL "gperftest")
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE benchmark::benchmark)
TARGET_LINK_LIBRARIES(${TNTCXX_TEST_NAME} PRIVATE benchmark::benchmark msgpuck)
TARGET_INCLUDE_DIRECTORIES(${TNTCXX_TEST_NAME} PRIVATE ${msgpuck_SOURCE_DIR})
ENDIF()
TARGET_COMPILE_DEFINITIONS(${TNTCXX_TEST_NAME} PRIVATE ${TNTCXX_TEST_DEFINES})
IF (${TNTCXX_TEST_TYPE} STREQUAL "ctest")
Expand Down Expand Up @@ -221,7 +231,7 @@ TNTCXX_TEST(NAME ClientPerf.test TYPE perftest
)

TNTCXX_TEST(NAME EncDecGPerf.test TYPE gperftest
SOURCES src/mpp/mpp.hpp test/EncDecGPerfTest.cpp test/hints.c
SOURCES src/mpp/mpp.hpp test/EncDecGPerfTest.cpp
)

TNTCXX_TEST(NAME SimpleExample TYPE other
Expand Down
1 change: 0 additions & 1 deletion test/EncDecGPerfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <random>

#include "../src/mpp/mpp.hpp"
#define MP_LIBRARY 1
#include "msgpuck.h"

enum random_variant {
Expand Down
Loading

0 comments on commit ac98986

Please sign in to comment.