buffers: add compile-time option to set buffer alignment
[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 add_vpp_library(vlib
58   SOURCES
59   buffer.c
60   buffer_funcs.c
61   cli.c
62   counter.c
63   drop.c
64   error.c
65   format.c
66   handoff_trace.c
67   init.c
68   linux/pci.c
69   linux/vfio.c
70   linux/vmbus.c
71   log.c
72   main.c
73   node.c
74   node_cli.c
75   node_format.c
76   node_init.c
77   pci/pci.c
78   pci/pci_types_api.c
79   physmem.c
80   punt.c
81   punt_node.c
82   stats/cli.c
83   stats/collector.c
84   stats/format.c
85   stats/init.c
86   stats/provider_mem.c
87   stats/stats.c
88   threads.c
89   threads_cli.c
90   time.c
91   trace.c
92   unix/cli.c
93   unix/input.c
94   unix/main.c
95   unix/plugin.c
96   unix/util.c
97   vmbus/vmbus.c
98   dma/dma.c
99   dma/cli.c
100
101   MULTIARCH_SOURCES
102   buffer_funcs.c
103   drop.c
104   punt_node.c
105   node_init.c
106
107   INSTALL_HEADERS
108   buffer_funcs.h
109   buffer.h
110   buffer_node.h
111   cli.h
112   counter.h
113   counter_types.h
114   defs.h
115   dma/dma.h
116   error_funcs.h
117   error.h
118   format_funcs.h
119   global_funcs.h
120   init.h
121   linux/vfio.h
122   log.h
123   main.h
124   node_funcs.h
125   node.h
126   pci/pci_config.h
127   pci/pci.h
128   pci/pci_types_api.h
129   physmem_funcs.h
130   physmem.h
131   punt.h
132   stats/shared.h
133   stats/stats.h
134   threads.h
135   time.h
136   trace_funcs.h
137   trace.h
138   unix/mc_socket.h
139   unix/plugin.h
140   unix/unix.h
141   vlib.h
142   vmbus/vmbus.h
143
144   API_FILES
145   pci/pci_types.api
146
147   LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS}
148
149   DEPENDS api_headers
150 )