From 69da1a8a429c57edeac94e48e38e0758556ca3bb Mon Sep 17 00:00:00 2001 From: "drenfong.wang" Date: Thu, 14 Feb 2019 07:19:19 +0000 Subject: fix rpm build and deb build Change-Id: I6a48e0aaf6ab1fdccac30ccca7b8ac85513da2e9 Signed-off-by: drenfong.wang --- Makefile | 10 ++++++++-- src/plugins/CMakeLists.txt | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d5cc51a..e7f7172 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,10 @@ endif ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID)) PKG=deb +cmake=cmake else ifeq ($(filter rhel centos fedora opensuse opensuse-leap opensuse-tumbleweed,$(OS_ID)),$(OS_ID)) PKG=rpm +cmake=cmake3 endif # +libganglia1-dev if building the gmond plugin @@ -41,7 +43,7 @@ DEB_DEPENDS += bison flex libpcre3-dev libev-dev libavl-dev libprotobuf-c-dev pr DEB_DEPENDS += cmake ninja-build python-pkgconfig python-dev libssl-dev indent wget RPM_DEPENDS = curl autoconf automake ccache bison flex pcre-devel libev-devel protobuf-c-devel protobuf-c-compiler libcmocka-devel -RPM_DEPENDS += cmake ninja-build python-pkgconfig python-devel openssl-devel graphviz wget gcc gcc-c++ indent git +RPM_DEPENDS += cmake ninja-build python-pkgconfig python-devel openssl-devel graphviz wget gcc gcc-c++ indent git cmake3 ifeq ($(findstring y,$(UNATTENDED)),y) CONFIRM=-y @@ -170,6 +172,8 @@ install-dep-extra: &&cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ..\ &&make&&make install && sudo ldconfig\ &&cd ../../../ && mv v0.7-r1.tar.gz Netopeer2-0.7-r1.tar.gz\ + \ + &&cd ../ && rm -rf $(BR)/downloads install-vpp: @echo "please install vpp as vpp's guide from source if failed" @@ -196,10 +200,12 @@ build-plugins: @mkdir -p $(BR)/build-plugins/;cd $(BR)/build-plugins/;cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/src/plugins/;make install; build-package: - @mkdir -p $(BR)/build-package/;cd $(BR)/build-package/;cmake $(WS_ROOT)/src/;make package; + @mkdir -p $(BR)/build-package/;cd $(BR)/build-package/;$(cmake) $(WS_ROOT)/src/;make package; + clean: @cd $(BR)/build-scvpp && make clean; @cd $(BR)/build-plugins && make clean; + @cd $(BR)/build-package && make clean; distclean: @rm -rf $(BR)/build-scvpp diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 08003f7..ae7bb68 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ 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) +#pkg_check_modules(SCVPP REQUIRED libscvpp) # get sysrepo plugins directory from pkgconfig if (NOT SR_PLUGINS_DIR) @@ -46,9 +46,12 @@ set(BAPI_SRC ./bapi/bapi.c ./bapi/bapi_interface.c ./bapi/bapi_ip.c - ) +) + add_library(bapi SHARED ${BAPI_SRC}) target_include_directories(bapi PUBLIC ${VPP_INCLUDE_DIRS} ./bapi) +ADD_DEPENDENCIES(bapi scvpp) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/../scvpp/src) target_link_libraries(bapi ${VPP_LIBRARIES}) # plugins sources @@ -61,9 +64,10 @@ set(PLUGINS_SOURCES openconfig/sys_util.c ) - # build the source code into shared library add_library(vpp-plugins SHARED ${PLUGINS_SOURCES}) +ADD_DEPENDENCIES(vpp-plugins scvpp) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/../scvpp/src) target_link_libraries(vpp-plugins ${SYSREPO_LIBRARIES} ${SCVPP_LIBRARIES} bapi) # install the plugin into plugins dir -- cgit 1.2.3-korg