cmake: move functions to src/cmake 85/14485/2
authorDamjan Marion <damarion@cisco.com>
Sun, 26 Aug 2018 08:14:52 +0000 (10:14 +0200)
committerDamjan Marion <damarion@cisco.com>
Sun, 26 Aug 2018 08:41:08 +0000 (10:41 +0200)
Change-Id: Ibcb7105fa7e3c09efdce01bccd4de235fe33ea99
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/CMakeLists.txt
src/cmake/api.cmake [new file with mode: 0644]
src/cmake/ccache.cmake [new file with mode: 0644]
src/cmake/cpu.cmake [new file with mode: 0644]
src/cmake/deb.cmake [new file with mode: 0644]
src/cmake/memfd.cmake [new file with mode: 0644]
src/cmake/message.cmake [new file with mode: 0644]
src/cmake/plugin.cmake [new file with mode: 0644]
src/plugins/CMakeLists.txt
src/plugins/tlsopenssl/CMakeLists.txt
src/vnet/CMakeLists.txt

index cdf756e..cd028cb 100644 (file)
@@ -17,59 +17,9 @@ project(vpp C)
 
 include(CheckCCompilerFlag)
 
-##############################################################################
-# Highlight WARNING and ERROR messages
-##############################################################################
-function(message)
-  list(GET ARGV 0 type)
-  string(ASCII 27 esc)
-  set(red "${esc}[1;31m")
-  set(yellow "${esc}[1;33m")
-  set(reset "${esc}[m")
-  if(type STREQUAL FATAL_ERROR OR type STREQUAL SEND_ERROR)
-    list(REMOVE_AT ARGV 0)
-    _message(${type} "${red}${ARGV}${reset}")
-  elseif(type STREQUAL WARNING)
-    list(REMOVE_AT ARGV 0)
-    _message(STATUS "${yellow}${ARGV}${reset}")
-  elseif(type STREQUAL STATUS)
-    list(REMOVE_AT ARGV 0)
-    _message(STATUS "${ARGV}")
-  else()
-    _message(${ARGV})
-  endif()
-endfunction()
-
-##############################################################################
-# CPU optimizations and multiarch support
-##############################################################################
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
-  set(CMAKE_C_FLAGS "-march=corei7 -mtune=corei7-avx ${CMAKE_C_FLAGS}")
-  check_c_compiler_flag("-march=core-avx2" AVX2)
-  if(AVX2)
-    list(APPEND MARCH_VARIANTS "avx2\;-march=core-avx2 -mtune=core-avx2")
-  endif()
-  check_c_compiler_flag("-march=skylake-avx512" AVX512)
-  if(AVX512)
-    list(APPEND MARCH_VARIANTS "avx512\;-march=skylake-avx512 -mtune=skylake-avx512")
-  endif()
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
-  set(CMAKE_C_FLAGS "-march=armv8-a+crc ${CMAKE_C_FLAGS}")
-endif()
-
-macro(vpp_library_set_multiarch_sources lib)
-  foreach(V ${MARCH_VARIANTS})
-    list(GET V 0 VARIANT)
-    list(GET V 1 VARIANT_FLAGS)
-    set(l ${lib}_${VARIANT})
-    add_library(${l} OBJECT ${ARGN})
-    set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON)
-    target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}")
-    separate_arguments(VARIANT_FLAGS)
-    target_compile_options(${l} PUBLIC ${VARIANT_FLAGS})
-    target_sources(${lib} PRIVATE $<TARGET_OBJECTS:${l}>)
-  endforeach()
-endmacro()
+include(cmake/message.cmake)
+include(cmake/cpu.cmake)
+include(cmake/ccache.cmake)
 
 ##############################################################################
 # build config
@@ -80,22 +30,6 @@ set(CMAKE_C_FLAGS_COMMON "-DFORTIFY_SOURCE=2 -fstack-protector-all -Werror")
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS_COMMON} -DCLIB_DEBUG")
 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS_COMMON}")
 
-##############################################################################
-# ccache
-##############################################################################
-option(VPP_USE_CCACHE "Use ccache compiler cache." ON)
-if(VPP_USE_CCACHE)
-  find_program(CCACHE_FOUND ccache)
-  message(STATUS "Looking for ccache")
-  if(CCACHE_FOUND)
-    message(STATUS "Looking for ccache - found")
-    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
-    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
-  else(CCACHE_FOUND)
-    message(STATUS "Looking for ccache - not found")
-  endif(CCACHE_FOUND)
-endif(VPP_USE_CCACHE)
-
 ##############################################################################
 # install config
 ##############################################################################
@@ -116,72 +50,11 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "vpp")
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 find_package(OpenSSL REQUIRED)
-include_directories(${OPENSSL_INCLUDE_DIR})
-
-##############################################################################
-# Check for memfd_create headers and libs
-##############################################################################
-check_c_source_compiles("
-  #define _GNU_SOURCE
-  #include <sys/mman.h>
-  int main() { return memfd_create (\"/dev/false\", 0); }
-" HAVE_MEMFD_CREATE)
-
-if (HAVE_MEMFD_CREATE)
-    add_definitions(-DHAVE_MEMFD_CREATE)
-endif()
-
-##############################################################################
-# API
-##############################################################################
-function(vpp_generate_api_c_header file)
-  set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.h)
-  get_filename_component(output_dir ${output_name} DIRECTORY)
-  add_custom_command (OUTPUT ${output_name}
-    COMMAND mkdir -p ${output_dir}
-    COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen
-    ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --output ${output_name}
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
-    COMMENT "Generating API header ${output_name}"
-  )
-endfunction()
-
-function(vpp_generate_api_json_header file dir)
-  set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.json)
-  get_filename_component(output_dir ${output_name} DIRECTORY)
-  add_custom_command (OUTPUT ${output_name}
-    COMMAND mkdir -p ${output_dir}
-    COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen
-    ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} JSON --output ${output_name}
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
-    COMMENT "Generating API header ${output_name}"
-  )
-  install(FILES ${output_name} DESTINATION share/vpp/api/${dir}/)
-endfunction()
-
-##############################################################################
-# generate the .h and .json files for a .api file
-#  @param file - the name of the .api
-#  @param dir  - the install directory under ROOT/share/vpp/api to place the
-#                generated .json file
-##############################################################################
-function(vpp_generate_api_header file dir)
-    vpp_generate_api_c_header (${file})
-    vpp_generate_api_json_header (${file} ${dir})
-endfunction()
-
-function(vpp_add_api_files target)
-  unset(header_files)
-  foreach(file ${ARGN})
-    vpp_generate_api_header (${file} core)
-    list (APPEND header_files ${file}.h ${file}.json)
-  endforeach()
-  add_custom_target(${target} DEPENDS ${header_files})
-endfunction()
 
-add_custom_target(api_headers
-  DEPENDS vlibmemory_api_headers vnet_api_headers vpp_api_headers
-)
+include(cmake/memfd.cmake)
+include(cmake/api.cmake)
+include(cmake/plugin.cmake)
+include(cmake/deb.cmake)
 
 ##############################################################################
 # header files
@@ -200,20 +73,3 @@ foreach (DIR vppinfra svm vlib vlibmemory vlibapi vnet vpp vpp-api vat vcl plugi
   add_subdirectory(${DIR})
 endforeach ()
 
-##############################################################################
-# DEB Packaging
-##############################################################################
-set(CPACK_GENERATOR "DEB")
-set(CPACK_DEBIAN_PACKAGE_MAINTAINER "VPP Team")
-set(CPACK_PACKAGE_NAME "vpp")
-set(CPACK_PACKAGE_VENDOR "fd.io")
-set(CPACK_PACKAGE_VERSION "18.08")
-set(CPACK_DEB_COMPONENT_INSTALL ON)
-set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
-set(CPACK_DEBIAN_VPP_PACKAGE_NAME "vpp")
-set(CPACK_DEBIAN_VPP_FILE_NAME "vpp.deb")
-set(CPACK_DEBIAN_DEV_PACKAGE_NAME "vpp-dev")
-set(CPACK_DEBIAN_DEV_FILE_NAME "vpp-dev.deb")
-set(CPACK_DEBIAN_PLUGINS_PACKAGE_NAME "vpp-plugins")
-set(CPACK_DEBIAN_PLUGINS_FILE_NAME "vpp-plugins.deb")
-include(CPack)
diff --git a/src/cmake/api.cmake b/src/cmake/api.cmake
new file mode 100644 (file)
index 0000000..644e80b
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# API
+##############################################################################
+function(vpp_generate_api_c_header file)
+  set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.h)
+  get_filename_component(output_dir ${output_name} DIRECTORY)
+  add_custom_command (OUTPUT ${output_name}
+    COMMAND mkdir -p ${output_dir}
+    COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen
+    ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --output ${output_name}
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
+    COMMENT "Generating API header ${output_name}"
+  )
+endfunction()
+
+function(vpp_generate_api_json_header file dir)
+  set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.json)
+  get_filename_component(output_dir ${output_name} DIRECTORY)
+  add_custom_command (OUTPUT ${output_name}
+    COMMAND mkdir -p ${output_dir}
+    COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen
+    ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} JSON --output ${output_name}
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
+    COMMENT "Generating API header ${output_name}"
+  )
+  install(FILES ${output_name} DESTINATION share/vpp/api/${dir}/)
+endfunction()
+
+##############################################################################
+# generate the .h and .json files for a .api file
+#  @param file - the name of the .api
+#  @param dir  - the install directory under ROOT/share/vpp/api to place the
+#                generated .json file
+##############################################################################
+function(vpp_generate_api_header file dir)
+    vpp_generate_api_c_header (${file})
+    vpp_generate_api_json_header (${file} ${dir})
+endfunction()
+
+function(vpp_add_api_files target)
+  unset(header_files)
+  foreach(file ${ARGN})
+    vpp_generate_api_header (${file} core)
+    list (APPEND header_files ${file}.h ${file}.json)
+  endforeach()
+  add_custom_target(${target} DEPENDS ${header_files})
+endfunction()
+
+add_custom_target(api_headers
+  DEPENDS vlibmemory_api_headers vnet_api_headers vpp_api_headers
+)
+
diff --git a/src/cmake/ccache.cmake b/src/cmake/ccache.cmake
new file mode 100644 (file)
index 0000000..058a0f3
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# ccache
+##############################################################################
+option(VPP_USE_CCACHE "Use ccache compiler cache." ON)
+if(VPP_USE_CCACHE)
+  find_program(CCACHE_FOUND ccache)
+  message(STATUS "Looking for ccache")
+  if(CCACHE_FOUND)
+    message(STATUS "Looking for ccache - found")
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+  else(CCACHE_FOUND)
+    message(STATUS "Looking for ccache - not found")
+  endif(CCACHE_FOUND)
+endif(VPP_USE_CCACHE)
diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake
new file mode 100644 (file)
index 0000000..e0311ce
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# CPU optimizations and multiarch support
+##############################################################################
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
+  set(CMAKE_C_FLAGS "-march=corei7 -mtune=corei7-avx ${CMAKE_C_FLAGS}")
+  check_c_compiler_flag("-march=core-avx2" AVX2)
+  if(AVX2)
+    list(APPEND MARCH_VARIANTS "avx2\;-march=core-avx2 -mtune=core-avx2")
+  endif()
+  check_c_compiler_flag("-march=skylake-avx512" AVX512)
+  if(AVX512)
+    list(APPEND MARCH_VARIANTS "avx512\;-march=skylake-avx512 -mtune=skylake-avx512")
+  endif()
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
+  set(CMAKE_C_FLAGS "-march=armv8-a+crc ${CMAKE_C_FLAGS}")
+endif()
+
+macro(vpp_library_set_multiarch_sources lib)
+  foreach(V ${MARCH_VARIANTS})
+    list(GET V 0 VARIANT)
+    list(GET V 1 VARIANT_FLAGS)
+    set(l ${lib}_${VARIANT})
+    add_library(${l} OBJECT ${ARGN})
+    set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON)
+    target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}")
+    separate_arguments(VARIANT_FLAGS)
+    target_compile_options(${l} PUBLIC ${VARIANT_FLAGS})
+    target_sources(${lib} PRIVATE $<TARGET_OBJECTS:${l}>)
+  endforeach()
+endmacro()
+
diff --git a/src/cmake/deb.cmake b/src/cmake/deb.cmake
new file mode 100644 (file)
index 0000000..09c8ac6
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# DEB Packaging
+##############################################################################
+set(CPACK_GENERATOR "DEB")
+set(CPACK_DEBIAN_PACKAGE_MAINTAINER "VPP Team")
+set(CPACK_PACKAGE_NAME "vpp")
+set(CPACK_PACKAGE_VENDOR "fd.io")
+set(CPACK_PACKAGE_VERSION "18.08")
+set(CPACK_DEB_COMPONENT_INSTALL ON)
+set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+set(CPACK_DEBIAN_VPP_PACKAGE_NAME "vpp")
+set(CPACK_DEBIAN_VPP_FILE_NAME "vpp.deb")
+set(CPACK_DEBIAN_DEV_PACKAGE_NAME "vpp-dev")
+set(CPACK_DEBIAN_DEV_FILE_NAME "vpp-dev.deb")
+set(CPACK_DEBIAN_PLUGINS_PACKAGE_NAME "vpp-plugins")
+set(CPACK_DEBIAN_PLUGINS_FILE_NAME "vpp-plugins.deb")
+include(CPack)
diff --git a/src/cmake/memfd.cmake b/src/cmake/memfd.cmake
new file mode 100644 (file)
index 0000000..ca499c4
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# Check for memfd_create headers and libs
+##############################################################################
+check_c_source_compiles("
+  #define _GNU_SOURCE
+  #include <sys/mman.h>
+  int main() { return memfd_create (\"/dev/false\", 0); }
+" HAVE_MEMFD_CREATE)
+
+if (HAVE_MEMFD_CREATE)
+    add_definitions(-DHAVE_MEMFD_CREATE)
+endif()
+
diff --git a/src/cmake/message.cmake b/src/cmake/message.cmake
new file mode 100644 (file)
index 0000000..faee000
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# Highlight WARNING and ERROR messages
+##############################################################################
+function(message)
+  list(GET ARGV 0 type)
+  string(ASCII 27 esc)
+  set(red "${esc}[1;31m")
+  set(yellow "${esc}[1;33m")
+  set(reset "${esc}[m")
+  if(type STREQUAL FATAL_ERROR OR type STREQUAL SEND_ERROR)
+    list(REMOVE_AT ARGV 0)
+    _message(${type} "${red}${ARGV}${reset}")
+  elseif(type STREQUAL WARNING)
+    list(REMOVE_AT ARGV 0)
+    _message(STATUS "${yellow}${ARGV}${reset}")
+  elseif(type STREQUAL STATUS)
+    list(REMOVE_AT ARGV 0)
+    _message(STATUS "${ARGV}")
+  else()
+    _message(${ARGV})
+  endif()
+endfunction()
+
diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake
new file mode 100644 (file)
index 0000000..e9397a7
--- /dev/null
@@ -0,0 +1,53 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+macro(add_vpp_plugin name)
+  cmake_parse_arguments(PLUGIN
+    ""
+    "LINK_FLAGS"
+    "SOURCES;API_FILES;MULTIARCH_SOURCES;LINK_LIBRARIES;API_TEST_SOURCES"
+    ${ARGN}
+  )
+  set(plugin_name ${name}_plugin)
+  set(api_headers)
+  foreach(f ${PLUGIN_API_FILES})
+     vpp_generate_api_header(${f} plugins)
+     list(APPEND api_headers ${f}.h ${f}.json)
+  endforeach()
+  add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_headers})
+  add_dependencies(${plugin_name} vpp_version_h api_headers)
+  set_target_properties(${plugin_name} PROPERTIES
+    PREFIX ""
+    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_plugins)
+  if(PLUGIN_MULTIARCH_SOURCES)
+    vpp_library_set_multiarch_sources(${plugin_name} ${PLUGIN_MULTIARCH_SOURCES})
+  endif()
+  if(PLUGIN_LINK_LIBRARIES)
+    target_link_libraries(${plugin_name} ${PLUGIN_LINK_LIBRARIES})
+  endif()
+  if(PLUGIN_LINK_FLAGS)
+    set_target_properties(${plugin_name} PROPERTIES LINK_FLAGS "${PLUGIN_LINK_FLAGS}")
+  endif()
+  if(PLUGIN_API_TEST_SOURCES)
+    set(test_plugin_name ${name}_test_plugin)
+    add_library(${test_plugin_name} SHARED ${PLUGIN_API_TEST_SOURCES} ${api_headers})
+    add_dependencies(${test_plugin_name} api_headers)
+    set_target_properties(${test_plugin_name} PROPERTIES
+      PREFIX ""
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins)
+    install(TARGETS ${test_plugin_name} DESTINATION lib/vpp_api_test_plugins COMPONENT
+           plugins)
+  endif()
+  install(TARGETS ${plugin_name} DESTINATION lib/vpp_plugins COMPONENT plugins)
+endmacro()
+
index 877d25d..e54eaa2 100644 (file)
@@ -16,49 +16,9 @@ include_directories (
   ${CMAKE_CURRENT_BINARY_DIR}
 )
 
-macro(add_vpp_plugin name)
-  cmake_parse_arguments(PLUGIN
-    ""
-    "LINK_FLAGS"
-    "SOURCES;API_FILES;MULTIARCH_SOURCES;LINK_LIBRARIES;API_TEST_SOURCES"
-    ${ARGN}
-  )
-  set(plugin_name ${name}_plugin)
-  set(api_headers)
-  foreach(f ${PLUGIN_API_FILES})
-     vpp_generate_api_header(${f} plugins)
-     list(APPEND api_headers ${f}.h ${f}.json)
-  endforeach()
-  add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_headers})
-  add_dependencies(${plugin_name} vpp_version_h api_headers)
-  set_target_properties(${plugin_name} PROPERTIES
-    PREFIX ""
-    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_plugins)
-  if(PLUGIN_MULTIARCH_SOURCES)
-    vpp_library_set_multiarch_sources(${plugin_name} ${PLUGIN_MULTIARCH_SOURCES})
-  endif()
-  if(PLUGIN_LINK_LIBRARIES)
-    target_link_libraries(${plugin_name} ${PLUGIN_LINK_LIBRARIES})
-  endif()
-  if(PLUGIN_LINK_FLAGS)
-    set_target_properties(${plugin_name} PROPERTIES LINK_FLAGS "${PLUGIN_LINK_FLAGS}")
-  endif()
-  if(PLUGIN_API_TEST_SOURCES)
-    set(test_plugin_name ${name}_test_plugin)
-    add_library(${test_plugin_name} SHARED ${PLUGIN_API_TEST_SOURCES} ${api_headers})
-    add_dependencies(${test_plugin_name} api_headers)
-    set_target_properties(${test_plugin_name} PROPERTIES
-      PREFIX ""
-      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins)
-    install(TARGETS ${test_plugin_name} DESTINATION lib/vpp_api_test_plugins COMPONENT
-           plugins)
-  endif()
-  install(TARGETS ${plugin_name} DESTINATION lib/vpp_plugins COMPONENT plugins)
-endmacro()
-
 ##############################################################################
 # find and add all plugin subdirs
-############################################################################
+##############################################################################
 FILE(GLOB files RELATIVE
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt
index fac27f5..609be90 100644 (file)
@@ -12,6 +12,7 @@
 # limitations under the License.
 
 if(OPENSSL_FOUND)
+  include_directories(${OPENSSL_INCLUDE_DIR})
   add_vpp_plugin(tlsopenssl
     SOURCES
     tls_openssl.c
index 349ef64..b24db20 100644 (file)
@@ -12,6 +12,8 @@
 # limitations under the License.
 
 add_definitions (-DWITH_LIBSSL=1)
+include_directories(${OPENSSL_INCLUDE_DIR})
+
 set(VNET_SRCS
   adj/adj_bfd.c
   adj/adj.c