CMakeLists.txt 2.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
function(lite_cc_test_with_model_and_data TARGET)
    if(NOT WITH_TESTING)
        return()
    endif()

    set(options "")
    set(oneValueArgs MODEL DATA CONFIG ARGS)
    set(multiValueArgs "")
    cmake_parse_arguments(args "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

    set(ARGS "")
    if(DEFINED args_MODEL)
        set(ARGS "${ARGS} --model_dir=${LITE_MODEL_DIR}/${args_MODEL}")
    endif()
    if(DEFINED args_DATA)
        set(ARGS "${ARGS} --data_dir=${LITE_MODEL_DIR}/${args_DATA}")
    endif()
    if(DEFINED args_CONFIG)
        set(ARGS "${ARGS} --config_dir=${LITE_MODEL_DIR}/${args_CONFIG}")
    endif()
    if(DEFINED args_ARGS)
        set(ARGS "${ARGS} ${args_ARGS}")
    endif()
    lite_cc_test(${TARGET} SRCS ${TARGET}.cc
25 26
        DEPS ${lite_model_test_DEPS} paddle_api_full
        ARM_DEPS ${arm_kernels}
27 28 29 30 31 32 33 34 35 36 37
        X86_DEPS ${x86_kernels}
        NPU_DEPS ${npu_kernels} ${npu_bridges}
        HUAWEI_ASCEND_NPU_DEPS ${huawei_ascend_npu_kernels} ${huawei_ascend_npu_bridges}
        XPU_DEPS ${xpu_kernels} ${xpu_bridges}
        APU_DEPS ${apu_kernels} ${apu_bridges}
        RKNPU_DEPS ${rknpu_kernels} ${rknpu_bridges}
        BM_DEPS ${bm_kernels} ${bm_bridges}
        MLU_DEPS ${mlu_kernels} ${mlu_bridges}
        ARGS ${ARGS} SERIAL)
    if(DEFINED args_MODEL)
        add_dependencies(${TARGET} extern_lite_download_${args_MODEL}_tar_gz)
38
    endif()
39 40
    if(DEFINED args_DATA)
        add_dependencies(${TARGET} extern_lite_download_${args_DATA}_tar_gz)
41
    endif()
42 43
    if(DEFINED args_CONFIG)
        add_dependencies(${TARGET} extern_lite_download_${args_CONFIG}_tar_gz)
44
    endif()
45 46
endfunction()

47 48 49 50 51 52 53 54 55 56
if(LITE_WITH_ARM)
    lite_cc_test_with_model_and_data(test_transformer_with_mask_fp32_arm MODEL transformer_with_mask_fp32 ARGS)
endif()

if(LITE_WITH_NPU)
    lite_cc_test_with_model_and_data(test_mobilenetv1_fp32_huawei_kirin_npu MODEL mobilenet_v1 DATA ILSVRC2012_small)
    lite_cc_test_with_model_and_data(test_mobilenetv2_fp32_huawei_kirin_npu MODEL mobilenet_v2_relu DATA ILSVRC2012_small)
    lite_cc_test_with_model_and_data(test_resnet50_fp32_huawei_kirin_npu MODEL resnet50 DATA ILSVRC2012_small)
endif()

57
if(LITE_WITH_XPU AND NOT LITE_WITH_XTCL)
58 59 60 61 62
    lite_cc_test_with_model_and_data(test_resnet50_fp32_xpu MODEL resnet50 DATA ILSVRC2012_small)
    lite_cc_test_with_model_and_data(test_googlenet_fp32_xpu MODEL GoogLeNet DATA ILSVRC2012_small)
    lite_cc_test_with_model_and_data(test_vgg19_fp32_xpu MODEL VGG19 DATA ILSVRC2012_small)
    lite_cc_test_with_model_and_data(test_ernie_fp32_xpu MODEL ernie DATA bert_data)
    lite_cc_test_with_model_and_data(test_bert_fp32_xpu MODEL bert DATA bert_data)
63
endif()
64 65

if(LITE_WITH_RKNPU)
66
    lite_cc_test_with_model_and_data(test_mobilenetv1_int8_rockchip_npu MODEL mobilenet_v1_int8_for_rockchip_npu DATA ILSVRC2012_small)
67
endif()
H
hong19860320 已提交
68 69

if(LITE_WITH_APU)
70
    lite_cc_test_with_model_and_data(test_mobilenetv1_int8_mediatek_apu MODEL mobilenet_v1_int8_for_mediatek_apu DATA ILSVRC2012_small)
H
hong19860320 已提交
71
endif()