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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 ##############################################################################
17 # Generate vppinfra/config.h
18 ##############################################################################
19 set(LOG2_CACHE_LINE_BYTES ${VPP_LOG2_CACHE_LINE_SIZE})
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)
29 ${CMAKE_SOURCE_DIR}/vppinfra/config.h.in
30 ${CMAKE_CURRENT_BINARY_DIR}/config.h
34 FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
35 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vppinfra
39 add_definitions(-fvisibility=hidden)
41 # Ensure symbols from cJSON are exported
42 set_source_files_properties( cJSON.c jsonformat.c PROPERTIES
43 COMPILE_DEFINITIONS " CJSON_API_VISIBILITY " )
46 ##############################################################################
48 ##############################################################################
88 tw_timer_2t_2w_512sl.c
89 tw_timer_16t_1w_2048sl.c
90 tw_timer_16t_2w_512sl.c
91 tw_timer_1t_3w_1024sl_ov.c
92 tw_timer_2t_1w_2048sl.c
93 tw_timer_4t_3w_256sl.c
182 tw_timer_2t_2w_512sl.h
183 tw_timer_16t_1w_2048sl.h
184 tw_timer_16t_2w_512sl.h
185 tw_timer_1t_3w_1024sl_ov.h
186 tw_timer_2t_1w_2048sl.h
187 tw_timer_4t_3w_256sl.h
202 vector/index_to_ptr.h
204 vector/mask_compare.h
214 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
215 list(APPEND VPPINFRA_SRCS
220 # TODO: Temporarily don't build perfmon on non-Linux
221 perfmon/bundle_default.c
222 perfmon/bundle_core_power.c
225 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
226 list(APPEND VPPINFRA_SRCS
232 if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
233 option(VPP_USE_EXTERNAL_LIBEXECINFO "Use external libexecinfo (useful for non-glibc targets)." ON)
235 option(VPP_USE_EXTERNAL_LIBEXECINFO "Use external libexecinfo (useful for non-glibc targets)." OFF)
237 option(VPP_USE_LIBUNWIND "Use libunwind for backtrace." OFF)
239 if(VPP_USE_EXTERNAL_LIBEXECINFO)
240 set(EXECINFO_LIB execinfo)
241 elseif(VPP_USE_LIBUNWIND)
242 set(EXECINFO_LIB unwind)
243 add_compile_definitions(USE_LIBUNWIND)
245 add_vpp_library(vppinfra
246 SOURCES ${VPPINFRA_SRCS}
247 LINK_LIBRARIES m ${EXECINFO_LIB}
248 INSTALL_HEADERS ${VPPINFRA_HEADERS}
249 COMPONENT libvppinfra
253 ##############################################################################
255 ##############################################################################
256 option(VPP_BUILD_VPPINFRA_TESTS "Build vppinfra tests." OFF)
257 if(VPP_BUILD_VPPINFRA_TESTS)
289 add_vpp_executable(test_${test}
290 SOURCES test_${test}.c
291 LINK_LIBRARIES vppinfra pthread
295 foreach(test bihash_template)
296 add_vpp_executable(test_${test}
297 SOURCES test_${test}.c
298 LINK_LIBRARIES vppinfra Threads::Threads
301 endif(VPP_BUILD_VPPINFRA_TESTS)
320 add_vpp_executable(test_infra
324 LINK_LIBRARIES vppinfra
328 vpp_library_set_multiarch_sources(test_infra