69bd18b6db6b320429055c00a483a83603a0eecb
[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 set(PRE_DATA_SIZE 128 CACHE STRING "Buffer headroom size.")
26
27 if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
28   set(_ss 16)
29 else()
30   set(_ss 15)
31 endif()
32 set(VLIB_PROCESS_LOG2_STACK_SIZE
33  ${_ss}
34  CACHE
35  STRING "Process node default stack size (log2)"
36 )
37
38 configure_file(
39   ${CMAKE_SOURCE_DIR}/vlib/config.h.in
40   ${CMAKE_CURRENT_BINARY_DIR}/config.h
41 )
42 install(
43   FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
44   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vlib
45   COMPONENT vpp-dev
46 )
47
48 ##############################################################################
49 # Find lib and include files
50 ##############################################################################
51 message(STATUS "Looking for libuuid")
52 vpp_find_path(UUID_INCLUDE_DIR NAMES uuid/uuid.h)
53 vpp_find_library(UUID_LIB NAMES uuid)
54
55 if(UUID_INCLUDE_DIR AND UUID_LIB)
56   include_directories(${UUID_INCLUDE_DIR})
57   set(VMBUS_SOURCE linux/vmbus.c)
58   set(VMBUS_LIBS uuid)
59   message(STATUS "Found uuid in ${UUID_INCLUDE_DIR}")
60 else()
61   message(WARNING "-- libuuid not found - vmbus support disabled")
62 endif()
63
64 ##############################################################################
65 # vlib shared library
66 ##############################################################################
67 add_vpp_library(vlib
68   SOURCES
69   buffer.c
70   buffer_funcs.c
71   cli.c
72   counter.c
73   drop.c
74   error.c
75   format.c
76   handoff_trace.c
77   init.c
78   linux/pci.c
79   linux/vfio.c
80   log.c
81   main.c
82   node.c
83   node_cli.c
84   node_format.c
85   node_init.c
86   pci/pci.c
87   pci/pci_types_api.c
88   physmem.c
89   punt.c
90   punt_node.c
91   stats/cli.c
92   stats/collector.c
93   stats/format.c
94   stats/init.c
95   stats/provider_mem.c
96   stats/stats.c
97   threads.c
98   threads_cli.c
99   time.c
100   trace.c
101   unix/cli.c
102   unix/input.c
103   unix/main.c
104   unix/plugin.c
105   unix/util.c
106   vmbus/vmbus.c
107   ${VMBUS_SOURCE}
108   dma/dma.c
109   dma/cli.c
110
111   MULTIARCH_SOURCES
112   buffer_funcs.c
113   drop.c
114   punt_node.c
115   node_init.c
116
117   INSTALL_HEADERS
118   buffer_funcs.h
119   buffer.h
120   buffer_node.h
121   cli.h
122   counter.h
123   counter_types.h
124   defs.h
125   error_funcs.h
126   error.h
127   format_funcs.h
128   global_funcs.h
129   init.h
130   linux/vfio.h
131   log.h
132   main.h
133   node_funcs.h
134   node.h
135   pci/pci_config.h
136   pci/pci.h
137   pci/pci_types_api.h
138   physmem_funcs.h
139   physmem.h
140   punt.h
141   stats/shared.h
142   stats/stats.h
143   threads.h
144   time.h
145   trace_funcs.h
146   trace.h
147   unix/mc_socket.h
148   unix/plugin.h
149   unix/unix.h
150   vlib.h
151   vmbus/vmbus.h
152
153   API_FILES
154   pci/pci_types.api
155
156   LINK_LIBRARIES vppinfra svm ${VMBUS_LIBS} ${CMAKE_DL_LIBS}
157
158   DEPENDS api_headers
159 )