From 5f4b73644a606f9414a73e58e893cb8cd5a58758 Mon Sep 17 00:00:00 2001 From: Joel Andres Granados Date: Thu, 29 Sep 2022 12:42:52 -0700 Subject: [PATCH] cmake : Add ALL plugin LIBS to THIRD_PARTYLIBS (#10727) Summary: Bringing in multiple libraries failed as they were not considered as separate arguments. In this commit we make sure to add *all* the libraries to THIRD_PARTYLIBS. Additionally we add more informative status messages for when the plugins get added. Signed-off-by: Joel Granados Pull Request resolved: https://github.com/facebook/rocksdb/pull/10727 Reviewed By: riversand963 Differential Revision: D39778566 Pulled By: ajkr fbshipit-source-id: 34306b26ab4c726d17353ddd765f368967a1b59f --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b00f31d23..73d5b52a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1065,28 +1065,34 @@ set(ROCKSDB_PLUGIN_BUILTINS "") message(STATUS "ROCKSDB PLUGINS TO BUILD ${ROCKSDB_PLUGINS}") foreach(PLUGIN IN LISTS PLUGINS) set(PLUGIN_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/plugin/${PLUGIN}/") - message("including rocksb plugin ${PLUGIN_ROOT}") + message(STATUS "PLUGIN ${PLUGIN} including rocksb plugin ${PLUGIN_ROOT}") set(PLUGINMKFILE "${PLUGIN_ROOT}${PLUGIN}.mk") if (NOT EXISTS ${PLUGINMKFILE}) - message(FATAL_ERROR "Missing plugin makefile: ${PLUGINMKFILE}") + message(FATAL_ERROR "PLUGIN ${PLUGIN} Missing plugin makefile: ${PLUGINMKFILE}") endif() file(READ ${PLUGINMKFILE} PLUGINMK) + string(REGEX MATCH "SOURCES = ([^\n]*)" FOO ${PLUGINMK}) set(MK_SOURCES ${CMAKE_MATCH_1}) separate_arguments(MK_SOURCES) foreach(MK_FILE IN LISTS MK_SOURCES) list(APPEND SOURCES "${PLUGIN_ROOT}${MK_FILE}") + message(STATUS "PLUGIN ${PLUGIN} Appending ${PLUGIN_ROOT}${MK_FILE} to SOURCES") endforeach() + string(REGEX MATCH "_FUNC = ([^\n]*)" FOO ${PLUGINMK}) if (NOT ${CMAKE_MATCH_1} STREQUAL "") string(APPEND ROCKSDB_PLUGIN_BUILTINS "{\"${PLUGIN}\", " ${CMAKE_MATCH_1} "},") string(APPEND ROCKSDB_PLUGIN_EXTERNS "int " ${CMAKE_MATCH_1} "(ROCKSDB_NAMESPACE::ObjectLibrary&, const std::string&); ") endif() + string(REGEX MATCH "_LIBS = ([^\n]*)" FOO ${PLUGINMK}) - if (NOT ${CMAKE_MATCH_1} STREQUAL "") - list(APPEND THIRDPARTY_LIBS "${CMAKE_MATCH_1}") - endif() - message("THIRDPARTY_LIBS=${THIRDPARTY_LIBS}") + separate_arguments(CMAKE_MATCH_1) + foreach(MK_LIB IN LISTS CMAKE_MATCH_1) + list(APPEND THIRDPARTY_LIBS "${MK_LIB}") + endforeach() + message(STATUS "PLUGIN ${PLUGIN} THIRDPARTY_LIBS=${THIRDPARTY_LIBS}") + #TODO: We need to set any compile/link-time flags and add any link libraries endforeach()