CMake as an alternative to autotools (experimental)
[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(FILES ${CMAKE_BINARY_DIR}/vlib/config.h DESTINATION include/vlib)
23
24 ##############################################################################
25 # vlib shared library
26 ##############################################################################
27 set(VLIB_SRCS
28   buffer.c
29   buffer_serialize.c
30   cli.c
31   counter.c
32   error.c
33   format.c
34   i2c.c
35   init.c
36   linux/pci.c
37   linux/physmem.c
38   linux/vfio.c
39   log.c
40   main.c
41   mc.c
42   node.c
43   node_cli.c
44   node_format.c
45   pci/pci.c
46   threads.c
47   threads_cli.c
48   trace.c
49   unix/cj.c
50   unix/cli.c
51   unix/input.c
52   unix/main.c
53   unix/mc_socket.c
54   unix/plugin.c
55   unix/util.c
56 )
57
58 add_library(vlib SHARED ${VLIB_SRCS})
59 target_link_libraries(vlib vppinfra svm ${CMAKE_DL_LIBS})
60 install(TARGETS vlib DESTINATION lib)
61
62 ##############################################################################
63 # vlib headers
64 ##############################################################################
65 vpp_add_header_files(vlib
66   buffer_funcs.h
67   buffer.h
68   buffer_node.h
69   cli_funcs.h
70   cli.h
71   counter.h
72   defs.h
73   error_funcs.h
74   error.h
75   format_funcs.h
76   global_funcs.h
77   i2c.h
78   init.h
79   linux/vfio.h
80   log.h
81   main.h
82   mc.h
83   node_funcs.h
84   node.h
85   pci/pci_config.h
86   pci/pci.h
87   physmem_funcs.h
88   physmem.h
89   threads.h
90   trace_funcs.h
91   trace.h
92   unix/cj.h
93   unix/mc_socket.h
94   unix/plugin.h
95   unix/unix.h
96   vlib.h
97 )
98