From 66ae4ef3c5b8f2e70b19f8a9fb7ec4669e71e9d9 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Fri, 15 Feb 2019 15:22:48 +0800 Subject: [PATCH] compile pdserving_exe --- bsl/CMakeLists.txt | 12 +++++++++--- configure/constraint/ConstraintFunction.h | 4 ++-- predictor/CMakeLists.txt | 21 ++++++++++++++++++++- predictor/common/constant.cpp | 1 + predictor/common/constant.h | 2 +- spreg/CMakeLists.txt | 3 ++- 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/bsl/CMakeLists.txt b/bsl/CMakeLists.txt index 3d048dcf..98cd461b 100644 --- a/bsl/CMakeLists.txt +++ b/bsl/CMakeLists.txt @@ -1,5 +1,5 @@ -add_custom_target(copy_bsl_headers) -add_custom_command(TARGET copy_bsl_headers +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/ && cp ${CMAKE_CURRENT_LIST_DIR}/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/utils && cp ${CMAKE_CURRENT_LIST_DIR}/utils/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/utils COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/alloc && cp ${CMAKE_CURRENT_LIST_DIR}/alloc/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/alloc @@ -13,6 +13,9 @@ add_custom_command(TARGET copy_bsl_headers COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/check_cast/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/bsl COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/ResourcePool/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/bsl/ ) +add_custom_target(copy_bsl_headers + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) add_subdirectory(utils) add_subdirectory(alloc) @@ -26,6 +29,9 @@ add_subdirectory(ResourcePool) add_subdirectory(var/interface) add_subdirectory(var/utils) add_subdirectory(var/implement) -add_custom_target(bsl) +add_library(bsl) add_dependencies(bsl utils alloc archive containers pool buffer exception check_cast ResourcePool interface var_utils implement) +target_link_libraries(bsl + utils archive pool buffer exception check_cast + ResourcePool var_utils implement) diff --git a/configure/constraint/ConstraintFunction.h b/configure/constraint/ConstraintFunction.h index 7357524e..17067f25 100644 --- a/configure/constraint/ConstraintFunction.h +++ b/configure/constraint/ConstraintFunction.h @@ -55,7 +55,7 @@ namespace comcfg{ virtual int check(const confIDL::cons_func_t&, const confIDL::var_t &, ConfigGroup*, ConfigUnit*); void setLevel(int lv); int getLevel(); - virtual ~ConstraintFunction(); + virtual ~ConstraintFunction() {} }; typedef bsl::hashmap CFMAP_T; @@ -238,7 +238,7 @@ namespace comcfg{ _cf = cf; } WrapFunction(){} - virtual ~WrapFunction(); + virtual ~WrapFunction() {} protected: CF_T _cf; }; diff --git a/predictor/CMakeLists.txt b/predictor/CMakeLists.txt index e017c015..400546c2 100644 --- a/predictor/CMakeLists.txt +++ b/predictor/CMakeLists.txt @@ -16,7 +16,8 @@ set_source_files_properties( ${pdserving_srcs} PROPERTIES COMPILE_FLAGS "-Wno-strict-aliasing -Wno-unused-variable -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor") -add_dependencies(pdserving protobuf boost brpc pdcodegen) +add_dependencies(pdserving protobuf boost brpc leveldb bsl pdcodegen configure + ullib spreg mempool) target_include_directories(pdserving PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ @@ -28,6 +29,24 @@ target_include_directories(pdserving PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../bsl/include) target_link_libraries(pdserving -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) +add_executable(pdserving_exe ${pdserving_srcs}) +set_source_files_properties( + ${pdserving_srcs} + PROPERTIES + COMPILE_FLAGS "-Wno-strict-aliasing -Wno-unused-variable -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor") +add_dependencies(pdserving_exe protobuf boost brpc leveldb bsl pdcodegen + configure ullib spreg mempool) + +target_include_directories(pdserving_exe PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/ + ${CMAKE_CURRENT_BINARY_DIR}/ + ${CMAKE_CURRENT_LIST_DIR}/../configure + ${CMAKE_CURRENT_LIST_DIR}/../mempool + ${CMAKE_CURRENT_LIST_DIR}/../spreg + ${CMAKE_CURRENT_LIST_DIR}/../ullib/include + ${CMAKE_CURRENT_BINARY_DIR}/../bsl/include) +target_link_libraries(pdserving_exe brpc protobuf leveldb bsl configure ullib + spreg mempool -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) add_library(pdclient ${pdclient_srcs}) set_source_files_properties( diff --git a/predictor/common/constant.cpp b/predictor/common/constant.cpp index 310b9bdb..e7f41ca8 100644 --- a/predictor/common/constant.cpp +++ b/predictor/common/constant.cpp @@ -28,6 +28,7 @@ DEFINE_int32(reload_interval_s, 10, ""); DEFINE_bool(enable_model_toolkit, false, "enable model toolkit"); DEFINE_string(enable_protocol_list, "baidu_std nshead", "set protocol list"); +const char* START_OP_NAME = "startup_op"; } // predictor } // paddle_serving } // baidu diff --git a/predictor/common/constant.h b/predictor/common/constant.h index e64353e5..49db8b93 100644 --- a/predictor/common/constant.h +++ b/predictor/common/constant.h @@ -30,7 +30,7 @@ DECLARE_bool(enable_model_toolkit); DECLARE_string(enable_protocol_list); // STATIC Variables -const char* START_OP_NAME = "startup_op"; +extern const char* START_OP_NAME; // ERRORCODE enum { diff --git a/spreg/CMakeLists.txt b/spreg/CMakeLists.txt index 3b4b837d..d466b6cf 100644 --- a/spreg/CMakeLists.txt +++ b/spreg/CMakeLists.txt @@ -1,4 +1,5 @@ FILE(GLOB spreg_srcs ${CMAKE_CURRENT_LIST_DIR}/*.cpp) add_library(spreg ${spreg_srcs}) +add_dependencies(spreg pcre) +target_link_libraries(spreg pcre) include_directories(${CMAKE_CURRENT_LIST_DIR}/include) -message(STATUS ${CMAKE_CURRENT_LIST_DIR}/include) -- GitLab