CMake: Add Cmake support for Vat 33/14433/4
authorMohsin Kazmi <sykazmi@cisco.com>
Wed, 22 Aug 2018 08:54:42 +0000 (10:54 +0200)
committerDamjan Marion <dmarion@me.com>
Thu, 23 Aug 2018 13:58:06 +0000 (13:58 +0000)
Change-Id: I3e8efce9eacba46ec9913d4024d66f00fe326095
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
src/CMakeLists.txt
src/vat/CMakeLists.txt [new file with mode: 0644]
src/vpp/CMakeLists.txt

index c0b4bba..eefc2ad 100644 (file)
@@ -118,8 +118,6 @@ find_package(Threads REQUIRED)
 find_package(OpenSSL REQUIRED)
 include_directories(${OPENSSL_INCLUDE_DIR})
 
-add_definitions(-DVPP_API_TEST_BUILTIN=1)
-
 ##############################################################################
 # Check for memfd_create headers and libs
 ##############################################################################
@@ -198,7 +196,7 @@ endfunction()
 ##############################################################################
 # subdirs
 ##############################################################################
-foreach (DIR vppinfra svm vlib vlibmemory vnet vpp vpp-api vcl plugins)
+foreach (DIR vppinfra svm vlib vlibmemory vnet vpp vpp-api vat vcl plugins)
   add_subdirectory(${DIR})
 endforeach ()
 
diff --git a/src/vat/CMakeLists.txt b/src/vat/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9edfec7
--- /dev/null
@@ -0,0 +1,63 @@
+# 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.
+
+##############################################################################
+# vat plugin shared library
+##############################################################################
+add_library(vatplugin SHARED plugin_api.c)
+target_link_libraries(vatplugin vppinfra)
+add_dependencies (vatplugin vppinfra)
+install(TARGETS vatplugin DESTINATION lib)
+
+##############################################################################
+# vpp_api_test
+##############################################################################
+add_executable (vpp_api_test
+  api_format.c
+  main.c
+  plugin.c
+  json_format.c
+  vat.h
+  json_format.h
+)
+target_link_libraries (vpp_api_test vlibmemoryclient svm vatplugin vppinfra
+                       Threads::Threads rt m dl crypto)
+set_target_properties(vpp_api_test PROPERTIES ENABLE_EXPORTS 1)
+install(TARGETS vpp_api_test DESTINATION bin)
+
+##############################################################################
+#  vpp_json_test
+##############################################################################
+add_executable (vpp_json_test
+  json_format.h
+  json_format.c
+  json_test.c)
+target_link_libraries(vpp_json_test vppinfra m)
+set_target_properties(vpp_json_test PROPERTIES ENABLE_EXPORTS 1)
+install(TARGETS vpp_json_test DESTINATION bin)
+
+##############################################################################
+# vat headers
+##############################################################################
+vpp_add_header_files(vat
+  vat.h
+  json_format.h
+)
+
+##############################################################################
+# restart
+##############################################################################
+add_executable (vpp_restart restart.c)
+target_link_libraries (vpp_restart svmdb svm vppinfra pthread rt)
+install(TARGETS vpp_restart DESTINATION bin )
+
index 9838408..b3073de 100644 (file)
@@ -31,6 +31,7 @@ add_custom_target(vpp_version_h
 ##############################################################################
 # vpp binary
 ##############################################################################
+option(VPP_API_TEST_BUILTIN "Use builtin VPP API test." ON)
 
 vpp_add_api_files(vpp_api_headers
   api/vpe.api
@@ -38,7 +39,7 @@ vpp_add_api_files(vpp_api_headers
   oam/oam.api
 )
 
-add_executable (vpp
+set(VPP_SOURCES
   vnet/main.c
   app/vpe_cli.c
   app/version.c
@@ -47,12 +48,21 @@ add_executable (vpp
   stats/stats.c
   stats/stat_segment.c
   api/api.c
-  api/api_main.c
-  api/api_format.c
   api/json_format.c
   api/custom_dump.c
-  api/plugin.c
 )
+
+if(VPP_API_TEST_BUILTIN)
+  list(APPEND VPP_SOURCES
+    api/api_format.c
+    api/api_main.c
+    api/plugin.c
+  )
+  add_definitions(-DVPP_API_TEST_BUILTIN=1)
+endif()
+
+add_executable (vpp ${VPP_SOURCES})
+
 target_link_libraries(vpp svm vlib vppinfra vlibmemory vnet Threads::Threads
                      ${CMAKE_DL_LIBS})
 add_dependencies(vpp vpp_version_h api_headers)