From 146bb9e6d4519fd3421afd67bed0b6b8b2b413c8 Mon Sep 17 00:00:00 2001 From: "xj.lin" Date: Thu, 9 May 2019 12:05:35 +0800 Subject: [PATCH] support install prefix and default install Former-commit-id: cada287cbf3b4ef2e32e8039aa7836bb76a6adb1 --- cpp/CMakeLists.txt | 12 ++++++++++++ cpp/build.sh | 8 ++++++++ cpp/src/CMakeLists.txt | 2 ++ 3 files changed, 22 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 51b07b39ef..34fc75f792 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -72,3 +72,15 @@ if (BUILD_UNIT_TEST) endif(BUILD_UNIT_TEST) add_custom_target(Clean-All COMMAND ${CMAKE_BUILD_TOOL} clean) + +#install +install(FILES + start_server.sh + stop_server.sh + DESTINATION + scripts) +install(FILES + conf/server_config.yaml + conf/vecwise_engine_log.conf + DESTINATION + conf) diff --git a/cpp/build.sh b/cpp/build.sh index 53486a45e2..300175bfee 100755 --- a/cpp/build.sh +++ b/cpp/build.sh @@ -2,6 +2,7 @@ BUILD_TYPE="Debug" BUILD_UNITTEST="off" +INSTALL_PREFIX=$(pwd)/megasearch while getopts "p:t:uh" arg do @@ -13,12 +14,16 @@ do echo "Build and run unittest cases" ; BUILD_UNITTEST="on"; ;; + p) + INSTALL_PREFIX=$OPTARG + ;; h) # help echo " parameter: -t: build type -u: building unit test options +-p: install prefix usage: ./build.sh -t \${BUILD_TYPE} [-u] [-h] @@ -43,6 +48,7 @@ cd cmake_build CUDA_COMPILER=/usr/local/cuda/bin/nvcc CMAKE_CMD="cmake -DBUILD_UNIT_TEST=${BUILD_UNITTEST} \ +-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} \ $@ ../" @@ -56,3 +62,5 @@ if [[ ${BUILD_TYPE} != "Debug" ]]; then strip src/vecwise_server fi +make install + diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index a073f096c2..f1a23c5c0d 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -79,3 +79,5 @@ set(license_generator_src ${CMAKE_CURRENT_SOURCE_DIR}/license/LicenseGenerator.cpp) add_executable(license_generator ${license_generator_src}) + +install(TARGETS vecwise_server DESTINATION bin)