CMakeLists.txt 2.3 KB
Newer Older
1 2 3 4 5
unset(analysis_deps CACHE)
set(analysis_deps # analysis_deps can be extended accross the project
        framework_proto proto_desc graph pass paddle_fluid_api executor pretty_log
        ir_pass_manager
        CACHE INTERNAL "")
6

7 8 9
add_subdirectory(ir_passes)
add_subdirectory(passes)

N
nhzlx 已提交
10 11 12
cc_library(analysis_helper SRCS helper.cc DEPS framework_proto proto_desc graph paddle_fluid_api)

cc_library(ir_pass_manager SRCS ir_pass_manager.cc DEPS graph pass ${INFER_IR_PASSES} analysis_helper)
13 14 15 16 17

cc_library(argument SRCS argument.cc DEPS scope proto_desc)
cc_library(analysis_pass SRCS analysis_pass.cc DEPS proto_desc)

cc_library(analysis SRCS
18
  analyzer.cc
19
  analysis_pass
N
nhzlx 已提交
20
  DEPS ${analysis_deps} analysis_helper
Y
Yan Chunwei 已提交
21
  ${INFER_IR_PASSES}
22
  )
23

24 25
cc_test(test_dot SRCS dot_tester.cc DEPS analysis)

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
function(inference_analysis_test_build TARGET)
  if(WITH_TESTING)
     set(options "")
     set(oneValueArgs "")
     set(multiValueArgs SRCS EXTRA_DEPS)
     cmake_parse_arguments(analysis_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
     inference_base_test_build(${TARGET}
             SRCS ${analysis_test_SRCS}
             DEPS analysis pass ${GLOB_PASS_LIB} ${analysis_test_EXTRA_DEPS})
  endif()
endfunction()

function(inference_analysis_test_run TARGET)
  if(WITH_TESTING)
     set(options "")
     set(oneValueArgs "")
     set(multiValueArgs COMMAND ARGS)
     cmake_parse_arguments(analysis_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
     inference_base_test_run(${TARGET}
	     COMMAND ${analysis_test_COMMAND}
             ARGS ${analysis_test_ARGS})
  endif()
endfunction()

50 51 52 53 54 55
function(inference_analysis_test TARGET)
  if(WITH_TESTING)
     set(options "")
     set(oneValueArgs "")
     set(multiValueArgs SRCS ARGS EXTRA_DEPS)
     cmake_parse_arguments(analysis_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
56
     inference_base_test_build(${TARGET}
57
             SRCS ${analysis_test_SRCS}
58 59 60 61
             DEPS analysis pass ${GLOB_PASS_LIB} ${analysis_test_EXTRA_DEPS})
     inference_base_test_run(${TARGET}
	     COMMAND ${TARGET}
             ARGS ${analysis_test_ARGS})
62
  endif()
Y
Yan Chunwei 已提交
63
endfunction(inference_analysis_test)
Y
Yan Chunwei 已提交
64

65 66 67 68
inference_analysis_test(test_analyzer
	SRCS analyzer_tester.cc
	EXTRA_DEPS reset_tensor_array paddle_inference_api
	ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR})