1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 ##############################################################################
15 # Generate vpp/app/version.h
16 ##############################################################################
18 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
19 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
21 ARGS -p ${CMAKE_CURRENT_BINARY_DIR}/app
22 COMMAND scripts/generate_version_h
23 ARGS ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
24 COMMENT "Generating VPP version.h"
27 add_custom_target(vpp_version_h
28 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
31 ##############################################################################
33 ##############################################################################
34 option(VPP_API_TEST_BUILTIN "Use builtin VPP API test." ON)
37 ${CMAKE_SOURCE_DIR}/vpp/vnet/config.h.in
38 ${CMAKE_CURRENT_BINARY_DIR}/vnet/config.h
46 vpp_add_api_files(vpp core vpp ${VPP_API_FILES})
48 foreach(file ${VPP_API_FILES})
49 get_filename_component(dir ${file} DIRECTORY)
51 FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h
52 ${CMAKE_CURRENT_BINARY_DIR}/${file}_enum.h
53 ${CMAKE_CURRENT_BINARY_DIR}/${file}_types.h
54 DESTINATION include/vpp/${dir}
64 stats/stat_segment_provider.c
70 if(VPP_API_TEST_BUILTIN)
71 list(APPEND VPP_SOURCES
76 ../vnet/arp/arp_test.c
78 add_definitions(-DVPP_API_TEST_BUILTIN=1)
81 add_vpp_executable(vpp
83 SOURCES ${VPP_SOURCES}
84 LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS}
85 DEPENDS vpp_version_h api_headers
92 stats/stat_segment_shared.h
95 ##############################################################################
97 ##############################################################################
98 add_vpp_executable(vppctl
100 LINK_LIBRARIES vppinfra
103 ##############################################################################
104 # vpp_get_metrics binary
105 ##############################################################################
106 add_vpp_executable(vpp_get_metrics
107 SOURCES api/vpp_get_metrics.c
108 LINK_LIBRARIES vppinfra svm svmdb
112 ##############################################################################
114 ##############################################################################
115 add_vpp_executable(vpp_get_stats
116 SOURCES app/vpp_get_stats.c
117 LINK_LIBRARIES vppapiclient vppinfra
121 add_vpp_executable(vpp_prometheus_export
122 SOURCES app/vpp_prometheus_export.c
123 LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient
127 ##############################################################################
128 # vppmem_preload library
129 ##############################################################################
130 add_vpp_library(vppmem_preload
132 LINK_LIBRARIES vppinfra
135 install(FILES conf/startup.conf DESTINATION etc/vpp COMPONENT vpp)
136 install(FILES conf/80-vpp.conf DESTINATION etc/sysctl.d COMPONENT vpp)
138 ##############################################################################
140 ##############################################################################
141 add_vpp_test_library(vpp
145 ##############################################################################
146 # minimal interactive startup.conf - only if not present
147 ##############################################################################
148 if(NOT EXISTS ${CMAKE_BINARY_DIR}/startup.conf)
150 ${CMAKE_CURRENT_SOURCE_DIR}/conf/startup.conf.in
151 ${CMAKE_BINARY_DIR}/startup.conf