forked from huawei-noah/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
134 lines (116 loc) · 4.44 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
cmake_minimum_required(VERSION 3.2)
file(GLOB BOLT_CONFIGURE_FILE $ENV{BOLT_ROOT}/bolt.cmake ${BOLT_ROOT}/bolt.cmake)
if (BOLT_CONFIGURE_FILE)
include(${BOLT_CONFIGURE_FILE})
else (BOLT_CONFIGURE_FILE)
message(FATAL_ERROR "
FATAL: can not find bolt.cmake in <BOLT_ROOT> directory,
please set shell or cmake environment variable BOLT_ROOT.
")
endif (BOLT_CONFIGURE_FILE)
project(bolt C CXX)
if (USE_MALI)
add_subdirectory(gcl/tools/kernel_lib_compile)
endif (USE_MALI)
add_subdirectory(blas-enhance)
add_subdirectory(model-tools)
add_subdirectory(tensor_computing)
add_subdirectory(image)
add_subdirectory(inference)
add_subdirectory(tools)
add_subdirectory(kits)
add_subdirectory(tests)
add_custom_target(bolt_library ALL
COMMAND ./scripts/build_light_bolt.sh ${CMAKE_BINARY_DIR} ${USE_MALI} ${USE_DEBUG} ${USE_LLVM_CLANG} ${CMAKE_CXX_COMPILER} ${CMAKE_AR} ${CMAKE_STRIP}
WORKING_DIRECTORY $ENV{BOLT_ROOT})
if (USE_MALI)
add_dependencies(inference kernelbin)
add_dependencies(inference_static kernelbin_static)
install(TARGETS kernelbin kernelbin_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES ${CMAKE_BINARY_DIR}/libOpenCL.so
DESTINATION lib)
endif (USE_MALI)
add_dependencies(tensor_computing blas-enhance)
add_dependencies(tensor_computing_static blas-enhance_static)
add_dependencies(inference tensor_computing model-tools image)
add_dependencies(inference_static tensor_computing_static model-tools_static image_static)
add_dependencies(bolt_library inference)
add_dependencies(bolt_library inference_static)
install(TARGETS blas-enhance blas-enhance_static
tensor_computing tensor_computing_static
model-tools model-tools_static
image image_static
inference inference_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if (USE_CAFFE)
add_dependencies(model-tools model-tools_caffe)
add_dependencies(model-tools_static model-tools_caffe_static)
install(TARGETS caffe2bolt
model-tools_caffe model-tools_caffe_static
RUNTIME DESTINATION tools
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(USE_CAFFE)
if (USE_ONNX)
add_dependencies(model-tools model-tools_onnx)
add_dependencies(model-tools_static model-tools_onnx_static)
install(TARGETS onnx2bolt
model-tools_onnx model-tools_onnx_static
RUNTIME DESTINATION tools
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(USE_ONNX)
if (USE_TFLITE)
add_dependencies(model-tools model-tools_tflite)
add_dependencies(model-tools_static model-tools_tflite_static)
install(TARGETS tflite2bolt
model-tools_tflite model-tools_tflite_static
RUNTIME DESTINATION tools
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(USE_TFLITE)
install(DIRECTORY model-tools/tools/tensorflow2caffe
model-tools/tools/pytorch2caffe
DESTINATION tools)
if (USE_LIBRARY_TUNING)
install(TARGETS tensor_computing_library_search
RUNTIME DESTINATION tools)
endif (USE_LIBRARY_TUNING)
if (BUILD_TEST)
if (USE_INT8)
install(TARGETS ptq_calibration
RUNTIME DESTINATION tools)
endif(USE_INT8)
install(TARGETS classification
bert
tinybert
nmt
asr_rnnt
asr_convolution_transformer
tts
vad
RUNTIME DESTINATION kits)
endif(BUILD_TEST)
install(DIRECTORY inference/exports/java
inference/exports/c
DESTINATION include)
install(FILES ${CMAKE_BINARY_DIR}/libBoltModel.so
${CMAKE_BINARY_DIR}/libbolt.a
${CMAKE_BINARY_DIR}/libbolt.so
DESTINATION lib)
execute_process(COMMAND doxygen .Doxyfile WORKING_DIRECTORY $ENV{BOLT_ROOT})
enable_testing()
find_program (BASH_PROGRAM bash)
if (BASH_PROGRAM)
set(parameters -t $ENV{BOLT_ROOT}/tests/bin -k $ENV{BOLT_ROOT}/kits/bin -p /data/local/tmp/uldra)
if (USE_MALI)
set(parameters ${parameters} -g)
endif(USE_MALI)
if (USE_DYNAMIC_LIBRARY)
set(parameters ${parameters} -l $ENV{BOLT_ROOT}/install_llvm/lib)
endif(USE_DYNAMIC_LIBRARY)
add_test (NAME quick_benchmark COMMAND $ENV{BOLT_ROOT}/quick_benchmark.sh ${parameters})
endif (BASH_PROGRAM)