From 63b868373faae742640d8923f9928cd3b62aace2 Mon Sep 17 00:00:00 2001 From: yangrui07 Date: Wed, 31 Jul 2019 14:09:38 +0800 Subject: [PATCH] fix cube-api dependency path --- CMakeLists.txt | 2 +- cube/cube-api/CMakeLists.txt | 26 ++++++++++--------- cube/cube-api/include/{cube => }/cube_api.h | 4 +-- .../include/{cube => }/cube_api_bvar.h | 0 cube/cube-api/include/{cube => }/error.h | 0 cube/cube-api/include/{cube => }/meta.h | 0 cube/cube-api/src/cube_api.cpp | 8 +++--- cube/cube-api/src/cube_cli.cpp | 2 +- cube/cube-api/src/meta.cpp | 4 +-- 9 files changed, 24 insertions(+), 22 deletions(-) rename cube/cube-api/include/{cube => }/cube_api.h (97%) rename cube/cube-api/include/{cube => }/cube_api_bvar.h (100%) rename cube/cube-api/include/{cube => }/error.h (100%) rename cube/cube-api/include/{cube => }/meta.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2763a2c..8542345a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,12 +105,12 @@ if (NOT CLIENT_ONLY) list(APPEND EXTERNAL_LIBS opencv) endif() +add_subdirectory(cube) add_subdirectory(configure) add_subdirectory(pdcodegen) add_subdirectory(sdk-cpp) add_subdirectory(demo-client) add_subdirectory(kvdb) -add_subdirectory(cube) if (NOT CLIENT_ONLY) add_subdirectory(predictor) diff --git a/cube/cube-api/CMakeLists.txt b/cube/cube-api/CMakeLists.txt index c4c33024..28aa46dc 100644 --- a/cube/cube-api/CMakeLists.txt +++ b/cube/cube-api/CMakeLists.txt @@ -25,9 +25,6 @@ execute_process( set(CMAKE_PREFIX_PATH ${OUTPUT_PATH}) -include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/include) -include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/../) - include(FindThreads) include(FindProtobuf) protobuf_generate_cpp(PROTO_SRC PROTO_HEADER idl/cube.proto idl/control.proto) @@ -91,12 +88,11 @@ if (NOT CRYPTO_LIB) message(FATAL_ERROR "Fail to find crypto") endif() -add_executable(cube_cli src/cube_cli.cpp src/cube_api.cpp src/meta.cpp +add_executable(cube-cli src/cube_cli.cpp src/cube_api.cpp src/meta.cpp ${PROTO_SRC} ${PROTO_HEADER}) -add_library(cube_api STATIC src/cube_api.cpp src/meta.cpp +add_library(cube-api STATIC src/cube_api.cpp src/meta.cpp ${PROTO_SRC} ${PROTO_HEADER}) -install(TARGETS cube_api ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib/) set(DYNAMIC_LIB ${CMAKE_THREAD_LIBS_INIT} @@ -122,10 +118,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") "-Wl,-U,_ProfilerStop") endif() -target_link_libraries(cube_cli ${DYNAMIC_LIB} brpc -lpthread -ldl -lz) -target_link_libraries(cube_api ${DYNAMIC_LIB} brpc -lpthread -ldl -lz) +target_link_libraries(cube-cli ${DYNAMIC_LIB} brpc -lpthread -ldl -lz) +target_link_libraries(cube-api ${DYNAMIC_LIB} brpc -lpthread -ldl -lz) + +# install +install(TARGETS cube-api + ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib + ) +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include + DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/) -file(GLOB cube_api_headers "${CMAKE_CURRENT_LIST_DIR}/src/*.h") -install(FILES ${cube_api_headers} DESTINATION - ${PADDLE_SERVING_INSTALL_DIR}/include/cube_api/) -message(STATUS "CUBE_API_INSTALL_DIR: ${PADDLE_SERVING_INSTALL_DIR}/include/cube_api/") +FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h) +install(FILES ${inc} + DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/cube-api) diff --git a/cube/cube-api/include/cube/cube_api.h b/cube/cube-api/include/cube_api.h similarity index 97% rename from cube/cube-api/include/cube/cube_api.h rename to cube/cube-api/include/cube_api.h index 55838e0b..aee82f6d 100644 --- a/cube/cube-api/include/cube/cube_api.h +++ b/cube/cube-api/include/cube_api.h @@ -19,8 +19,8 @@ #include #include "brpc/server.h" -#include "cube-api/cube.pb.h" -#include "cube/meta.h" +#include "cube/cube-api/cube.pb.h" +#include "cube/cube-api/include/meta.h" namespace rec { namespace mcube { diff --git a/cube/cube-api/include/cube/cube_api_bvar.h b/cube/cube-api/include/cube_api_bvar.h similarity index 100% rename from cube/cube-api/include/cube/cube_api_bvar.h rename to cube/cube-api/include/cube_api_bvar.h diff --git a/cube/cube-api/include/cube/error.h b/cube/cube-api/include/error.h similarity index 100% rename from cube/cube-api/include/cube/error.h rename to cube/cube-api/include/error.h diff --git a/cube/cube-api/include/cube/meta.h b/cube/cube-api/include/meta.h similarity index 100% rename from cube/cube-api/include/cube/meta.h rename to cube/cube-api/include/meta.h diff --git a/cube/cube-api/src/cube_api.cpp b/cube/cube-api/src/cube_api.cpp index b5d09472..8a9cebb9 100644 --- a/cube/cube-api/src/cube_api.cpp +++ b/cube/cube-api/src/cube_api.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "cube/cube_api.h" +#include "cube/cube-api/include/cube_api.h" #include #include #include -#include "cube/cube_api_bvar.h" +#include "cube/cube-api/include/cube_api_bvar.h" -#include "cube/error.h" -#include "cube/meta.h" +#include "cube/cube-api/include/error.h" +#include "cube/cube-api/include/meta.h" namespace { static ::rec::mcube::CubeAPI* g_ins = NULL; diff --git a/cube/cube-api/src/cube_cli.cpp b/cube/cube-api/src/cube_cli.cpp index c82b9863..6df52710 100644 --- a/cube/cube-api/src/cube_cli.cpp +++ b/cube/cube-api/src/cube_cli.cpp @@ -15,7 +15,7 @@ #include #include -#include "cube/cube_api.h" +#include "cube/cube-api/include/cube_api.h" #define TIME_FLAG(flag) \ struct timeval flag; \ diff --git a/cube/cube-api/src/meta.cpp b/cube/cube-api/src/meta.cpp index 75ed5a3d..69ce43a0 100644 --- a/cube/cube-api/src/meta.cpp +++ b/cube/cube-api/src/meta.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "cube/meta.h" +#include "cube/cube-api/include/meta.h" #include #include @@ -20,7 +20,7 @@ #include #include -#include "cube-api/cube.pb.h" +#include "cube/cube-api/cube.pb.h" namespace { static ::rec::mcube::Meta* g_ins = NULL; -- GitLab