From c0ccefddbf50bb35f6fcb93d99a31ab52d4122d9 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sat, 25 Aug 2018 21:58:02 +0200 Subject: cmake: handle api_test_plugins in add_vpp_plugin macro Change-Id: I76a1711af0a920cce66e6dfb07d019ba505d55b7 Signed-off-by: Damjan Marion --- src/plugins/CMakeLists.txt | 30 +++++++++++------------------- src/plugins/cdp/CMakeLists.txt | 4 +--- src/plugins/flowprobe/CMakeLists.txt | 4 +--- src/plugins/gtpu/CMakeLists.txt | 4 +--- src/plugins/ioam/CMakeLists.txt | 21 ++------------------- src/plugins/lacp/CMakeLists.txt | 4 +--- src/plugins/lb/CMakeLists.txt | 4 +--- src/plugins/mactime/CMakeLists.txt | 5 +---- src/plugins/pppoe/CMakeLists.txt | 4 +--- src/plugins/stn/CMakeLists.txt | 4 +--- 10 files changed, 21 insertions(+), 63 deletions(-) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 8ea99c7566a..877d25dd907 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -20,7 +20,7 @@ macro(add_vpp_plugin name) cmake_parse_arguments(PLUGIN "" "LINK_FLAGS" - "SOURCES;API_FILES;MULTIARCH_SOURCES;LINK_LIBRARIES" + "SOURCES;API_FILES;MULTIARCH_SOURCES;LINK_LIBRARIES;API_TEST_SOURCES" ${ARGN} ) set(plugin_name ${name}_plugin) @@ -43,27 +43,19 @@ macro(add_vpp_plugin name) if(PLUGIN_LINK_FLAGS) set_target_properties(${plugin_name} PROPERTIES LINK_FLAGS "${PLUGIN_LINK_FLAGS}") endif() + if(PLUGIN_API_TEST_SOURCES) + set(test_plugin_name ${name}_test_plugin) + add_library(${test_plugin_name} SHARED ${PLUGIN_API_TEST_SOURCES} ${api_headers}) + add_dependencies(${test_plugin_name} api_headers) + set_target_properties(${test_plugin_name} PROPERTIES + PREFIX "" + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins) + install(TARGETS ${test_plugin_name} DESTINATION lib/vpp_api_test_plugins COMPONENT + plugins) + endif() install(TARGETS ${plugin_name} DESTINATION lib/vpp_plugins COMPONENT plugins) endmacro() -macro(add_vpp_api_test_plugin plugin_name) - set(api_headers) - foreach(f ${ARGN}) - if(${f} MATCHES ".*\.api$") - vpp_generate_api_header(${f} plugins) - list(APPEND api_headers ${f}.h) - endif() - endforeach() - add_library(${plugin_name} SHARED ${ARGN} ${api_headers}) - add_dependencies(${plugin_name} api_headers) - set_target_properties(${plugin_name} PROPERTIES PREFIX "") - set_target_properties(${plugin_name} PROPERTIES - PREFIX "" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}//vpp_api_test_plugins) - install(TARGETS ${plugin_name} DESTINATION lib/vpp_api_test_plugins COMPONENT - plugins) -endmacro() - ############################################################################## # find and add all plugin subdirs ############################################################################ diff --git a/src/plugins/cdp/CMakeLists.txt b/src/plugins/cdp/CMakeLists.txt index 9f0b07edcfa..0f3ade8359c 100644 --- a/src/plugins/cdp/CMakeLists.txt +++ b/src/plugins/cdp/CMakeLists.txt @@ -20,10 +20,8 @@ add_vpp_plugin(cdp API_FILES cdp.api -) -add_vpp_api_test_plugin(cdp_test - cdp.api + API_TEST_SOURCES cdp_test.c ) diff --git a/src/plugins/flowprobe/CMakeLists.txt b/src/plugins/flowprobe/CMakeLists.txt index f65fe452b75..4c1d4f33320 100644 --- a/src/plugins/flowprobe/CMakeLists.txt +++ b/src/plugins/flowprobe/CMakeLists.txt @@ -18,10 +18,8 @@ add_vpp_plugin(flowprobe API_FILES flowprobe.api -) -add_vpp_api_test_plugin(flowprobe_test - flowprobe.api + API_TEST_SOURCES flowprobe_test.c ) diff --git a/src/plugins/gtpu/CMakeLists.txt b/src/plugins/gtpu/CMakeLists.txt index 1032b14b4ab..2ad38ebb498 100644 --- a/src/plugins/gtpu/CMakeLists.txt +++ b/src/plugins/gtpu/CMakeLists.txt @@ -20,10 +20,8 @@ add_vpp_plugin(gtpu API_FILES gtpu.api -) -add_vpp_api_test_plugin(gtpu_test - gtpu.api + API_TEST_SOURCES gtpu_test.c ) diff --git a/src/plugins/ioam/CMakeLists.txt b/src/plugins/ioam/CMakeLists.txt index 5648a65acd2..b6d86eb3cd4 100644 --- a/src/plugins/ioam/CMakeLists.txt +++ b/src/plugins/ioam/CMakeLists.txt @@ -73,30 +73,13 @@ add_vpp_plugin(ioam export-vxlan-gpe/vxlan_gpe_ioam_export.api ip6/ioam_cache.api udp-ping/udp_ping.api -) -add_vpp_api_test_plugin(ioam_pot_test - lib-pot/pot.api + API_TEST_SOURCES + ioam_test.c lib-pot/pot_test.c -) - -add_vpp_api_test_plugin(ioam_export_test - export/ioam_export.api export/ioam_export_test.c -) - -add_vpp_api_test_plugin(ioam_trace_test - lib-trace/trace.api lib-trace/trace_test.c -) - -add_vpp_api_test_plugin(ioam_vxlan_gpe_test - lib-vxlan-gpe/ioam_vxlan_gpe.api lib-vxlan-gpe/vxlan_gpe_test.c -) - -add_vpp_api_test_plugin(ioam_udp_ping_test - udp-ping/udp_ping.api udp-ping/udp_ping_test.c ) diff --git a/src/plugins/lacp/CMakeLists.txt b/src/plugins/lacp/CMakeLists.txt index f6a30a711ae..253786ee85b 100644 --- a/src/plugins/lacp/CMakeLists.txt +++ b/src/plugins/lacp/CMakeLists.txt @@ -26,10 +26,8 @@ add_vpp_plugin(lacp API_FILES lacp.api -) -add_vpp_api_test_plugin(lacp_test - lacp.api + API_TEST_SOURCES lacp_test.c ) diff --git a/src/plugins/lb/CMakeLists.txt b/src/plugins/lb/CMakeLists.txt index f9bca075050..85acb62498f 100644 --- a/src/plugins/lb/CMakeLists.txt +++ b/src/plugins/lb/CMakeLists.txt @@ -21,10 +21,8 @@ add_vpp_plugin(lb API_FILES lb.api -) -add_vpp_api_test_plugin(lb_test - lb.api + API_TEST_SOURCES lb_test.c ) diff --git a/src/plugins/mactime/CMakeLists.txt b/src/plugins/mactime/CMakeLists.txt index f2986a95c0d..ac5077d1860 100644 --- a/src/plugins/mactime/CMakeLists.txt +++ b/src/plugins/mactime/CMakeLists.txt @@ -18,10 +18,7 @@ add_vpp_plugin(mactime API_FILES mactime.api -) -add_vpp_api_test_plugin(mactime_test - mactime.api + API_TEST_SOURCES mactime_test.c ) - diff --git a/src/plugins/pppoe/CMakeLists.txt b/src/plugins/pppoe/CMakeLists.txt index 90599688fed..13b6b54ee5a 100644 --- a/src/plugins/pppoe/CMakeLists.txt +++ b/src/plugins/pppoe/CMakeLists.txt @@ -21,10 +21,8 @@ add_vpp_plugin(pppoe API_FILES pppoe.api -) -add_vpp_api_test_plugin(pppoe_test - pppoe.api + API_TEST_SOURCES pppoe_test.c ) diff --git a/src/plugins/stn/CMakeLists.txt b/src/plugins/stn/CMakeLists.txt index d987176b9cd..38eda9b0366 100644 --- a/src/plugins/stn/CMakeLists.txt +++ b/src/plugins/stn/CMakeLists.txt @@ -18,10 +18,8 @@ add_vpp_plugin(stn API_FILES stn.api -) -add_vpp_api_test_plugin(stn_test - stn.api + API_TEST_SOURCES stn_test.c ) -- cgit 1.2.3-korg