vcl: avoid skipping last event in epoll lt
[vpp.git] / src / cmake / library.cmake
index d19eb3c..45b3944 100644 (file)
@@ -41,8 +41,10 @@ macro(add_vpp_library lib)
   endif()
   install(
     TARGETS ${lib}
-    DESTINATION ${VPP_LIBRARY_DIR}
-    COMPONENT ${ARG_COMPONENT}
+    LIBRARY
+      DESTINATION ${VPP_LIBRARY_DIR}
+      COMPONENT ${ARG_COMPONENT}
+      NAMELINK_COMPONENT ${ARG_COMPONENT}-dev
   )
 
   if (ARG_LTO AND VPP_USE_LTO)
@@ -51,6 +53,9 @@ macro(add_vpp_library lib)
      target_compile_options (${lib} PRIVATE "-ffunction-sections")
      target_compile_options (${lib} PRIVATE "-fdata-sections")
      target_link_libraries (${lib} "-Wl,--gc-sections")
+     if(compiler_flag_no_stringop_overflow)
+       target_link_libraries (${lib} "-Wno-stringop-overflow")
+     endif()
   endif()
 
   if(ARG_MULTIARCH_SOURCES)
@@ -77,6 +82,10 @@ macro(add_vpp_library lib)
     add_dependencies(${lo} api_headers)
   endif()
 
+  if(VPP_EXTERNAL_PROJECT AND ARG_API_FILES)
+    add_dependencies(${lo} ${lib}_api_headers)
+  endif()
+
   if(ARG_DEPENDS)
     add_dependencies(${lo} ${ARG_DEPENDS})
   endif()
@@ -108,6 +117,36 @@ function (add_vpp_headers path)
   endforeach()
 endfunction()
 
+macro(add_vat_test_library lib)
+  cmake_parse_arguments(TEST
+    ""
+    ""
+    ${ARGN}
+  )
+
+  foreach(file ${ARGN})
+    get_filename_component(name ${file} NAME_WE)
+    set(test_lib ${lib}_${name}_plugin)
+    add_library(${test_lib} SHARED ${file})
+    target_compile_options(${test_lib} PUBLIC ${VPP_DEFAULT_MARCH_FLAGS})
+    if(NOT VPP_EXTERNAL_PROJECT)
+      add_dependencies(${test_lib} api_headers)
+    endif()
+    include_directories(${CMAKE_CURRENT_BINARY_DIR})
+    set_target_properties(${test_lib} PROPERTIES NO_SONAME 1)
+    set_target_properties(${test_lib} PROPERTIES
+      PREFIX ""
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins)
+
+    # install .so
+    install(
+      TARGETS ${test_lib}
+      DESTINATION ${VPP_LIBRARY_DIR}/vpp_api_test_plugins
+      COMPONENT ${ARG_COMPONENT}
+    )
+  endforeach()
+endmacro()
+
 macro(add_vpp_test_library lib)
   cmake_parse_arguments(TEST
     ""