vom: Add support for new stats
[vpp.git] / extras / vom / vom / CMakeLists.txt
index 47e73b6..bd8986a 100644 (file)
@@ -11,6 +11,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+unset (VPPAPICLIENT_LIB)
 unset (VAPICLIENT_LIB)
 unset (ACL_FILE)
 unset (NAT_FILE)
@@ -20,13 +21,20 @@ unset (IGMP_FILE)
 unset (VOM_SOURCES)
 unset (VOM_HEADERS)
 
+find_library(VPPAPICLIENT_LIB NAMES vppapiclient REQUIRED)
+find_path(VPPAPICLIENT_INCLUDE_DIR NAMES vpp-api/client/vppapiclient.h)
 find_library(VAPICLIENT_LIB NAMES vapiclient REQUIRED)
 find_path(VAPICLIENT_INCLUDE_DIR NAMES vapi/vapi.hpp)
 
+
+if(NOT VPPAPICLIENT_INCLUDE_DIR OR NOT VPPAPICLIENT_LIB)
+  message(FATAL_ERROR "Cannot find vppapiclient library and/or headers")
+endif()
 if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB)
   message(FATAL_ERROR "Cannot find vapiclient library and/or headers")
 endif()
 
+include_directories(${VPPAPICLIENT_INCLUDE_DIR})
 include_directories(${VAPICLIENT_INCLUDE_DIR})
 include_directories(${CMAKE_SOURCE_DIR})
 
@@ -160,6 +168,8 @@ list(APPEND VOM_SOURCES
   route_cmds.cpp
   route_domain.cpp
   route_domain_cmds.cpp
+  stat_client.cpp
+  stat_reader.cpp
   sub_interface_cmds.cpp
   sub_interface.cpp
   tap_interface.cpp
@@ -257,6 +267,8 @@ list(APPEND VOM_HEADERS
   rpc_cmd.hpp
   singular_db.hpp
   singular_db_funcs.hpp
+  stat_client.hpp
+  stat_reader.hpp
   sub_interface.hpp
   tap_interface.hpp
   types.hpp
@@ -271,8 +283,20 @@ add_vpp_library(vom
 
   INSTALL_HEADERS ${VOM_HEADERS}
 
-  LINK_LIBRARIES ${VAPICLIENT_LIB} Threads::Threads boost_thread
-    ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_ASIO_LIB} m rt
+  LINK_LIBRARIES ${VPPAPICLIENT_LIB} ${VAPICLIENT_LIB} Threads::Threads
+    ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} m rt
 
   COMPONENT libvom
 )
+
+if (Boost_FOUND)
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    add_definitions(-stdlib=libstdc++)
+  endif()
+  add_executable(vom_stats_test test_stats.cpp)
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    target_link_libraries(vom_stats_test vom stdc++)
+  else()
+    target_link_libraries(vom_stats_test vom)
+  endif()
+endif()