67d1f6d05c74b16171a34e024c3efb14cdffbe49
[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 configure_file(
27   ${CMAKE_SOURCE_DIR}/vlib/config.h.in
28   ${CMAKE_BINARY_DIR}/vlib/config.h
29 )
30 install(
31   FILES ${CMAKE_BINARY_DIR}/vlib/config.h
32   DESTINATION include/vlib
33   COMPONENT vpp-dev
34 )
35
36 ##############################################################################
37 # Find lib and include files
38 ##############################################################################
39 message(STATUS "Looking for libuuid")
40 find_path(UUID_INCLUDE_DIR NAMES uuid/uuid.h)
41 find_library(UUID_LIB NAMES uuid)
42
43 if(UUID_INCLUDE_DIR AND UUID_LIB)
44   include_directories(${UUID_INCLUDE_DIR})
45   set(VMBUS_SOURCE linux/vmbus.c)
46   set(VMBUS_LIBS uuid)
47   message(STATUS "Found uuid in ${UUID_INCLUDE_DIR}")
48 else()
49   message(WARNING "-- libuuid not found - vmbus support disabled")
50 endif()
51
52 ##############################################################################
53 # vlib shared library
54 ##############################################################################
55 add_vpp_library(vlib
56   SOURCES
57   buffer.c
58   cli.c
59   counter.c
60   drop.c
61   error.c
62   format.c
63   handoff_trace.c
64   i2c.c
65   init.c
66   linux/pci.c
67   linux/vfio.c
68   log.c
69   main.c
70   node.c
71   node_cli.c
72   node_format.c
73   pci/pci.c
74   pci/pci_types_api.c
75   physmem.c
76   punt.c
77   punt_node.c
78   threads.c
79   threads_cli.c
80   trace.c
81   unix/cj.c
82   unix/cli.c
83   unix/input.c
84   unix/main.c
85   unix/plugin.c
86   unix/util.c
87   vmbus/vmbus.c
88   ${VMBUS_SOURCE}
89
90   MULTIARCH_SOURCES
91   drop.c
92   punt_node.c
93
94   INSTALL_HEADERS
95   buffer_funcs.h
96   buffer.h
97   buffer_node.h
98   cli.h
99   counter.h
100   counter_types.h
101   defs.h
102   error_funcs.h
103   error.h
104   format_funcs.h
105   global_funcs.h
106   i2c.h
107   init.h
108   linux/vfio.h
109   log.h
110   main.h
111   node_funcs.h
112   node.h
113   pci/pci_config.h
114   pci/pci.h
115   pci/pci_types_api.h
116   physmem_funcs.h
117   physmem.h
118   punt.h
119   threads.h
120   trace_funcs.h
121   trace.h
122   unix/cj.h
123   unix/mc_socket.h
124   unix/plugin.h
125   unix/unix.h
126   vlib.h
127   vmbus/vmbus.h
128
129   API_FILES
130   pci/pci_types.api
131
132   LINK_LIBRARIES vppinfra svm ${VMBUS_LIBS} ${CMAKE_DL_LIBS}
133
134   DEPENDS api_headers
135 )