forked from DefTruth/lite.ai.toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
62 lines (51 loc) · 2.31 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
cmake_minimum_required(VERSION 3.17)
project(lite.ai)
set(CMAKE_CXX_STANDARD 11)
set(VERSION_STRING 0.0.1)
set(SOVERSION_STRING 0.0.1)
message("==================================== Lite.AI ${VERSION_STRING} =============================")
message("Project: Lite.AI")
message("Version: ${VERSION_STRING}")
message("SO Version: ${SOVERSION_STRING}")
message("Build Type: ${CMAKE_BUILD_TYPE}")
message("Root Path: ${CMAKE_SOURCE_DIR}")
message("================================================================================")
# dir for third parties.
set(LITE_AI_ROOT_DIR ${CMAKE_SOURCE_DIR})
set(THIRDPARTY_DIR ${LITE_AI_ROOT_DIR}/third_party)
# dir for built files.
set(BUILD_LITE_AI_DIR ${LITE_AI_ROOT_DIR}/build/lite.ai)
set(LIBRARY_OUTPUT_PATH ${BUILD_LITE_AI_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${BUILD_LITE_AI_DIR}/bin)
option(LITE_AI_THIRDPARTY "use third party libraries if exists" ON)
option(LITE_AI_COPY_BUILD "whether to copy the built libs to ./build directory." ON)
option(LITE_AI_BUILD_LIB "whether to build shared|static libraries." ON)
option(LITE_AI_BUILD_TEST "whether to build shared|static libraries." ON)
option(LITE_AI_BUILD_ORT_TEST "whether to build ort test examples" OFF)
option(LITE_AI_BUILD_LITE_TEST "whether to build lite test examples" ON)
# engine backend: config.h.in -> config.h
option(ENABLE_ONNXRUNTIME "whether to enable ONNXRuntime engine" ON)
option(ENABLE_MNN "whether to enable MNN engine" OFF)
option(ENABLE_NCNN "whether to enable NCNN engine" OFF)
option(ENABLE_TNN "whether to enable TNN engine" OFF)
option(BACKEND_ONNXRUNTIME "whether to set ONNXRuntime as the main backend of lite.ai" ON)
option(BACKEND_MNN "whether to set MNN as the main backend of lite.ai" OFF)
option(BACKEND_NCNN "whether to set NCNN as the main backend of lite.ai" OFF)
option(BACKEND_TNN "whether to set TNN as the main backend of lite.ai" OFF)
include_directories(${LITE_AI_ROOT_DIR})
# include custom cmake files.
include(setup_3rdparty.cmake)
include(lite.ai-cmd.cmake)
# configuration for lite.ai shared lib.
if (LITE_AI_BUILD_LIB)
include(lite.ai.cmake)
endif()
# configuration for test examples.
if (LITE_AI_BUILD_LIB AND LITE_AI_BUILD_TEST)
if (LITE_AI_BUILD_ORT_TEST)
add_subdirectory(examples/ort)
endif()
if (LITE_AI_BUILD_LITE_TEST)
add_subdirectory(examples/lite)
endif()
endif()