11cmake_minimum_required (VERSION 3.2)
2+
23file (GLOB BOLT_CONFIGURE_FILE $ENV{BOLT_ROOT} /bolt.cmake ${BOLT_ROOT} /bolt.cmake)
34if (BOLT_CONFIGURE_FILE)
45 include (${BOLT_CONFIGURE_FILE} )
6+ else (BOLT_CONFIGURE_FILE)
7+ message (FATAL_ERROR "
8+ FATAL: can not find bolt.cmake in <BOLT_ROOT> directory,
9+ please set shell or cmake environment variable BOLT_ROOT.
10+ " )
511endif (BOLT_CONFIGURE_FILE)
612
713project (bolt C CXX)
814
15+ if (USE_MALI)
16+ add_subdirectory (gcl/tools/kernel_lib_compile)
17+ endif (USE_MALI)
918add_subdirectory (blas-enhance)
1019add_subdirectory (model-tools)
1120add_subdirectory (tensor_computing)
1221add_subdirectory (image)
13- add_subdirectory (engine)
22+ add_subdirectory (inference)
23+ add_subdirectory (tests)
24+ add_custom_target (bolt_library ALL
25+ COMMAND ./scripts/build_light_bolt.sh ${CMAKE_BINARY_DIR}
26+ WORKING_DIRECTORY $ENV{BOLT_ROOT} )
1427
28+ if (USE_MALI)
29+ add_dependencies (inference kernelbin)
30+ add_dependencies (inference_static kernelbin_static)
31+ install (TARGETS kernelbin kernelbin_static
32+ LIBRARY DESTINATION lib
33+ ARCHIVE DESTINATION lib)
34+ install (FILES ${CMAKE_BINARY_DIR} /libOpenCL.so
35+ DESTINATION lib)
36+ endif (USE_MALI)
1537add_dependencies (tensor_computing blas-enhance)
1638add_dependencies (tensor_computing_static blas-enhance_static)
17- add_dependencies (model-tools model-tools_caffe)
18- add_dependencies (model-tools_static model-tools_caffe_static)
19- add_dependencies (engine tensor_computing model-tools image)
20- add_dependencies (engine_static tensor_computing_static model-tools_static image_static)
39+ add_dependencies (inference tensor_computing model-tools image)
40+ add_dependencies (inference_static tensor_computing_static model-tools_static image_static)
41+ add_dependencies (bolt_library inference_static)
2142
22- install (TARGETS blas-enhance blas-enhance_static tensor_computing tensor_computing_static
23- model-tools model-tools_static model-tools_caffe model-tools_caffe_static
43+ install (TARGETS blas-enhance blas-enhance_static
44+ tensor_computing tensor_computing_static
45+ model-tools model-tools_static
2446 image image_static
25- engine engine_static
26- caffe2bolt
27- onnx2bolt
28- classification
29- bert
30- tinybert
31- RUNTIME DESTINATION bin
47+ inference inference_static
3248 LIBRARY DESTINATION lib
33- ARCHIVE DESTINATION lib)
49+ ARCHIVE DESTINATION lib)
50+
51+ if (USE_CAFFE)
52+ add_dependencies (model-tools model-tools_caffe)
53+ add_dependencies (model-tools_static model-tools_caffe_static)
54+ install (TARGETS caffe2bolt
55+ model-tools_caffe model-tools_caffe_static
56+ RUNTIME DESTINATION tools
57+ LIBRARY DESTINATION lib
58+ ARCHIVE DESTINATION lib)
59+ endif (USE_CAFFE)
60+
61+ if (USE_ONNX)
62+ add_dependencies (model-tools model-tools_onnx)
63+ add_dependencies (model-tools_static model-tools_onnx_static)
64+ install (TARGETS onnx2bolt
65+ model-tools_onnx model-tools_onnx_static
66+ RUNTIME DESTINATION tools
67+ LIBRARY DESTINATION lib
68+ ARCHIVE DESTINATION lib)
69+ endif (USE_ONNX)
70+
71+ if (USE_TFLITE)
72+ add_dependencies (model-tools model-tools_tflite)
73+ add_dependencies (model-tools_static model-tools_tflite_static)
74+ install (TARGETS tflite2bolt
75+ model-tools_tflite model-tools_tflite_static
76+ RUNTIME DESTINATION tools
77+ LIBRARY DESTINATION lib
78+ ARCHIVE DESTINATION lib)
79+ endif (USE_TFLITE)
80+
81+ install (DIRECTORY model-tools/tools/tensorflow2caffe
82+ model-tools/tools/pytorch2caffe
83+ DESTINATION tools)
84+
85+ install (TARGETS tensor_computing_library_search
86+ RUNTIME DESTINATION tools)
87+
88+ if (BUILD_TEST)
89+ install (TARGETS classification
90+ bert
91+ tinybert
92+ nmt
93+ RUNTIME DESTINATION bin)
94+ endif (BUILD_TEST)
95+
96+ install (DIRECTORY inference/exports/java
97+ inference/exports/c
98+ DESTINATION include )
99+
100+ install (FILES ${CMAKE_BINARY_DIR} /libBoltModel.so
101+ DESTINATION lib)
102+
103+ execute_process (COMMAND doxygen .Doxyfile WORKING_DIRECTORY $ENV{BOLT_ROOT} )
104+
105+ enable_testing ()
106+
107+ find_program (BASH_PROGRAM bash)
108+
109+ if (BASH_PROGRAM)
110+ set (parameters -b $ENV{BOLT_ROOT} /tests/bin -p /data/local/tmp/uldra)
111+ if (USE_MALI)
112+ set (parameters ${parameters} -g)
113+ endif (USE_MALI)
114+
115+ if (USE_DYNAMIC_LIBRARY)
116+ set (parameters ${parameters} -l $ENV{BOLT_ROOT} /install_llvm/lib)
117+ endif (USE_DYNAMIC_LIBRARY)
118+ add_test (NAME quick_benchmark COMMAND $ENV{BOLT_ROOT} /quick_benchmark.sh ${parameters} )
119+ endif (BASH_PROGRAM)
0 commit comments