-
Notifications
You must be signed in to change notification settings - Fork 159
/
CMakeLists.txt
97 lines (90 loc) · 2.98 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
cmake_minimum_required(VERSION 3.2)
include(common/cmakes/cpuinfo.cmake)
include(common/cmakes/bolt.cmake)
project(cheetah C CXX)
set_policy()
set(BOLT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOLT_ROOT}/common/cmakes")
if (USE_CAFFE OR USE_ONNX OR USE_FLOW)
find_package(Protobuf)
endif()
if (USE_TFLITE)
find_package(TFLite)
endif (USE_TFLITE)
if (USE_TENSORFLOW)
find_package(jsoncpp)
endif (USE_TENSORFLOW)
if (USE_GPU)
find_package(Gcl)
endif(USE_GPU)
if (NOT ANDROID)
find_package(JNI)
if (JNI_FOUND)
set(USE_API_JAVA ON)
endif(JNI_FOUND)
endif ()
if (USE_SECURE_C)
find_package(SecureC)
endif ()
if (BUILD_EXAMPLE)
find_package(jpeg)
if (EXISTS ${OpenCV_CMAKE_PATH})
include(${OpenCV_CMAKE_PATH})
endif()
endif ()
add_subdirectory(common)
if (USE_CAFFE OR USE_ONNX OR USE_TFLITE OR USE_TENSORFLOW OR USE_MINDSPORE)
add_subdirectory(model_tools)
endif()
add_subdirectory(compute)
add_subdirectory(inference)
if (USE_TRAINING)
set(TRAINING_BUILD_C_API ON)
set(TRAINING_BUILD_DEMO ON)
add_subdirectory(training)
add_dependencies(Raul blas_enhance uni)
add_dependencies(Raul blas_enhance_static uni_static)
endif (USE_TRAINING)
#find_program (DOXYGEN_PROGRAM doxygen)
#if (DOXYGEN_PROGRAM)
# execute_process(COMMAND doxygen .Doxyfile WORKING_DIRECTORY ${BOLT_ROOT})
#else ()
# message(WARNING "Can not find doxygen tools to generate code documents in docs/API/html/index.html!\
# If you dont't want to use these documents, you can skip this warning message.")
#endif ()
enable_testing()
find_program (BASH_PROGRAM bash)
if (BASH_PROGRAM AND USE_GENERAL)
set(parameters --host_dir=${CMAKE_INSTALL_PREFIX})
if (ANDROID)
set(parameters ${parameters} -d android)
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_SYSTEM_PROCESSOR}" AND "${CMAKE_HOST_SYSTEM}" MATCHES "${CMAKE_SYSTEM_NAME}*")
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "armv7")
set(parameters ${parameters} -d host)
elseif (USE_X86)
set(x86_test ${cpuinfo_avx2})
if (USE_INT8)
set(x86_test ${cpuinfo_avx512})
endif ()
if (USE_AVX512_VNNI)
set(x86_test ${cpuinfo_avx512_vnni})
endif()
if (x86_test)
set(parameters ${parameters} -d host)
else ()
set(parameters ${parameters} -d unknown)
endif ()
else ()
set(parameters ${parameters} -d unknown)
endif()
else()
set(parameters ${parameters} -d unknown)
endif()
if (USE_GPU)
set(parameters ${parameters} -g)
endif(USE_GPU)
if (USE_DYNAMIC_LIBRARY)
set(parameters ${parameters} --shared)
endif(USE_DYNAMIC_LIBRARY)
add_test (NAME quick_benchmark COMMAND bash ${BOLT_ROOT}/scripts/quick_benchmark.sh ${parameters})
endif (BASH_PROGRAM AND USE_GENERAL)