X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2FCMakeLists.txt;h=6f58e8db8ecd98ab964dd30910a5480b96839d74;hb=4c64b6edc86f7732f4a160b948b3386e4021a265;hp=9624ff7f761147ed1ec0bde6d1f0551d7a4c1285;hpb=612dd6a955e44d2c0fed1801fb8de585ca695c63;p=vpp.git diff --git a/src/vpp/CMakeLists.txt b/src/vpp/CMakeLists.txt index 9624ff7f761..6f58e8db8ec 100644 --- a/src/vpp/CMakeLists.txt +++ b/src/vpp/CMakeLists.txt @@ -31,14 +31,25 @@ add_custom_target(vpp_version_h ############################################################################## # vpp binary ############################################################################## +option(VPP_API_TEST_BUILTIN "Use builtin VPP API test." ON) -vpp_add_api_files(vpp_api_headers +set(VPP_API_FILES api/vpe.api stats/stats.api oam/oam.api ) -add_executable (vpp +vpp_add_api_files(vpp ${VPP_API_FILES}) + +foreach(file ${VPP_API_FILES}) + get_filename_component(dir ${file} DIRECTORY) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h + DESTINATION include/vpp/${dir} + ) +endforeach() + +set(VPP_SOURCES vnet/main.c app/vpe_cli.c app/version.c @@ -47,41 +58,60 @@ add_executable (vpp stats/stats.c stats/stat_segment.c api/api.c - api/api_main.c - api/api_format.c api/json_format.c api/custom_dump.c - api/plugin.c ) -target_link_libraries(vpp svm vlib vppinfra vlibmemory vnet Threads::Threads - ${CMAKE_DL_LIBS}) -add_dependencies(vpp vpp_version_h api_headers) -set_target_properties(vpp PROPERTIES ENABLE_EXPORTS 1) -install(TARGETS vpp DESTINATION bin) + +if(VPP_API_TEST_BUILTIN) + list(APPEND VPP_SOURCES + api/api_format.c + api/api_main.c + api/plugin.c + ) + add_definitions(-DVPP_API_TEST_BUILTIN=1) +endif() + +add_vpp_executable(vpp + ENABLE_EXPORTS + SOURCES ${VPP_SOURCES} + LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS} + DEPENDS vpp_version_h api_headers +) + +add_vpp_headers(vpp + api/vpe_msg_enum.h + api/vpe_all_api_h.h +) ############################################################################## # vppctl binary ############################################################################## -add_executable(vppctl app/vppctl.c) -target_link_libraries(vppctl vppinfra) -install(TARGETS vppctl DESTINATION bin) +add_vpp_executable(vppctl + SOURCES app/vppctl.c + LINK_LIBRARIES vppinfra +) ############################################################################## # vpp_get_metrics binary ############################################################################## -add_executable (vpp_get_metrics api/vpp_get_metrics.c ${VPP_API_HDRS}) -target_link_libraries (vpp_get_metrics vppinfra svm svmdb) -install(TARGETS vpp_get_metrics DESTINATION bin) +add_vpp_executable(vpp_get_metrics + SOURCES api/vpp_get_metrics.c + LINK_LIBRARIES vppinfra svm svmdb + DEPENDS api_headers +) ############################################################################## # stats binaries ############################################################################## -add_executable(summary_stats_client api/summary_stats_client.c) -add_executable(stat_client app/stat_client.c) -target_link_libraries(summary_stats_client vppinfra svm vlibmemoryclient) -target_link_libraries(stat_client vppinfra svm vlibmemoryclient) +add_vpp_executable(summary_stats_client + SOURCES api/summary_stats_client.c + LINK_LIBRARIES vppinfra svm vlibmemoryclient + DEPENDS api_headers +) -############################################################################## -# install -############################################################################## +add_vpp_executable(stat_client + SOURCES app/stat_client.c + LINK_LIBRARIES vppinfra svm vlibmemoryclient + DEPENDS api_headers +)