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.
15 ${CMAKE_CURRENT_SOURCE_DIR}
16 ${CMAKE_CURRENT_BINARY_DIR}
19 macro(add_vpp_plugin plugin_name)
22 if(${f} MATCHES ".*\.api$")
23 vpp_generate_api_header(${f})
24 list(APPEND api_headers ${f}.h)
27 add_library(${plugin_name} SHARED ${ARGN} ${api_headers})
28 add_dependencies(${plugin_name} vpp_version_h api_headers)
29 set_target_properties(${plugin_name} PROPERTIES
31 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_plugins)
32 install(TARGETS ${plugin_name} DESTINATION lib/vpp_plugins COMPONENT plugins)
35 macro(add_vpp_api_test_plugin plugin_name)
38 if(${f} MATCHES ".*\.api$")
39 vpp_generate_api_header(${f})
40 list(APPEND api_headers ${f}.h)
43 add_library(${plugin_name} SHARED ${ARGN} ${api_headers})
44 add_dependencies(${plugin_name} api_headers)
45 set_target_properties(${plugin_name} PROPERTIES PREFIX "")
46 set_target_properties(${plugin_name} PROPERTIES
48 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}//vpp_api_test_plugins)
49 install(TARGETS ${plugin_name} DESTINATION lib/vpp_api_test_plugins COMPONENT
53 ##############################################################################
54 # find and add all plugin subdirs
55 ############################################################################
56 FILE(GLOB files RELATIVE
57 ${CMAKE_CURRENT_SOURCE_DIR}
58 ${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt
61 get_filename_component(dir ${f} DIRECTORY)
62 add_subdirectory(${dir})