blob: 3998ae6f6a6831555aa71ddef1dac4c2a95089b1 [file] [log] [blame]
Damjan Marion612dd6a2018-07-30 12:45:07 +02001# 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
14enable_language(ASM)
15
16##############################################################################
17# Generate vppinfra/config.h
18##############################################################################
Damjan Marionedc43872018-09-02 11:16:00 +020019set(LOG2_CACHE_LINE_BYTES ${VPP_LOG2_CACHE_LINE_SIZE})
Damjan Marion612dd6a2018-07-30 12:45:07 +020020
21configure_file(
22 ${CMAKE_SOURCE_DIR}/vppinfra/config.h.in
23 ${CMAKE_BINARY_DIR}/vppinfra/config.h
24)
25
26install(
27 FILES ${CMAKE_BINARY_DIR}/vppinfra/config.h
28 DESTINATION include/vppinfra
Damjan Marion43b06062018-08-29 22:20:45 +020029 COMPONENT vpp-dev
Damjan Marion612dd6a2018-07-30 12:45:07 +020030)
31
32##############################################################################
33# vppinfra sources
34##############################################################################
35set(VPPINFRA_SRCS
Damjan Marion612dd6a2018-07-30 12:45:07 +020036 backtrace.c
Dave Barach32dcd3b2019-07-08 12:25:38 -040037 bihash_all_vector.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020038 cpu.c
39 cuckoo_template.c
Dave Barach2c8e0022020-02-11 15:06:34 -050040 dlmalloc.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020041 elf.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020042 elog.c
43 error.c
44 fheap.c
45 fifo.c
46 format.c
47 graph.c
48 hash.c
49 heap.c
50 longjmp.S
51 macros.c
52 maplog.c
Dave Barach2c8e0022020-02-11 15:06:34 -050053 mem_dlmalloc.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020054 mhash.c
Gary Boona9ed6f72019-07-22 10:57:56 -040055 mpcap.c
Dave Barach3ae28732018-11-16 17:19:00 -050056 pcap.c
Damjan Marion68b4da62018-09-30 18:26:20 +020057 pmalloc.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020058 pool.c
59 ptclosure.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020060 random_buffer.c
Dave Barach2c8e0022020-02-11 15:06:34 -050061 random.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020062 random_isaac.c
Florin Coras672d5fc2019-04-15 17:28:51 -070063 rbtree.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020064 serialize.c
65 slist.c
66 socket.c
67 std-formats.c
68 string.c
69 time.c
70 time_range.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020071 timing_wheel.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020072 tw_timer_16t_1w_2048sl.c
Dave Barach2c8e0022020-02-11 15:06:34 -050073 tw_timer_16t_2w_512sl.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020074 tw_timer_1t_3w_1024sl_ov.c
Dave Barach2c8e0022020-02-11 15:06:34 -050075 tw_timer_2t_1w_2048sl.c
76 tw_timer_4t_3w_256sl.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020077 unformat.c
78 unix-formats.c
79 unix-misc.c
80 valloc.c
81 vec.c
82 vector.c
83 zvec.c
Damjan Marion612dd6a2018-07-30 12:45:07 +020084)
85
Damjan Marion4553c952018-08-26 11:04:40 +020086set(VPPINFRA_HEADERS
BenoƮt Ganne9fb6d402019-04-15 15:28:21 +020087 sanitizer.h
Damjan Marion612dd6a2018-07-30 12:45:07 +020088 bihash_16_8.h
89 bihash_24_8.h
90 bihash_40_8.h
91 bihash_48_8.h
92 bihash_8_8.h
93 bihash_template.c
94 bihash_template.h
95 bihash_vec8_8.h
96 bitmap.h
97 bitops.h
98 byte_order.h
99 cache.h
Dave Barach5f2cfb22019-05-20 10:28:57 -0400100 callback.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200101 clib_error.h
102 clib.h
103 cpu.h
104 crc32.h
105 dlist.h
106 dlmalloc.h
107 elf_clib.h
108 elf.h
109 elog.h
110 error_bootstrap.h
111 error.h
112 fheap.h
113 fifo.h
114 file.h
115 flowhash_24_16.h
116 flowhash_8_8.h
117 flowhash_template.h
118 format.h
119 graph.h
120 hash.h
121 heap.h
122 lb_hash_hash.h
Florin Corasb957d802019-07-09 19:02:33 -0700123 llist.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200124 lock.h
125 longjmp.h
126 macros.h
127 maplog.h
128 math.h
129 memcpy_avx2.h
130 memcpy_avx512.h
131 memcpy_sse3.h
132 mem.h
133 mhash.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200134 mheap.h
Gary Boona9ed6f72019-07-22 10:57:56 -0400135 mpcap.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200136 os.h
Dave Barach3ae28732018-11-16 17:19:00 -0500137 pcap.h
138 pcap_funcs.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200139 pipeline.h
Damjan Marion68b4da62018-09-30 18:26:20 +0200140 pmalloc.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200141 pool.h
Dave Barach4d1a8662018-09-10 12:31:15 -0400142 pmc.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200143 ptclosure.h
144 random_buffer.h
145 random.h
146 random_isaac.h
Florin Coras672d5fc2019-04-15 17:28:51 -0700147 rbtree.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200148 serialize.h
Damjan Marioncf18ca92019-04-13 00:13:34 +0200149 sha2.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200150 slist.h
151 smp.h
152 socket.h
153 sparse_vec.h
154 string.h
155 time.h
156 time_range.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200157 timing_wheel.h
158 tw_timer_16t_1w_2048sl.h
159 tw_timer_16t_2w_512sl.h
160 tw_timer_1t_3w_1024sl_ov.h
161 tw_timer_2t_1w_2048sl.h
162 tw_timer_4t_3w_256sl.h
163 tw_timer_template.c
164 tw_timer_template.h
165 types.h
Sirshak Das2f6d7bb2018-10-03 22:53:51 +0000166 atomics.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200167 unix.h
Damjan Marion612dd6a2018-07-30 12:45:07 +0200168 valloc.h
169 vec_bootstrap.h
170 vec.h
171 vector_altivec.h
172 vector_avx2.h
173 vector_avx512.h
174 vector_funcs.h
175 vector.h
176 vector_neon.h
177 vector_sse42.h
178 xxhash.h
179 xy.h
180 zvec.h
181 linux/syscall.h
182 linux/sysfs.h
183)
184
Damjan Marion4dffd1c2018-09-03 12:30:36 +0200185if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
186 list(APPEND VPPINFRA_SRCS
187 elf_clib.c
188 linux/mem.c
189 linux/sysfs.c
190 )
191endif()
192
Damjan Marion4553c952018-08-26 11:04:40 +0200193add_vpp_library(vppinfra
194 SOURCES ${VPPINFRA_SRCS}
Florin Coras4c959952020-02-09 18:09:31 +0000195 LINK_LIBRARIES m
Damjan Marion4553c952018-08-26 11:04:40 +0200196 INSTALL_HEADERS ${VPPINFRA_HEADERS}
Damjan Marion43b06062018-08-29 22:20:45 +0200197 COMPONENT libvppinfra
Damjan Marion4553c952018-08-26 11:04:40 +0200198)
199
200##############################################################################
201# vppinfra headers
202##############################################################################
Damjan Marion612dd6a2018-07-30 12:45:07 +0200203option(VPP_BUILD_VPPINFRA_TESTS "Build vppinfra tests." OFF)
204if(VPP_BUILD_VPPINFRA_TESTS)
Damjan Marion4553c952018-08-26 11:04:40 +0200205 foreach(test
Damjan Marion612dd6a2018-07-30 12:45:07 +0200206 bihash_vec88
Damjan Marion612dd6a2018-07-30 12:45:07 +0200207 cuckoo_template
208 dlist
209 elf
210 elog
211 fifo
212 flowhash_template
213 format
214 fpool
215 hash
216 heap
217 longjmp
218 macros
219 maplog
Damjan Marion68b4da62018-09-30 18:26:20 +0200220 pmalloc
Damjan Marion612dd6a2018-07-30 12:45:07 +0200221 pool_iterate
222 ptclosure
223 random
224 random_isaac
jaszha0325ab6cf2019-07-01 17:20:52 -0500225 rwlock
Damjan Marion612dd6a2018-07-30 12:45:07 +0200226 serialize
227 slist
228 socket
jaszha039a4e6312019-06-19 14:07:05 -0500229 spinlock
Damjan Marion612dd6a2018-07-30 12:45:07 +0200230 time
231 time_range
232 timing_wheel
233 tw_timer
234 valloc
235 vec
Damjan Marion612dd6a2018-07-30 12:45:07 +0200236 zvec
237 )
Damjan Marion4553c952018-08-26 11:04:40 +0200238 add_vpp_executable(test_${test}
239 SOURCES test_${test}.c
Florin Coras4f944642019-08-01 10:54:06 -0700240 LINK_LIBRARIES vppinfra pthread
Damjan Marion4553c952018-08-26 11:04:40 +0200241 )
Damjan Marion612dd6a2018-07-30 12:45:07 +0200242 endforeach()
243
Damjan Marion4553c952018-08-26 11:04:40 +0200244 foreach(test bihash_template cuckoo_bihash)
245 add_vpp_executable(test_${test}
246 SOURCES test_${test}.c
247 LINK_LIBRARIES vppinfra Threads::Threads
248 )
249 endforeach()
Damjan Marion612dd6a2018-07-30 12:45:07 +0200250endif(VPP_BUILD_VPPINFRA_TESTS)