CMakeLists.txt 3.7 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)
S
Superjomn 已提交
5 6
    cc_library(cxx_api_lite_cuda SRCS cxx_api.cc DEPS ${cxx_api_lite_deps} target_wrapper_cuda)
    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 10 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
  X86_DEPS ${x86_kernels}
  )
S
Superjomn 已提交
15 16

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

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

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

C
Chunwei 已提交
27 28 29 30 31 32 33 34 35 36
lite_cc_library(cxx_api_lite SRCS cxx_api.cc DEPS ${cxx_api_lite_deps} ${ops_lite} ${host_kernels} program_lite)

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}
        )

S
superjomn 已提交
37 38 39 40
include(ExternalProject)
set(LITE_DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo" CACHE STRING
        "A path setting inference demo download directories.")

41
if(NOT LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND WITH_TESTING)
Y
Yan Chunwei 已提交
42
    lite_cc_test(test_cxx_api_lite SRCS cxx_api_test.cc
C
Chunwei 已提交
43
       DEPS cxx_api_lite mir_passes lite_api_test_helper
44
       ${ops_lite} ${host_kernels} ${x86_kernels}
45
       ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model
46
            --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
Y
Yan Chunwei 已提交
47
    add_dependencies(test_cxx_api_lite extern_lite_download_lite_naive_model_tar_gz)
48 49
endif()

C
Chunwei 已提交
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
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
       DEPS ${lite_model_test_DEPS} 
       ARGS --model_dir=${LITE_MODEL_DIR}/mobilenet_v1 SERIAL)
    add_dependencies(test_mobilenetv1_lite extern_lite_download_mobilenet_v1_tar_gz)

    lite_cc_test(test_mobilenetv2_lite SRCS mobilenetv2_test.cc
       DEPS ${lite_model_test_DEPS} 
       ARGS --model_dir=${LITE_MODEL_DIR}/mobilenet_v2 SERIAL)
    add_dependencies(test_mobilenetv2_lite extern_lite_download_mobilenet_v2_tar_gz)

    lite_cc_test(test_resnet50_lite SRCS resnet50_test.cc
       DEPS ${lite_model_test_DEPS} 
       ARGS --model_dir=${LITE_MODEL_DIR}/resnet50 SERIAL)
    add_dependencies(test_resnet50_lite extern_lite_download_resnet50_tar_gz)

    lite_cc_test(test_inceptionv4_lite SRCS inceptionv4_test.cc
       DEPS ${lite_model_test_DEPS} 
       ARGS --model_dir=${LITE_MODEL_DIR}/inception_v4 SERIAL)
    add_dependencies(test_inceptionv4_lite extern_lite_download_inception_v4_tar_gz)
Y
Yan Chunwei 已提交
73
endif()
74

C
Chunwei 已提交
75 76
# These tests needs CLI arguments, and is not supported in ARM CI.
# TODO(Superjomn) support latter.
S
update  
superjomn 已提交
77
lite_cc_test(test_light_api_lite SRCS light_api_test.cc
C
Chunwei 已提交
78 79 80
    DEPS light_api_lite program_lite mir_passes
    ARGS --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt
    SERIAL)
C
Chunwei 已提交
81

S
update  
superjomn 已提交
82 83 84 85 86
lite_cc_test(test_apis_lite SRCS apis_test.cc
  DEPS cxx_api_lite light_api_lite ${ops_lite}
  X86_DEPS ${x86_kernels} operator
  ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model
      --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL)
87

C
Chunwei 已提交
88 89 90 91
#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})