vppinfra: add bihash_8/24_16 to headers list
[vpp.git] / src / vppinfra / 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 enable_language(ASM)
15
16 ##############################################################################
17 # Generate vppinfra/config.h
18 ##############################################################################
19 set(LOG2_CACHE_LINE_BYTES ${VPP_LOG2_CACHE_LINE_SIZE})
20
21 option(VPP_VECTOR_GROW_BY_ONE "Vectors grow by one, instead of 3/2" OFF)
22 if(VPP_VECTOR_GROW_BY_ONE)
23   set(VECTOR_GROW_BY_ONE 1)
24 else(VPP_VECTOR_GROW_BY_ONE)
25   set(VECTOR_GROW_BY_ONE 0)
26 endif(VPP_VECTOR_GROW_BY_ONE)
27
28 configure_file(
29   ${CMAKE_SOURCE_DIR}/vppinfra/config.h.in
30   ${CMAKE_BINARY_DIR}/vppinfra/config.h
31 )
32
33 install(
34   FILES ${CMAKE_BINARY_DIR}/vppinfra/config.h
35   DESTINATION include/vppinfra
36   COMPONENT vpp-dev
37 )
38
39 add_definitions(-fvisibility=hidden)
40
41 ##############################################################################
42 # vppinfra sources
43 ##############################################################################
44 set(VPPINFRA_SRCS
45   backtrace.c
46   bihash_all_vector.c
47   cpu.c
48   dlmalloc.c
49   elf.c
50   elog.c
51   error.c
52   fifo.c
53   format.c
54   graph.c
55   hash.c
56   heap.c
57   longjmp.S
58   macros.c
59   maplog.c
60   mem.c
61   mem_dlmalloc.c
62   mhash.c
63   mpcap.c
64   pcap.c
65   pmalloc.c
66   pool.c
67   ptclosure.c
68   random_buffer.c
69   random.c
70   random_isaac.c
71   rbtree.c
72   serialize.c
73   socket.c
74   std-formats.c
75   string.c
76   time.c
77   time_range.c
78   timing_wheel.c
79   tw_timer_2t_2w_512sl.c
80   tw_timer_16t_1w_2048sl.c
81   tw_timer_16t_2w_512sl.c
82   tw_timer_1t_3w_1024sl_ov.c
83   tw_timer_2t_1w_2048sl.c
84   tw_timer_4t_3w_256sl.c
85   unformat.c
86   unix-formats.c
87   unix-misc.c
88   valloc.c
89   vec.c
90   vector.c
91 )
92
93 set(VPPINFRA_HEADERS
94   sanitizer.h
95   bihash_16_8.h
96   bihash_24_8.h
97   bihash_40_8.h
98   bihash_48_8.h
99   bihash_8_8.h
100   bihash_8_16.h
101   bihash_24_16.h
102   bihash_template.c
103   bihash_template.h
104   bihash_vec8_8.h
105   bitmap.h
106   bitops.h
107   byte_order.h
108   cache.h
109   callback.h
110   callback_data.h
111   clib_error.h
112   clib.h
113   cpu.h
114   crc32.h
115   dlist.h
116   dlmalloc.h
117   elf_clib.h
118   elf.h
119   elog.h
120   error_bootstrap.h
121   error.h
122   fifo.h
123   file.h
124   format.h
125   graph.h
126   hash.h
127   heap.h
128   lb_hash_hash.h
129   llist.h
130   lock.h
131   longjmp.h
132   macros.h
133   maplog.h
134   math.h
135   memcpy_avx2.h
136   memcpy_avx512.h
137   memcpy_sse3.h
138   mem.h
139   mhash.h
140   mpcap.h
141   os.h
142   pcap.h
143   pcap_funcs.h
144   pmalloc.h
145   pool.h
146   pmc.h
147   ptclosure.h
148   random_buffer.h
149   random.h
150   random_isaac.h
151   rbtree.h
152   serialize.h
153   sha2.h
154   smp.h
155   socket.h
156   sparse_vec.h
157   string.h
158   time.h
159   time_range.h
160   timing_wheel.h
161   tw_timer_2t_2w_512sl.h
162   tw_timer_16t_1w_2048sl.h
163   tw_timer_16t_2w_512sl.h
164   tw_timer_1t_3w_1024sl_ov.h
165   tw_timer_2t_1w_2048sl.h
166   tw_timer_4t_3w_256sl.h
167   tw_timer_template.c
168   tw_timer_template.h
169   types.h
170   atomics.h
171   unix.h
172   valloc.h
173   vec_bootstrap.h
174   vec.h
175   vector_altivec.h
176   vector_avx2.h
177   vector_avx512.h
178   vector_funcs.h
179   vector.h
180   vector_neon.h
181   vector_sse42.h
182   warnings.h
183   xxhash.h
184   linux/syscall.h
185   linux/sysfs.h
186 )
187
188 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
189   list(APPEND VPPINFRA_SRCS
190     elf_clib.c
191     linux/mem.c
192     linux/sysfs.c
193    )
194 endif()
195
196 add_vpp_library(vppinfra
197   SOURCES ${VPPINFRA_SRCS}
198   LINK_LIBRARIES m
199   INSTALL_HEADERS ${VPPINFRA_HEADERS}
200   COMPONENT libvppinfra
201 )
202
203 ##############################################################################
204 # vppinfra headers
205 ##############################################################################
206 option(VPP_BUILD_VPPINFRA_TESTS "Build vppinfra tests." OFF)
207 if(VPP_BUILD_VPPINFRA_TESTS)
208   foreach(test
209     bihash_vec88
210     dlist
211     elf
212     elog
213     fifo
214     format
215     fpool
216     hash
217     heap
218     longjmp
219     macros
220     maplog
221     pmalloc
222     pool_iterate
223     ptclosure
224     random
225     random_isaac
226     rwlock
227     serialize
228     socket
229     spinlock
230     time
231     time_range
232     tw_timer
233     valloc
234     vec
235   )
236     add_vpp_executable(test_${test}
237       SOURCES test_${test}.c
238       LINK_LIBRARIES vppinfra pthread
239       )
240   endforeach()
241
242   foreach(test bihash_template)
243     add_vpp_executable(test_${test}
244       SOURCES test_${test}.c
245       LINK_LIBRARIES vppinfra Threads::Threads
246       )
247   endforeach()
248 endif(VPP_BUILD_VPPINFRA_TESTS)