udp: fix csum computation when offload disabled
[vpp.git] / src / vlib / 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 option(VPP_BUFFER_FAULT_INJECTOR "Include the buffer fault injector" OFF)
15
16 ##############################################################################
17 # Generate vlib/config.h
18 ##############################################################################
19 if(VPP_BUFFER_FAULT_INJECTOR)
20   set(BUFFER_ALLOC_FAULT_INJECTOR 1 CACHE STRING "fault injector on")
21 else()
22   set(BUFFER_ALLOC_FAULT_INJECTOR 0 CACHE STRING "fault injector off")
23 endif()
24
25 if(VPP_PLATFORM_BUFFER_ALIGN)
26   set(VLIB_BUFFER_ALIGN ${VPP_PLATFORM_BUFFER_ALIGN})
27 else()
28   set(VLIB_BUFFER_ALIGN ${VPP_CACHE_LINE_SIZE})
29 endif()
30
31 set(PRE_DATA_SIZE 128 CACHE STRING "Buffer headroom size.")
32
33 if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
34   set(_ss 16)
35 else()
36   set(_ss 15)
37 endif()
38 set(VLIB_PROCESS_LOG2_STACK_SIZE
39  ${_ss}
40  CACHE
41  STRING "Process node default stack size (log2)"
42 )
43
44 configure_file(
45   ${CMAKE_SOURCE_DIR}/vlib/config.h.in
46   ${CMAKE_CURRENT_BINARY_DIR}/config.h
47 )
48 install(
49   FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
50   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vlib
51   COMPONENT vpp-dev
52 )
53
54 ##############################################################################
55 # vlib shared library
56 ##############################################################################
57
58 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
59 set(PLATFORM_SOURCES
60   linux/pci.c
61   linux/vfio.c
62   linux/vmbus.c
63 )
64
65 set(PLATFORM_HEADERS
66   linux/vfio.h
67 )
68 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
69 set(PLATFORM_SOURCES
70   freebsd/pci.c
71 )
72 endif()
73
74 add_vpp_library(vlib
75   SOURCES
76   buffer.c
77   buffer_funcs.c
78   cli.c
79   counter.c
80   drop.c
81   error.c
82   format.c
83   handoff_trace.c
84   init.c
85   log.c
86   main.c
87   node.c
88   node_cli.c
89   node_format.c
90   node_init.c
91   pci/pci.c
92   pci/pci_types_api.c
93   physmem.c
94   punt.c
95   punt_node.c
96   stats/cli.c
97   stats/collector.c
98   stats/format.c
99   stats/init.c
100   stats/provider_mem.c
101   stats/stats.c
102   threads.c
103   threads_cli.c
104   time.c
105   trace.c
106   unix/cli.c
107   unix/input.c
108   unix/main.c
109   unix/plugin.c
110   unix/util.c
111   vmbus/vmbus.c
112   dma/dma.c
113   dma/cli.c
114   ${PLATFORM_SOURCES}
115
116   MULTIARCH_SOURCES
117   buffer_funcs.c
118   drop.c
119   punt_node.c
120   node_init.c
121
122   INSTALL_HEADERS
123   buffer_funcs.h
124   buffer.h
125   buffer_node.h
126   cli.h
127   counter.h
128   counter_types.h
129   defs.h
130   dma/dma.h
131   error_funcs.h
132   error.h
133   format_funcs.h
134   global_funcs.h
135   init.h
136   log.h
137   main.h
138   node_funcs.h
139   node.h
140   pci/pci_config.h
141   pci/pci.h
142   pci/pci_types_api.h
143   physmem_funcs.h
144   physmem.h
145   punt.h
146   stats/shared.h
147   stats/stats.h
148   threads.h
149   time.h
150   trace_funcs.h
151   trace.h
152   unix/mc_socket.h
153   unix/plugin.h
154   unix/unix.h
155   vlib.h
156   vmbus/vmbus.h
157   ${PLATFORM_HEADERS}
158
159   API_FILES
160   pci/pci_types.api
161
162   LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS} ${EPOLL_LIB}
163
164   DEPENDS api_headers
165 )