forked from MaaXYZ/MaaFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (87 loc) · 3.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
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
cmake_minimum_required(VERSION 3.24)
project(MaaFw)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_MAP_IMPORTED_CONFIG_DebWithRelDeps "DebWithRelDeps;Release;")
set(Boost_NO_WARN_NEW_VERSIONS ON)
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON) see below
option(USE_MAADEPS "use third-party libraries built by MaaDeps" ON)
option(WITH_ADB_CONTROLLER "build with adb controller" ON)
option(WITH_WIN32_CONTROLLER "build with win32 controller" ON)
option(WITH_DBG_CONTROLLER "build with debugging controller" ON)
option(WITH_THRIFT_CONTROLLER "build with thrift controller" OFF)
option(BUILD_HTTP_CLI "build http CLI exec" ON)
option(BUILD_SAMPLE "build a demo" OFF)
option(BUILD_PIPELINE_TESTING "build pipeline testing" OFF)
option(BUILD_DLOPEN_TESTING "build dlopen testing" OFF)
option(BUILD_MAAPP_TESTING "build maapp testing" OFF)
set(MAA_PUBLIC_INC ${CMAKE_SOURCE_DIR}/include)
set(MAA_PRIVATE_INC ${CMAKE_SOURCE_DIR}/source/include)
if(USE_MAADEPS)
set(MAADEPS_DIR ${PROJECT_SOURCE_DIR}/3rdparty/MaaDeps)
include(${MAADEPS_DIR}/maadeps.cmake)
endif()
# Basic compile and link configuration
include(${PROJECT_SOURCE_DIR}/cmake/config.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
# Disable unavailable options
if(NOT WITH_DBG_CONTROLLER)
message(STATUS "Dbg controller is disabled, disable BUILD_PIPELINE_TESTING")
set(BUILD_PIPELINE_TESTING OFF)
endif()
if(WITH_WIN32_CONTROLLER AND NOT WIN32)
message(STATUS "Not on Windows, disable WITH_WIN32_CONTROLLER")
set(WITH_WIN32_CONTROLLER OFF)
endif()
if(WITH_THRIFT_CONTROLLER)
include(${PROJECT_SOURCE_DIR}/cmake/thrift-gen.cmake)
endif()
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
find_package(Boost REQUIRED COMPONENTS system)
find_package(ZLIB REQUIRED)
find_package(fastdeploy_ppocr REQUIRED)
find_package(ONNXRuntime)
if(WITH_THRIFT_CONTROLLER)
find_package(Thrift CONFIG REQUIRED)
endif()
add_subdirectory(3rdparty)
add_subdirectory(source)
add_subdirectory(tools)
if(BUILD_SAMPLE)
add_subdirectory(sample/cpp)
endif()
if(BUILD_PIPELINE_TESTING)
add_subdirectory(test/pipeline)
add_subdirectory(test/TestingDataSet)
endif()
if(BUILD_DLOPEN_TESTING)
add_subdirectory(test/dlopen)
endif()
if(USE_MAADEPS)
maadeps_install(bin)
endif()
install(
EXPORT MaaFrameworkTargets
FILE MaaFramework.cmake
NAMESPACE MaaFramework::
DESTINATION "share/cmake/MaaFramework")
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "MaaFrameworkConfig.cmake"
INSTALL_DESTINATION share/cmake/MaaFramework)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MaaFrameworkConfig.cmake"
# "${CMAKE_CURRENT_BINARY_DIR}/MaaFrameworkConfigVersion.cmake"
DESTINATION share/cmake/MaaFramework)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/export_targets.cmake)
message("Load export_targets.cmake")
include(${CMAKE_CURRENT_LIST_DIR}/export_targets.cmake)
# cmake-format: off
#
# specify export compile commands for target like this
#
# if(TARGET sample_maapp_coro)
# set_target_properties(sample_maapp_coro PROPERTIES EXPORT_COMPILE_COMMANDS ON)
# endif()
#
# cmake-format: on
endif()