CMakeLists.txt 6.5 KB
Newer Older
C
Chunwei 已提交
1 2
set(cxx_api_lite_deps
  scope_lite optimizer_lite target_wrapper_host model_parser_lite program_lite)
S
superjomn 已提交
3
if(LITE_WITH_CUDA)
4
    set(cxx_api_lite_deps ${cxx_api_lite_deps} kernels_cuda)
Z
Zhen Wang 已提交
5
    lite_cc_library(cxx_api_lite_cuda SRCS cxx_api.cc DEPS ${cxx_api_lite_deps} target_wrapper_cuda)
S
Superjomn 已提交
6
    nv_test(test_cxx_api_lite_cuda SRCS cxx_api_test.cc DEPS cxx_api_lite_cuda)
S
superjomn 已提交
7
endif()
S
Superjomn 已提交
8

C
Chunwei 已提交
9
lite_cc_library(place_lite SRCS paddle_place.cc DEPS glog)
C
Chunwei 已提交
10

C
Chunwei 已提交
11 12 13 14
lite_cc_library(lite_api_test_helper SRCS lite_api_test_helper.cc
  DEPS scope_lite optimizer_lite target_wrapper_host model_parser_lite program_lite
       ${ops_lite} ${host_kernels}
  CUDA_DEPS kernels_cuda
Z
Zhen Wang 已提交
15
  X86_DEPS ${x86_kernels})
S
Superjomn 已提交
16 17

set(light_api_deps
C
Chunwei 已提交
18
    scope_lite target_wrapper_host model_parser_lite program_lite)
S
Superjomn 已提交
19 20 21 22 23

if(LITE_WITH_CUDA)
    set(light_api_deps ${light_api_deps} target_wrapper_cuda)
endif()

S
update  
superjomn 已提交
24
message(STATUS "get ops ${ops_lite}")
25 26
message(STATUS "get Host kernels ${host_kernels}")
message(STATUS "get ARM kernels ${arm_kernels}")
S
superjomn 已提交
27

C
Chunwei 已提交
28 29 30 31 32
lite_cc_library(cxx_api_lite
                SRCS cxx_api.cc
                DEPS ${cxx_api_lite_deps} ${ops_lite} ${host_kernels} program_lite
                X86_DEPS ${x86_kernels} operator
                ARM_DEPS ${arm_kernels}
Z
Zhen Wang 已提交
33
                CL_DEPS ${opencl_kenrels})
C
Chunwei 已提交
34 35 36 37 38 39 40

lite_cc_library(light_api_lite SRCS light_api.cc
        DEPS scope_lite target_wrapper_host model_parser_lite
            ${light_api_deps} ${ops_lite} ${host_kernels} program_lite
        CUDA_DEPS target_wrapper_cuda
        X86_DEPS ${x86_kernels} operator
        ARM_DEPS ${arm_kernels}
Z
Zhen Wang 已提交
41
        CL_DEPS ${opencl_kenrels})
C
Chunwei 已提交
42

S
superjomn 已提交
43 44 45 46
include(ExternalProject)
set(LITE_DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo" CACHE STRING
        "A path setting inference demo download directories.")

47
if(NOT LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND WITH_TESTING)
Y
Yan Chunwei 已提交
48
    lite_cc_test(test_cxx_api_lite SRCS cxx_api_test.cc
C
Chunwei 已提交
49
       DEPS cxx_api_lite mir_passes lite_api_test_helper
50
       ${ops_lite} ${host_kernels} ${x86_kernels}
51
       ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model
52
            --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
Y
Yan Chunwei 已提交
53
    add_dependencies(test_cxx_api_lite extern_lite_download_lite_naive_model_tar_gz)
54 55 56 57 58
    lite_cc_test(test_googlenet_lite SRCS test_googlenet_lite.cc
       DEPS cxx_api_lite mir_passes lite_api_test_helper
       ${ops_lite} ${host_kernels} ${x86_kernels}
       ARGS --model_dir=${LITE_MODEL_DIR}/googlenet)
    add_dependencies(test_googlenet_lite extern_lite_download_GoogleNet_inference_tar_gz)
59 60 61 62 63 64
endif()

if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND WITH_TESTING)
    set(lite_model_test_DEPS cxx_api_lite mir_passes ${ops_lite} ${host_kernels} ${arm_kernels})

    lite_cc_test(test_mobilenetv1_lite SRCS mobilenetv1_test.cc
C
Chunwei 已提交
65 66
       DEPS ${lite_model_test_DEPS}
       CL_DEPS ${opencl_kernels}
Z
Zhen Wang 已提交
67 68
       ARGS --cl_path=${CMAKE_SOURCE_DIR}/paddle/fluid/lite/opencl
            --model_dir=${LITE_MODEL_DIR}/mobilenet_v1 SERIAL)
69 70 71
    add_dependencies(test_mobilenetv1_lite extern_lite_download_mobilenet_v1_tar_gz)

    lite_cc_test(test_mobilenetv2_lite SRCS mobilenetv2_test.cc
C
Chunwei 已提交
72
       DEPS ${lite_model_test_DEPS}
Z
Zhen Wang 已提交
73 74 75
       CL_DEPS ${opencl_kernels}
       ARGS --cl_path=${CMAKE_SOURCE_DIR}/paddle/fluid/lite/opencl
            --model_dir=${LITE_MODEL_DIR}/mobilenet_v2 SERIAL)
S
sangoly 已提交
76
    add_dependencies(test_mobilenetv2_lite extern_lite_download_mobilenet_v2_relu_tar_gz)
77 78

    lite_cc_test(test_resnet50_lite SRCS resnet50_test.cc
C
Chunwei 已提交
79
       DEPS ${lite_model_test_DEPS}
Z
Zhen Wang 已提交
80 81 82
       CL_DEPS ${opencl_kernels}
       ARGS --cl_path=${CMAKE_SOURCE_DIR}/paddle/fluid/lite/opencl
            --model_dir=${LITE_MODEL_DIR}/resnet50 SERIAL)
83 84 85
    add_dependencies(test_resnet50_lite extern_lite_download_resnet50_tar_gz)

    lite_cc_test(test_inceptionv4_lite SRCS inceptionv4_test.cc
C
Chunwei 已提交
86
       DEPS ${lite_model_test_DEPS}
Z
Zhen Wang 已提交
87 88 89
       CL_DEPS ${opencl_kernels}
       ARGS --cl_path=${CMAKE_SOURCE_DIR}/paddle/fluid/lite/opencl
            --model_dir=${LITE_MODEL_DIR}/inception_v4 SERIAL)
S
sangoly 已提交
90
    add_dependencies(test_inceptionv4_lite extern_lite_download_inception_v4_simple_tar_gz)
Y
Yan Chunwei 已提交
91
endif()
92

C
Chunwei 已提交
93 94
# These tests needs CLI arguments, and is not supported in ARM CI.
# TODO(Superjomn) support latter.
S
update  
superjomn 已提交
95
lite_cc_test(test_light_api_lite SRCS light_api_test.cc
C
Chunwei 已提交
96
    DEPS light_api_lite program_lite mir_passes
Z
ZhenWang 已提交
97
    CL_DEPS ${opencl_kernels}
Z
Zhen Wang 已提交
98
    ARGS --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
C
Chunwei 已提交
99

S
update  
superjomn 已提交
100 101
lite_cc_test(test_apis_lite SRCS apis_test.cc
  DEPS cxx_api_lite light_api_lite ${ops_lite}
Z
ZhenWang 已提交
102
  CL_DEPS ${opencl_kernels}
S
update  
superjomn 已提交
103 104
  X86_DEPS ${x86_kernels} operator
  ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model
Z
Zhen Wang 已提交
105
       --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
106

C
Chunwei 已提交
107
lite_cc_library(paddle_api_lite SRCS paddle_api.cc DEPS op_params_lite)
C
Chunwei 已提交
108

S
superjomn 已提交
109 110 111 112 113
#-----------------------------------------------------------------------------------------------------
# The final inference library for both CxxConfig and MobileConfig.
lite_cc_library(paddle_api_full SRCS cxx_api_impl.cc DEPS cxx_api_lite paddle_api_lite light_api_lite
  ${ops_lite}
  ARM_DEPS ${arm_kernels}
Z
Zhen Wang 已提交
114
  CL_DEPS ${opencl_kernels})
S
superjomn 已提交
115
# The final inference library for just MobileConfig.
S
sangoly 已提交
116
lite_cc_library(paddle_api_light SRCS light_api_impl.cc DEPS light_api_lite paddle_api_lite mir_passes)
C
Chunwei 已提交
117

S
superjomn 已提交
118 119 120 121 122
bundle_static_library(paddle_api_full paddle_api_full_bundled bundle_full_api)
bundle_static_library(paddle_api_light paddle_api_light_bundled bundle_light_api)
#-----------------------------------------------------------------------------------------------------


C
Chunwei 已提交
123
lite_cc_test(test_paddle_api_lite SRCS paddle_api_test.cc DEPS paddle_api_full paddle_api_light
C
Chunwei 已提交
124 125
  ${ops_lite}
  ARM_DEPS ${arm_kernels}
Z
ZhenWang 已提交
126
  CL_DEPS ${opencl_kernels}
Z
Zhen Wang 已提交
127
  X86_DEPS ${x86_kernels}
C
Chunwei 已提交
128
  ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model SERIAL)
129 130 131 132

lite_cc_test(test_model_bin SRCS model_test.cc DEPS paddle_api_full paddle_api_light
  ${ops_lite}
  ARM_DEPS ${arm_kernels}
Z
Zhen Wang 已提交
133
  CL_DEPS ${opencl_kernels}
134 135
  X86_DEPS ${x86_kernels})

C
Chunwei 已提交
136
if (WITH_TESTING)
C
Chunwei 已提交
137
    add_dependencies(test_paddle_api_lite extern_lite_download_lite_naive_model_tar_gz)
C
Chunwei 已提交
138 139
endif()

140 141
if (LITE_WITH_JAVA AND LITE_WITH_ARM)
    add_subdirectory(android)
H
Huihuang Zheng 已提交
142 143
endif()

X
xingzhaolong 已提交
144 145 146 147 148 149 150 151 152 153 154 155
#lite_cc_binary(cxx_api_lite_bin SRCS cxx_api_bin.cc
    #X86_DEPS operator
    #DEPS light_api_lite model_parser_lite target_wrapper_host mir_passes
    #ARM_DEPS ${arm_kernels})

lite_cc_binary(cxx_api_lite_bin SRCS cxx_api_bin_int8.cc
    DEPS
    cxx_api_lite
    model_parser_lite
    target_wrapper_host
    mir_passes
    ${ops_lite} ${host_kernels}
Z
Zhen Wang 已提交
156 157
    ARM_DEPS ${arm_kernels}
    CL_DEPS ${opencl_kernels})
Z
ZhenWang 已提交
158
lite_cc_binary(model_optimize_tool SRCS model_optimize_tool.cc
Z
ZhenWang 已提交
159 160
    DEPS paddle_api_full
    CL_DEPS ${opencl_kernels})