CMakeLists.txt 3.6 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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

cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(PADDLE_SERVING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(PADDLE_SERVING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
19
SET(PADDLE_SERVING_INSTALL_DIR ${CMAKE_BINARY_DIR}/output)
X
xulongteng 已提交
20
SET(CMAKE_INSTALL_RPATH "\$ORIGIN" "${CMAKE_INSTALL_RPATH}")
W
wangguibao 已提交
21 22 23 24 25 26 27 28 29

include(system)

project(paddle-serving CXX C)
message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
        "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
        "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")

30
    
W
wangguibao 已提交
31 32
find_package(Git REQUIRED)
find_package(Threads REQUIRED)
W
wangguibao 已提交
33
find_package(CUDA QUIET)
W
wangguibao 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

include(simd)

# CMAKE_BUILD_TYPE
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
      "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
      FORCE)
endif()

set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
  "A path setting third party libraries download & build directories.")

set(THIRD_PARTY_BUILD_TYPE Release)

W
wangguibao 已提交
49 50
option(WITH_AVX     "Compile Paddle Serving with AVX intrinsics"    ${AVX_FOUND})
option(WITH_MKL     "Compile Paddle Serving with MKL support."      ${AVX_FOUND})
51
option(WITH_GPU     "Compile Paddle Serving with NVIDIA GPU"        ${CUDA_FOUND})
W
wangguibao 已提交
52
option(CLIENT_ONLY  "Compile client libraries and demos only"       FALSE)
W
wangguibao 已提交
53 54 55 56 57 58 59 60 61 62 63

set(WITH_MKLML ${WITH_MKL})
if (NOT DEFINED WITH_MKLDNN)
    if (WITH_MKL AND AVX2_FOUND)
        set(WITH_MKLDNN ON)
    else()
        message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN")
        set(WITH_MKLDNN OFF)
    endif()
endif()

D
dangyifei 已提交
64
include(external/jsoncpp)
65
include(external/leveldb)
66
include(external/rocksdb)
W
wangguibao 已提交
67
include(external/zlib)
68 69 70
include(external/boost)
include(external/protobuf)
include(external/brpc)
W
wangguibao 已提交
71 72 73
include(external/gflags)
include(external/glog)
include(external/snappy)
74
include(external/gtest)
W
wangguibao 已提交
75
include(generic)
76
include(flags)
W
wangguibao 已提交
77 78
include(external/python)
include(external/pybind11)
79 80

if (NOT CLIENT_ONLY)
W
wangguibao 已提交
81
include(external/cudnn)
W
wangguibao 已提交
82
include(paddlepaddle)
W
sdk-cpp  
wangguibao 已提交
83
include(external/opencv)
84
endif()
W
wangguibao 已提交
85

W
wangguibao 已提交
86 87
include_directories(${PADDLE_SERVING_SOURCE_DIR})
include_directories(${PADDLE_SERVING_BINARY_DIR})
W
wangguibao 已提交
88 89

set(EXTERNAL_LIBS
D
dangyifei 已提交
90
    jsoncpp
W
wangguibao 已提交
91
    gflags
92
    rocksdb
W
wangguibao 已提交
93 94 95
    glog
    protobuf
    paddlepaddle
W
wangguibao 已提交
96
    brpc
W
wangguibao 已提交
97 98 99 100 101 102 103 104 105 106 107
)

if(WITH_MKLML)
    list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
endif()


if(WITH_MKLDNN)
    list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
endif()

108 109 110 111 112
if (NOT CLIENT_ONLY)
    list(APPEND EXTERNAL_LIBS paddlepaddle)
    list(APPEND EXTERNAL_LIBS opencv)
endif()

Y
yangrui07 已提交
113
add_subdirectory(cube)
114
add_subdirectory(configure)
115
add_subdirectory(pdcodegen)
116
add_subdirectory(sdk-cpp)
W
wangguibao 已提交
117
add_subdirectory(demo-client)
118
add_subdirectory(kvdb)
119 120

if (NOT CLIENT_ONLY)
W
wangguibao 已提交
121
add_subdirectory(predictor)
W
wangguibao 已提交
122
add_subdirectory(inferencer-fluid-cpu)
W
wangguibao 已提交
123 124 125
if (WITH_GPU)
add_subdirectory(inferencer-fluid-gpu)
endif()
W
wangguibao 已提交
126
add_subdirectory(demo-serving)
127
endif()
W
wangguibao 已提交
128 129 130

# Paddle Serving Solutions
add_subdirectory(elastic-ctr)