diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/README.md | 9 | ||||
-rw-r--r-- | src/cmake/FindGRPC.cmake | 76 | ||||
-rw-r--r-- | src/cmake/FindVPP.cmake | 26 | ||||
-rw-r--r-- | src/gnmi/CMakeLists.txt | 47 | ||||
-rw-r--r-- | src/gnmi/gnmidata.cpp | 11 | ||||
-rw-r--r-- | src/gnmi/gnmidata.h | 11 | ||||
-rw-r--r-- | src/gnmi/proto/CMakeLists.txt | 69 | ||||
-rw-r--r-- | src/plugins/CMakeLists.txt | 36 | ||||
-rw-r--r-- | src/scvpp/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/scvpp/src/CMakeLists.txt | 12 |
11 files changed, 199 insertions, 125 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4888114..f5be384 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,21 +17,12 @@ cmake_minimum_required(VERSION 2.8) project(sweetcomb) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") - -include(GNUInstallDirs) - # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) -# set compiler options -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -set(CMAKE_C_FLAGS "-Wall -std=gnu99") -set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") -set(CMAKE_C_FLAGS_DEBUG "-g -O0") - # add subdirectories add_subdirectory(scvpp) add_subdirectory(plugins) diff --git a/src/README.md b/src/README.md deleted file mode 100644 index 3375d25..0000000 --- a/src/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Sysrepo - VPP Integration - -This repository contains a work-in-progress code of the integration of [Sysrepo datastore](https://github.com/sysrepo/sysrepo/) with [VPP](https://fd.io/). - -It consists of two components: -- [srvpp](srvpp/) library that provides convenient API for managing VPP from Sysrepo plugins, -- [plugins](plugins/) for Sysrepo that provide the VPP management functionality. - -As of now, basic VPP interface management (interface enable/disble, IPv4/IPv6 address config) has been implemented in [vpp-interfaces plugin](plugins/vpp-interfaces.c). diff --git a/src/cmake/FindGRPC.cmake b/src/cmake/FindGRPC.cmake new file mode 100644 index 0000000..e45f969 --- /dev/null +++ b/src/cmake/FindGRPC.cmake @@ -0,0 +1,76 @@ +# From https://github.com/wastl/cmarmotta/blob/master/cmake/FindGRPC.cmake +# +# - Try to find gRPC +# Once done this will define +# +# GRPC_CPP_PLUGIN - Absolute path to grpc c++ plugin +# GRPCPP_LIBRARY - +# GPR_LIBRARY - +# +# VPP_FOUND - system has VPP +# VPP_INCLUDE_DIRS - the VPP include directory +# VPP_LIBRARIES - Link these to use LibSSH + +#Absolute path to grpc_cpp_plugin +find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin) + +find_library(GRPC_LIBRARY NAMES grpc) +find_library(GRPCPP_LIBRARY NAMES grpc++) +find_library(GPR_LIBRARY NAMES gpr) +set(GRPC_LIBRARIES ${GRPCPP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY}) + +function(PROTOBUF_GENERATE_GRPC_CPP SRCS HDRS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) # This variable is common for all types of output. + # Create an include path for each file specified + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + + set(${SRCS}) + set(${HDRS}) + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + + list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.cc") + list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.h") + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.cc" + "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.h" + COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} + ARGS --grpc_out=${CMAKE_CURRENT_BINARY_DIR} + --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} + ${_protobuf_include_path} ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} + COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" + VERBATIM) + endforeach() + + set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) + set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() diff --git a/src/cmake/FindVPP.cmake b/src/cmake/FindVPP.cmake index 3f229dc..afc1520 100644 --- a/src/cmake/FindVPP.cmake +++ b/src/cmake/FindVPP.cmake @@ -1,11 +1,3 @@ -# - Try to find LibVPP -# Once done this will define -# -# VPP_FOUND - system has VPP -# VPP_INCLUDE_DIRS - the VPP include directory -# VPP_LIBRARIES - Link these to use LibSSH -# - # # Copyright (c) 2018 PANTHEON.tech. # @@ -20,7 +12,14 @@ # 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. + + +# - Try to find LibVPP +# Once done this will define # +# VPP_FOUND - system has VPP +# VPP_INCLUDE_DIRS - the VPP include directory +# VPP_LIBRARIES - Link these to use LibSSH if (VPP_LIBRARIES AND VPP_INCLUDE_DIRS) @@ -159,16 +158,6 @@ else (VPP_LIBRARIES AND VPP_INCLUDE_DIRS) ${CMAKE_INSTALL_PREFIX}/lib ) -# find_library(VOM_LIBRARY -# NAMES -# vom -# libvom -# PATHS -# ${VPP_LIBRARY_PATH} -# ${CMAKE_LIBRARY_PATH} -# ${CMAKE_INSTALL_PREFIX}/lib -# ) - if (VPP_INCLUDE_DIR AND VPP_LIBRARY) set(VPP_FOUND TRUE) else (VPP_INCLUDE_DIR AND VPP_LIBRARY) @@ -191,7 +180,6 @@ else (VPP_LIBRARIES AND VPP_INCLUDE_DIRS) ${VLIB_LIBRARY} ${VATPLUGIN_LIBRARY} ${VAPI_LIBRARY} -# ${VOM_LIBRARY} ) # show the VPP_INCLUDE_DIRS and VPP_LIBRARIES variables only in the advanced view diff --git a/src/gnmi/CMakeLists.txt b/src/gnmi/CMakeLists.txt index e373827..6a28529 100644 --- a/src/gnmi/CMakeLists.txt +++ b/src/gnmi/CMakeLists.txt @@ -17,25 +17,19 @@ cmake_minimum_required(VERSION 2.8) project(gNMI-server) -set(CMAKE_CXX_STANDARD 17) -# set compiler option -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -set(CMAKE_C_FLAGS "-Wall -std=c++17") -set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") -set(CMAKE_C_FLAGS_DEBUG "-g -O0") -set(CMAKE_INSTALL_LIBDIR "/usr/lib") +#C++11 is required by gNMI +set(CMAKE_CXX_STANDARD 11) + +# DEPENDENCIES +############## # Cmake find modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake") -find_package(PUGIXML REQUIRED) -find_package(JSONCPP REQUIRED) -find_package(PkgConfig) - - -pkg_check_modules(SYSREPO REQUIRED libsysrepo) - -add_subdirectory(proto) +find_package(PUGIXML REQUIRED) #use FindPUGIXML.cmake +find_package(JSONCPP REQUIRED) #use FindJSONCPP.cmake +find_package(PkgConfig) #official cmake module +pkg_check_modules(SYSREPO REQUIRED libsysrepo) #PkgConfig cmake module maccro if(LIBPUGIXML_FOUND) message ("PUGIXML found") @@ -49,6 +43,23 @@ else() message (FATAL_ERROR "Cannot find LIBJSONCPP") endif() +# DEPENDENCIES & COMPILATION OF GNMI PROTO +########################################## + +# set compiler and linker flags +set(RIGOROUS_C_FLAGS "-Wlogical-op -Wold-style-cast -Wuseless-cast") +set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11 ${RIGOROUS_C_FLAGS}") +set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra -std=c++11 -DNDEBUG -O2 ${RIGOROUS_C_FLAGS}") +set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -std=c++11 -g -O0 ${RIGOROUS_C_FLAGS}") + +add_subdirectory(proto) + +# COMPILER & LINKER +################### + +# Generate a compile_commands.json with compile options +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + set(GNMI_SRC main.cpp log.cpp gnmiserver.cpp @@ -65,9 +76,13 @@ target_include_directories(gnmi_server PRIVATE ${PROTOBUF_INCLUDE_DIR} ${LIBJSONCPP_INCLUDE_DIR} ${SYSREPO_INCLUDE_DIRS}) -target_link_libraries(gnmi_server proto +# link gnmi_server executable with protobuf, grpc, pugixml, sysrepo libraries +target_link_libraries(gnmi_server gnmi ${LIBPUGIXML_LIBRARY} ${LIBJSONCPP_LIBRARY} ${SYSREPO_LIBRARIES}) +# INSTALL +######### + install(TARGETS gnmi_server RUNTIME DESTINATION bin) diff --git a/src/gnmi/gnmidata.cpp b/src/gnmi/gnmidata.cpp index 5ee53c4..ae2bb18 100644 --- a/src/gnmi/gnmidata.cpp +++ b/src/gnmi/gnmidata.cpp @@ -24,7 +24,8 @@ gNMIData::ValueType gNMIData::dataType() const void gNMIData::clean() { dtype = ValueType::UnknownVal; - value = {}; + strData = ""; + intData = 0; xpath = ""; } @@ -46,13 +47,13 @@ void gNMIData::setXPath(const std::string& str, xPathType type) void gNMIData::setValue(const std::string& str) { dtype = ValueType::dStringVal; - value = str; + strData = str; } void gNMIData::setValue(int val) { dtype = ValueType::dIntVal; - value = val; + intData = val; } std::string gNMIData::getXPath(gNMIData::xPathType type) const @@ -78,7 +79,7 @@ std::string gNMIData::getStr() const return std::to_string(getInt()); case ValueType::dStringVal: - return std::get<std::string>(value); + return strData; case ValueType::UnknownVal: default: @@ -91,7 +92,7 @@ std::string gNMIData::getStr() const int gNMIData::getInt() const { - return std::get<int>(value); + return intData; } std::string gNMIData::convertToSyrepoPath() const diff --git a/src/gnmi/gnmidata.h b/src/gnmi/gnmidata.h index e4c15d2..82c60c8 100644 --- a/src/gnmi/gnmidata.h +++ b/src/gnmi/gnmidata.h @@ -18,7 +18,6 @@ #define GNMIDATA_H #include <string> -#include <variant> /** * @todo write docs @@ -38,14 +37,7 @@ public: }; public: - /** - * Default constructor - */ gNMIData() = default; - - /** - * Destructor - */ ~gNMIData() = default; ValueType dataType() const; @@ -64,7 +56,8 @@ private: private: ValueType dtype = ValueType::UnknownVal; - std::variant<int, std::string> value; + int intData; + std::string strData; std::string xpath; }; diff --git a/src/gnmi/proto/CMakeLists.txt b/src/gnmi/proto/CMakeLists.txt index 8e70f77..e68a2c9 100644 --- a/src/gnmi/proto/CMakeLists.txt +++ b/src/gnmi/proto/CMakeLists.txt @@ -1,52 +1,41 @@ -set(protobuf_MODULE_COMPATIBLE TRUE) +# DEPENDENCIES +############## -find_package(Protobuf REQUIRED) +# Require at least Protobuf 3 for gNMI +find_package(Protobuf 3.0.0 REQUIRED) #official cmake module include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) + message(STATUS "Using protobuf ${protobuf_VERSION}") -set(_PROTOBUF_LIBPROTOBUF ${PROTOBUF_LIBRARIES}) -set(_PROTOBUF_PROTOC ${PROTOBUF_PROTOC_EXECUTABLE}) +# Require at least gRPC 1.12.0, maybe earlier can be used -find_package(gRPC CONFIG REQUIRED) -set(_GRPC_GRPCPP gRPC::grpc++) -set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>) +# Official gRPCConfig.cmake installed by gRPC only if compiled with cmake +# Use our own FindGRPC.cmake instead +find_package(GRPC 1.12.0 REQUIRED) +get_filename_component(gnmi_proto "gnmi.proto" ABSOLUTE) +get_filename_component(gnmi_ext_proto "gnmi_ext.proto" ABSOLUTE) -set(PROTOS - gnmi.proto - gnmi_ext.proto -) +# GENERATION OF SOURCE FILES +############################ -get_filename_component(hw_proto "gnmi.proto" ABSOLUTE) -get_filename_component(hw_proto_path "${hw_proto}" PATH) -get_filename_component(gnmi_ext_proto "gnmi_ext.proto" ABSOLUTE) -get_filename_component(gnmi_ext_proto_path "${gnmi_ext_proto}" PATH) - -# Generated sources -set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/gnmi.pb.cc") -set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gnmi.pb.h") -set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/gnmi.grpc.pb.cc") -set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gnmi.grpc.pb.h") -set(gnmi_ext_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/gnmi_ext.pb.cc") -set(gnmi_ext_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gnmi_ext.pb.h") -set(gnmi_ext_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/gnmi_ext.grpc.pb.cc") -set(gnmi_ext_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/gnmi_ext.grpc.pb.h") - -add_custom_command( - OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}" "${gnmi_ext_proto_srcs}" "${gnmi_ext_proto_hdrs}" "${gnmi_ext_grpc_srcs}" "${gnmi_ext_grpc_hdrs}" - COMMAND ${_PROTOBUF_PROTOC} - ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" - --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" - -I "${hw_proto_path}" "${gnmi_ext_path}" - --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" - "${hw_proto}" "${gnmi_ext_proto}" - DEPENDS "${hw_proto}" "${gnmi_ext_proto}") - -# Include generated *.pb.h files +# Official generator +protobuf_generate_cpp(gnmi_proto_srcs gnmi_proto_hdrs ${gnmi_proto}) +protobuf_generate_cpp(gnmi_ext_proto_srcs gnmi_ext_proto_hdrs ${gnmi_ext_proto}) + +# Custom generator: Official `protobuf_generate_cpp` can't use grpc plugins +PROTOBUF_GENERATE_GRPC_CPP(gnmi_grpc_srcs gnmi_grpc_hdrs ${gnmi_proto}) +PROTOBUF_GENERATE_GRPC_CPP(gnmi_ext_grpc_srcs gnmi_ext_grpc_hdrs ${gnmi_ext_proto}) + +# LINK OPTIONS FOR GNMI-SERVER +############################## + +# Include generated protobuf C++ files include_directories("${CMAKE_CURRENT_BINARY_DIR}") -add_library(proto ${hw_proto_srcs} ${hw_grpc_srcs} - ${gnmi_ext_proto_srcs} ${gnmi_ext_grpc_srcs}) -target_link_libraries(proto ${_GRPC_GRPCPP} ${_PROTOBUF_LIBPROTOBUF}) +#Create a new library named gnmi +add_library(gnmi ${gnmi_grpc_srcs} ${gnmi_ext_grpc_srcs} ${gnmi_proto_srcs} ${gnmi_ext_proto_srcs}) +#Link our new gnmi library with grpc and protobuf libraries +target_link_libraries(gnmi ${GRPCPP_LIBRARY} ${PROTOBUF_LIBRARIES}) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index e8b69e7..72a87bd 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -12,24 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. - cmake_minimum_required(VERSION 2.8) project(sysrepo-vpp-plugins) -# set compiler option -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -set(CMAKE_C_FLAGS "-Wall -std=gnu99") -set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") -set(CMAKE_C_FLAGS_DEBUG "-g -O0") -set (CMAKE_INSTALL_LIBDIR "/usr/lib") +# DEPENDENCIES +############## -# Cmake find modules +# Cmake find modules directory list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake") -find_package(VPP) -find_package(PkgConfig) -pkg_check_modules(SYSREPO REQUIRED libsysrepo) -pkg_check_modules(SCVPP REQUIRED libscvpp) +# check for required packages +find_package(VPP) #use FindVPP.cmake +find_package(PkgConfig) #official cmake module +pkg_check_modules(SYSREPO REQUIRED libsysrepo) #PkgConfig cmake module maccro +pkg_check_modules(SCVPP REQUIRED libscvpp) #PkgConfig cmake module maccro # get sysrepo plugins directory from pkgconfig if (NOT SR_PLUGINS_DIR) @@ -42,6 +38,19 @@ if (NOT SR_PLUGINS_DIR) message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SR_PLUGINS_DIR manually.") endif() +# COMPILER & LINKER +################### + +# Generate a compile_commands.json with compile options +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# set compiler and linker flags +set(RIGOROUS_C_FLAGS "-Wlogical-op -Wformat=2") +set(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99 ${RIGOROUS_C_FLAGS}") +set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -std=gnu99 -g -O0 ${RIGOROUS_C_FLAGS}") +#NDEBUG to skip assert checks +set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -std=gnu99 -DNDEBUG -O2 ${RIGOROUS_C_FLAGS}") + # plugins sources set(PLUGINS_SOURCES sc_plugins.c @@ -56,5 +65,8 @@ set(PLUGINS_SOURCES add_library(vpp-plugins SHARED ${PLUGINS_SOURCES}) target_link_libraries(vpp-plugins ${SYSREPO_LIBRARIES} ${SCVPP_LIBRARIES}) +# INSTALL +######### + # install the plugin into plugins dir install(TARGETS vpp-plugins DESTINATION ${SR_PLUGINS_DIR}) diff --git a/src/scvpp/CMakeLists.txt b/src/scvpp/CMakeLists.txt index 1256fc8..2dc42d6 100644 --- a/src/scvpp/CMakeLists.txt +++ b/src/scvpp/CMakeLists.txt @@ -16,8 +16,8 @@ cmake_minimum_required(VERSION 2.8) project(scvpp) -# add subdirectories -add_subdirectory(src) +# DEPENDENCIES +############## # enable testing if requested and possible SET(ENABLE_TESTS 1 CACHE BOOL "Enable unit tests.") @@ -32,9 +32,21 @@ if(ENABLE_TESTS) endif(CMOCKA_FOUND) endif(ENABLE_TESTS) -find_package(PkgConfig QUIET) +# COMPILER & LINKER & INSTALL +############################# + +#define CMAKE_INSTALL_LIBDIR/INCLUDEDIR +include(GNUInstallDirs) + +add_subdirectory(src) + +# MORE INSTALL +############## + +find_package(PkgConfig QUIET) #QUIET disables message if not found if(PKG_CONFIG_FOUND) # generate and install pkg-config file configure_file("libscvpp.pc.in" "libscvpp.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libscvpp.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() + diff --git a/src/scvpp/src/CMakeLists.txt b/src/scvpp/src/CMakeLists.txt index 6869a4b..71a891f 100644 --- a/src/scvpp/src/CMakeLists.txt +++ b/src/scvpp/src/CMakeLists.txt @@ -13,8 +13,6 @@ # limitations under the License. # -include(GNUInstallDirs) - # scvpp sources set(SCVPP_SOURCES sc_vpp_comm.c @@ -33,7 +31,15 @@ set(SCVPP_HEADERS sc_vpp_nat.h ) -set(CMAKE_C_FLAGS " -g -O0 -fpic -fPIC -std=gnu99 -Wl,-rpath-link=/usr/lib") +# Generate a compile_commands.json with compile options +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +#set compiler and linker flags +set(RIGOROUS_C_FLAGS "-Wlogical-op -Wformat=2") +set(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99 ${RIGOROUS_C_FLAGS}") +set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -std=gnu99 -g -O0 ${RIGOROUS_C_FLAGS}") +#NDEBUG to skip assert checks +set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -std=gnu99 -DNDEBUG -O2 ${RIGOROUS_C_FLAGS}") # libraries to link with set(LINK_LIBRARIES vlibmemoryclient vapiclient vppapiclient svm vppinfra pthread rt dl) |