Переглянути джерело

Move RDKafka into 3rdparty dependency

Qiuyang 1 рік тому
батько
коміт
ed1ab95928

+ 2 - 2
cmake/FindRDKafka.cmake

@@ -5,6 +5,6 @@ set(RDKAFKA_INCLUDE_DIR ${RDKAFKA_DIR}/include)
 set(RDKAFKA_LINK_DIR ${RDKAFKA_DIR}/lib)
 
 set(RDKAFKA_LIBRARIES
-        rdkafka
-        rdkafka++
+        ${RDKAFKA_LINK_DIR}/librdkafka.so
+        ${RDKAFKA_LINK_DIR}/librdkafka++.so
 )

+ 1 - 1
cmake/FindZLToolKit.cmake

@@ -5,5 +5,5 @@ set(ZLTOOLKIT_INCLUDE_DIR ${ZLTOOLKIT_DIR}/include)
 set(ZLTOOLKIT_LINK_DIR ${ZLTOOLKIT_DIR}/lib)
 
 set(ZLTOOLKIT_LIBRARIES
-        ZLToolKit
+        ${ZLTOOLKIT_LINK_DIR}/libZLToolKit.so
 )

BIN
lib/libgsd_modules.so


BIN
lib/libgsd_plugins.so


+ 2 - 4
modules/CMakeLists.txt

@@ -33,12 +33,11 @@ set(CMAKE_MODULE_PATH ${GSD_ROOT_DIR}/cmake)
 
 # ---[ ZLToolKit
 find_package(ZLToolKit REQUIRED)
-link_directories(${ZLTOOLKIT_LINK_DIR})
+#link_directories(${ZLTOOLKIT_LINK_DIR})
 include_directories(${ZLTOOLKIT_INCLUDE_DIR})
 list(APPEND 3RDPARTY_LIBS ${ZLTOOLKIT_LIBRARIES})
 message(STATUS "ZLToolKit include: ${ZLTOOLKIT_INCLUDE_DIR}")
 message(STATUS "ZLToolKit libraries: ${ZLTOOLKIT_LIBRARIES}")
-message(STATUS "ZLToolKit link dir: ${ZLTOOLKIT_LINK_DIR}")
 
 # ---[ rapidjson
 include_directories(${GSD_ROOT_DIR}/3rdparty/)
@@ -96,10 +95,9 @@ if(build_kafka)
   find_package(RDKafka REQUIRED)
   include_directories(${RDKAFKA_INCLUDE_DIR})
   list(APPEND 3RDPARTY_LIBS ${RDKAFKA_LIBRARIES}) 
-  link_directories(${RDKAFKA_LINK_DIR})
+  #link_directories(${RDKAFKA_LINK_DIR})
   message(STATUS "RDKafka include: ${RDKAFKA_INCLUDE_DIR}")
   message(STATUS "RDKafka libraries: ${RDKAFKA_LIBRARIES}")
-  message(STATUS "RDKafka link dir: ${RDKAFKA_LINK_DIR}")
 endif()
 
 set(ENABLE_MYSQL ON CACHE BOOL "enable mysql")

+ 1 - 1
modules/Monitor/include/kafka_comsumer.h

@@ -8,7 +8,7 @@
 #include <getopt.h>
 #include <csignal>
 #include <iostream>
-#include "librdkafka/rdkafkacpp.h"
+#include "rdkafkacpp.h"
 #include "Util/util.h"
 #include "Util/logger.h"
  

+ 12 - 2
plugins/CMakeLists.txt

@@ -21,6 +21,7 @@ option(build_HttpPlugin "build module HttpPlugin" ON)
 option(build_MonitorPlugin "build module MonitorPlugin" ON)
 option(build_TcpPlugin "build module TcpPlugin" ON)
 option(build_AuditPlugin "build module AuditPlugin" ON)
+option(build_kafka           "build module kafka" ON)
 
 
 # ---[ 3rdparty
@@ -30,12 +31,11 @@ set(CMAKE_MODULE_PATH ${GSD_ROOT_DIR}/cmake)
 
 # ---[ ZLToolKit
 find_package(ZLToolKit REQUIRED)
-link_directories(${ZLTOOLKIT_LINK_DIR})
+#link_directories(${ZLTOOLKIT_LINK_DIR})
 include_directories(${ZLTOOLKIT_INCLUDE_DIR})
 list(APPEND 3RDPARTY_LIBS ${ZLTOOLKIT_LIBRARIES})
 message(STATUS "ZLToolKit include: ${ZLTOOLKIT_INCLUDE_DIR}")
 message(STATUS "ZLToolKit libraries: ${ZLTOOLKIT_LIBRARIES}")
-message(STATUS "ZLToolKit link dir: ${ZLTOOLKIT_LINK_DIR}")
 
 # ---[ rapidjson
 include_directories(${GSD_ROOT_DIR}/3rdparty/)
@@ -80,6 +80,16 @@ if(build_AuditPlugin)
   install(DIRECTORY AuditPlugin/include/ DESTINATION include)
 endif()
 
+# ---[ kafka
+if(build_kafka)
+  find_package(RDKafka REQUIRED)
+  include_directories(${RDKAFKA_INCLUDE_DIR})
+  list(APPEND 3RDPARTY_LIBS ${RDKAFKA_LIBRARIES}) 
+  #link_directories(${RDKAFKA_LINK_DIR})
+  message(STATUS "RDKafka include: ${RDKAFKA_INCLUDE_DIR}")
+  message(STATUS "RDKafka libraries: ${RDKAFKA_LIBRARIES}")
+endif()
+
 set(ENABLE_MYSQL ON CACHE BOOL "enable mysql")
 #查找mysql是否安装
 find_package(MYSQL QUIET)

+ 7 - 9
source/CMakeLists.txt

@@ -30,10 +30,9 @@ if(build_kafka)
   find_package(RDKafka REQUIRED)
   include_directories(${RDKAFKA_INCLUDE_DIR})
   list(APPEND 3RDPARTY_LIBS ${RDKAFKA_LIBRARIES}) 
-  link_directories(${RDKAFKA_LINK_DIR})
-  message(STATUS "RDKafka include: ${RDKAFKA_INCLUDE_DIR}")
-  message(STATUS "RDKafka libraries: ${RDKAFKA_LIBRARIES}")
-  message(STATUS "RDKafka link dir: ${RDKAFKA_LINK_DIR}")
+  #link_directories(${RDKAFKA_LINK_DIR})
+  message(STATUS "Source: RDKafka include: ${RDKAFKA_INCLUDE_DIR}")
+  message(STATUS "Source: RDKafka libraries: ${RDKAFKA_LIBRARIES}")
 endif()
 
 set(ENABLE_MYSQL ON CACHE BOOL "enable mysql")
@@ -52,12 +51,11 @@ set(CMAKE_MODULE_PATH ${CNSTREAM_ROOT_DIR}/cmake/sanitizers ${CNSTREAM_ROOT_DIR}
 
 # ---[ ZLToolKit
 find_package(ZLToolKit REQUIRED)
-link_directories(${ZLTOOLKIT_LINK_DIR})
+#link_directories(${ZLTOOLKIT_LINK_DIR})
 include_directories(${ZLTOOLKIT_INCLUDE_DIR})
 list(APPEND 3RDPARTY_LIBS ${ZLTOOLKIT_LIBRARIES})
-message(STATUS "ZLToolKit include: ${ZLTOOLKIT_INCLUDE_DIR}")
-message(STATUS "ZLToolKit libraries: ${ZLTOOLKIT_LIBRARIES}")
-message(STATUS "ZLToolKit link dir: ${ZLTOOLKIT_LINK_DIR}")
+message(STATUS "Source: ZLToolKit include: ${ZLTOOLKIT_INCLUDE_DIR}")
+message(STATUS "Source: ZLToolKit libraries: ${ZLTOOLKIT_LIBRARIES}")
 
 # ---[ rapidjson
 include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/)
@@ -90,4 +88,4 @@ aux_source_directory(${CNSTREAM_ROOT_DIR}/source/UserApp/src userApps)
 # set(EXECUTABLE_OUTPUT_PATH ${SOURCE_ROOT_DIR}/bin)
 
 add_executable(gsd ${srcs} ${userApps} ${3RDPARTY_LIBS})
-target_link_libraries(gsd gsd_core gsd_modules gsd_plugins pthread dl)
+target_link_libraries(gsd gsd_core gsd_modules gsd_plugins ${3RDPARTY_LIBS} pthread dl)