vcl: allow more rx events on peek
[vpp.git] / src / vpp / CMakeLists.txt
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:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
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.
13
14 ##############################################################################
15 # Generate vpp/app/version.h
16 ##############################################################################
17 add_custom_command(
18   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
19   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
20   COMMAND mkdir
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"
25 )
26
27 add_custom_target(vpp_version_h
28   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
29 )
30
31 install(
32   FILES ${CMAKE_CURRENT_BINARY_DIR}/app/version.h
33   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vpp/app
34   COMPONENT vpp-dev
35 )
36
37 ##############################################################################
38 # vpp binary
39 ##############################################################################
40 option(VPP_API_TEST_BUILTIN "Use builtin VPP API test." ON)
41
42 configure_file(
43   ${CMAKE_SOURCE_DIR}/vpp/vnet/config.h.in
44   ${CMAKE_CURRENT_BINARY_DIR}/vnet/config.h
45 )
46
47 install(
48   FILES ${CMAKE_CURRENT_BINARY_DIR}/vnet/config.h
49   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vpp/vnet
50   COMPONENT vpp-dev
51 )
52
53 set(VPP_API_FILES
54   api/vpe_types.api
55   api/vpe.api
56 )
57
58 vpp_add_api_files(vpp core vpp ${VPP_API_FILES})
59
60 foreach(file ${VPP_API_FILES})
61   get_filename_component(dir ${file} DIRECTORY)
62   install(
63     FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h
64     ${CMAKE_CURRENT_BINARY_DIR}/${file}_enum.h
65     ${CMAKE_CURRENT_BINARY_DIR}/${file}_types.h
66     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vpp/${dir}
67     COMPONENT vpp-dev
68   )
69 endforeach()
70
71 set(VPP_SOURCES
72   vnet/main.c
73   app/vpe_cli.c
74   app/version.c
75   api/api.c
76   api/json_format.c
77   api/types.c
78 )
79
80 if(VPP_API_TEST_BUILTIN)
81   list(APPEND VPP_SOURCES
82     api/api_format.c
83     api/api_main.c
84     api/plugin.c
85     api/types.c
86   )
87   add_definitions(-DVPP_API_TEST_BUILTIN=1)
88 endif()
89
90 add_vpp_executable(vpp
91   ENABLE_EXPORTS
92   SOURCES ${VPP_SOURCES}
93   LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS} ${EPOLL_LIB}
94   DEPENDS vpp_version_h api_headers
95 )
96
97 ##############################################################################
98 # vppctl binary
99 ##############################################################################
100 add_vpp_executable(vppctl
101   SOURCES app/vppctl.c
102   LINK_LIBRARIES vppinfra ${EPOLL_LIB}
103 )
104
105 ##############################################################################
106 # vpp_get_metrics binary
107 ##############################################################################
108 add_vpp_executable(vpp_get_metrics
109   SOURCES api/vpp_get_metrics.c
110   LINK_LIBRARIES vppinfra svm svmdb
111   DEPENDS api_headers
112 )
113
114 ##############################################################################
115 # stats binaries
116 ##############################################################################
117 add_vpp_executable(vpp_get_stats
118   SOURCES app/vpp_get_stats.c
119   LINK_LIBRARIES vppapiclient vppinfra
120   DEPENDS api_headers
121 )
122
123 add_vpp_executable(vpp_prometheus_export
124   SOURCES app/vpp_prometheus_export.c
125   LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient ${EPOLL_LIB}
126   DEPENDS api_headers
127 )
128
129 ##############################################################################
130 # vppmem_preload library
131 ##############################################################################
132 add_vpp_library(vppmem_preload
133   SOURCES mem/mem.c
134   LINK_LIBRARIES vppinfra
135 )
136
137 install(FILES conf/startup.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vpp COMPONENT vpp)
138 install(FILES conf/80-vpp.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/sysctl.d COMPONENT vpp)
139
140 ##############################################################################
141 # VAT2 plugins
142 ##############################################################################
143 add_vpp_test_library(vpp
144   ${VPP_API_FILES}
145 )
146
147 add_vat_test_library(vpp
148   api/api_test.c
149 )
150
151 ##############################################################################
152 # minimal interactive startup.conf  - only if not present
153 ##############################################################################
154 if(NOT EXISTS ${CMAKE_BINARY_DIR}/startup.conf)
155   configure_file(
156     ${CMAKE_CURRENT_SOURCE_DIR}/conf/startup.conf.in
157     ${CMAKE_BINARY_DIR}/startup.conf
158   )
159 endif()