Remove historical ip4 icmp OAM code
[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_BINARY_DIR}/include/vpp/app/version.h
19   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
20   COMMAND mkdir
21   ARGS -p ${CMAKE_BINARY_DIR}/include/vpp/app
22   COMMAND scripts/generate_version_h
23   ARGS ${CMAKE_BINARY_DIR}/include/vpp/app/version.h
24   COMMENT "Generating VPP version.h"
25 )
26
27 add_custom_target(vpp_version_h
28   DEPENDS ${CMAKE_BINARY_DIR}/include/vpp/app/version.h
29 )
30
31 ##############################################################################
32 # vpp binary
33 ##############################################################################
34 option(VPP_API_TEST_BUILTIN "Use builtin VPP API test." ON)
35
36 set(VPP_API_FILES
37   api/vpe.api
38 )
39
40 vpp_add_api_files(vpp ${VPP_API_FILES})
41
42 foreach(file ${VPP_API_FILES})
43   get_filename_component(dir ${file} DIRECTORY)
44   install(
45     FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h
46     DESTINATION include/vpp/${dir}
47     COMPONENT vpp-dev
48   )
49 endforeach()
50
51 set(VPP_SOURCES
52   vnet/main.c
53   app/vpe_cli.c
54   app/version.c
55   stats/stat_segment.c
56   api/api.c
57   api/json_format.c
58   api/custom_dump.c
59   api/types.c
60 )
61
62 if(VPP_API_TEST_BUILTIN)
63   list(APPEND VPP_SOURCES
64     api/api_format.c
65     api/api_main.c
66     api/plugin.c
67     api/types.c
68   )
69   add_definitions(-DVPP_API_TEST_BUILTIN=1)
70 endif()
71
72 add_vpp_executable(vpp
73   ENABLE_EXPORTS
74   SOURCES ${VPP_SOURCES}
75   LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS}
76   DEPENDS vpp_version_h api_headers
77 )
78
79 add_vpp_headers(vpp
80   api/vpe_msg_enum.h
81   api/vpe_all_api_h.h
82   stats/stat_segment.h
83 )
84
85 ##############################################################################
86 # vppctl binary
87 ##############################################################################
88 add_vpp_executable(vppctl
89   SOURCES app/vppctl.c
90   LINK_LIBRARIES vppinfra
91 )
92
93 ##############################################################################
94 # vpp_get_metrics binary
95 ##############################################################################
96 add_vpp_executable(vpp_get_metrics
97   SOURCES api/vpp_get_metrics.c
98   LINK_LIBRARIES vppinfra svm svmdb
99   DEPENDS api_headers
100 )
101
102 ##############################################################################
103 # stats binaries
104 ##############################################################################
105 add_vpp_executable(vpp_get_stats
106   SOURCES app/vpp_get_stats.c
107   LINK_LIBRARIES vppapiclient vppinfra
108   DEPENDS api_headers
109 )
110
111 add_vpp_executable(vpp_prometheus_export
112   SOURCES app/vpp_prometheus_export.c
113   LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient
114   DEPENDS api_headers
115 )
116
117 install(FILES conf/startup.conf DESTINATION etc/vpp COMPONENT vpp)
118 install(FILES conf/80-vpp.conf DESTINATION etc/sysctl.d COMPONENT vpp)