vlib: support Hyper-v/Azure VMBus
[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 ##############################################################################
15 # Generate vlib/config.h
16 ##############################################################################
17 set(PRE_DATA_SIZE 128 CACHE STRING "Buffer headroom size.")
18 configure_file(
19   ${CMAKE_SOURCE_DIR}/vlib/config.h.in
20   ${CMAKE_BINARY_DIR}/vlib/config.h
21 )
22 install(
23   FILES ${CMAKE_BINARY_DIR}/vlib/config.h
24   DESTINATION include/vlib
25   COMPONENT vpp-dev
26 )
27
28 ##############################################################################
29 # Find lib and include files
30 ##############################################################################
31 message(STATUS "Looking for libuuid")
32 find_path(UUID_INCLUDE_DIR NAMES uuid/uuid.h)
33 find_library(UUID_LIB NAMES uuid)
34
35 if(UUID_INCLUDE_DIR AND UUID_LIB)
36   include_directories(${UUID_INCLUDE_DIR})
37   set(VMBUS_SOURCE linux/vmbus.c)
38   set(VMBUS_LIBS uuid)
39   message(STATUS "Found uuid in ${UUID_INCLUDE_DIR}")
40 else()
41   message(WARNING "-- libuuid not found - vmbus support disabled")
42 endif()
43
44 ##############################################################################
45 # vlib shared library
46 ##############################################################################
47 add_vpp_library(vlib
48   SOURCES
49   buffer.c
50   buffer_serialize.c
51   cli.c
52   counter.c
53   error.c
54   format.c
55   i2c.c
56   init.c
57   linux/pci.c
58   linux/vfio.c
59   log.c
60   main.c
61   node.c
62   node_cli.c
63   node_format.c
64   pci/pci.c
65   physmem.c
66   threads.c
67   threads_cli.c
68   trace.c
69   unix/cj.c
70   unix/cli.c
71   unix/input.c
72   unix/main.c
73   unix/plugin.c
74   unix/util.c
75   vmbus/vmbus.c
76   ${VMBUS_SOURCE}
77
78   INSTALL_HEADERS
79   buffer_funcs.h
80   buffer.h
81   buffer_node.h
82   cli_funcs.h
83   cli.h
84   counter.h
85   counter_types.h
86   defs.h
87   error_funcs.h
88   error.h
89   format_funcs.h
90   global_funcs.h
91   i2c.h
92   init.h
93   linux/vfio.h
94   log.h
95   main.h
96   node_funcs.h
97   node.h
98   pci/pci_config.h
99   pci/pci.h
100   physmem_funcs.h
101   physmem.h
102   threads.h
103   trace_funcs.h
104   trace.h
105   unix/cj.h
106   unix/mc_socket.h
107   unix/plugin.h
108   unix/unix.h
109   vlib.h
110   vmbus/vmbus.h
111
112   LINK_LIBRARIES vppinfra svm ${VMBUS_LIBS} ${CMAKE_DL_LIBS}
113 )