CMakeLists.txt
6.74 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
set(LIB_TARGET_NAME manomotion)
project(${LIB_TARGET_NAME})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
set(CMAKE_VERBOSE_MAKEFILE on)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "description")
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWCASE)
message("Building from " ${CMAKE_SOURCE_DIR})
option(_UNITY_BUILD_ "description" OFF)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/libs CACHE PATH "description" FORCE)
##ios toolchain
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/ios-cmake/toolchain/iOS.cmake" CACHE STRING "description")
add_definitions(-D__IOS__ -D_IS_IOS_ -DTARGET_PLATFORM_IOS)
add_definitions(-DUSING_SERIAL -DOPENCV -DGPU -DSKM_CURL_EMBED_CACERTS)
add_definitions(-DUSING_SERIAL -DOPENCV -DGPU)
message("Settings other linker flags" )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ldl -lz -lm \
-Wl,--allow-multiple-definition\
-Wl,--exclude-libs=ALL\
-Wl,-z,norelro \
-Wl,-z,lazy")
#this setting is for other C++ flags in the xcode
message("Setting other c++ flags")
set(CMAKE_CFLAGS "-O3 -fvisibility=hidden -fdata-sections -ffunction-sections -fPIC -lc++" CACHE STRING "description")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -frtti -fexceptions -fvisibility=hidden -fdata-sections -ffunction-sections -fPIC -lc++")
message("Checking the platform from ")
#_UNITY_BUILD_ is set to OFF above
if( _UNITY_BUILD_ )
set(PLATFORM_TYPE unity)
else()
set(PLATFORM_TYPE native)
endif()
message("Platform is " ${PLATFORM_TYPE})
message("Adding headers into the header paths")
#these are for add headers into the project
include_directories(../common)
include_directories(../common/core)
include_directories(../common/core/algorithms)
include_directories(../common/core/async)
include_directories(../common/core/http)
include_directories(../common/core/io)
include_directories(../common/core/manager)
include_directories(../common/core/security)
include_directories(../common/core/manager_v2) # ManoMotionManager
include_directories(../common/core/memstat) # memory usage and leak count
include_directories(../common/modules/cpp-taskflow) # Threaded task scheduling
include_directories(../common/modules/jwt-cpp-0.3.1/include) # Threaded task scheduling
include_directories(../common/logging)
include_directories(../common/temp)
include_directories(../common/modules/security)
include_directories(../common/modules/skm)
include_directories(../common/modules/security)
include_directories(../common/modules/skm/src)
include_directories(../common/modules/deep-learning)
include_directories(../common/modules/ml3d)
include_directories(../common/modules/ml3d/pmd/include/royaleCAPI)
include_directories(../common/modules/)
include_directories(../common/core/utils)
include_directories(./entry-point)
include_directories(./3rdparty)
include_directories(./3rdparty/include)
include_directories(./3rdparty/curl)
include_directories(./3rdparty/openssl)
include_directories(./3rdparty/json)
include_directories(./3rdparty/ArduinoJson)
include_directories(../common/modules/easy_profiler/easy_profiler_core/include)
include_directories(./libcurl-ios-dist/include)
include_directories(./libcurl-ios-dist/include/curl)
message("Adding .cpp files into the project")
#adding all the .cpp file from core, manager, security, temp
file(GLOB LIB_CORE "../common/core/*.cpp"
"../common/core/manager/*.cpp"
"../common/core/security/*.cpp"
"../common/modules/security/*.cpp"
"../common/logging/*.cpp"
"../common/security/*.cpp"
"../common/core/manager_v2/*.cpp" # added by bernard
"../common/temp/*.cpp"
"3rdparty/*.cpp"
)
message("Adding files of algorithm")
file(GLOB LIB_CORE_ALGO
"../common/core/algorithms/*.cpp"
)
message("Adding files of async")
file(GLOB LIB_CORE_ASYNC
"../common/core/async/*.cpp"
)
message("Adding files of http")
file(GLOB LIB_CORE_HTTP
"../common/core/http/*.cpp"
)
message("Adding files of io")
file(GLOB LIB_CORE_IO
"../common/core/io/*.cpp"
)
message("Adding files of utils")
file(GLOB LIB_CORE_UTILS
"../common/core/utils/*.cpp"
)
message("Adding files of ml3d")
#Module ML3D
file(GLOB LIB_ML3D
"../common/modules/ml3d/*.cpp"
)
message("Adding files of Entry point")
#Module EntryPoint.
file(GLOB ENTRY_POINT
"entry-point/*.cpp"
"entry-point/${PLATFORM_TYPE}/*.cpp"
)
message("Grouping the groups of source codes")
#Grouping the gorups of source codes
SET(LIB_CORE_SOURCES ${LIB_CORE_ALGO} ${LIB_CORE_ASYNC} ${LIB_CORE_HTTP} ${LIB_CORE_IO} ${LIB_CORE_UTILS})
SET(LIB_MODULE_SOURCES ${LIB_ML3D} )#${LIB_SEGMENTATION} ${LIB_CORE_UTILS}) ${LIB_SECURITY} ${LIB_SKM_SOURCE}
file(GLOB LIB_SOURCES ${LIB_CORE} ${LIB_CORE_SOURCES} ${LIB_MODULE_SOURCES} )
#this is for adding manotion folder into the project
add_library(${LIB_TARGET_NAME} SHARED ${ENTRY_POINT} ${LIB_SOURCES})
file (STRINGS "../common/core/build_data.h" BUILD_INFO_FILE)
#this is for renaming the folders
source_group("core" FILES ${LIB_CORE})
source_group("core\\algorithms" FILES ${LIB_CORE_ALGO})
source_group("core\\async" FILES ${LIB_CORE_ASYNC})
source_group("core\\http" FILES ${LIB_CORE_HTTP})
source_group("core\\io" FILES ${LIB_CORE_IO})
source_group("core\\utils" FILES ${LIB_CORE_UTILS})
source_group("module\\skm" FILES ${LIB_SKM_SOURCE})
source_group("module\\security" FILES ${LIB_SECURITY})
source_group("module\\2Dto3D" FILES ${LIB_ML3D})
#CURL
add_library(lib_curl STATIC IMPORTED)
#set_target_properties(lib_curl PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libs/libcurl.a)
set_target_properties(lib_curl PROPERTIES IMPORTED_LOCATION ${LIB_TARGET_NAME}/libcurl-ios-dist/lib/libcurl.a)
TARGET_LINK_LIBRARIES(${LIB_TARGET_NAME} lib_curl)
macro(AddExternalFramework fwname appname libpath)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${libpath}
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found: ${FRAMEWORK_${fwname}}")
else()
TARGET_LINK_LIBRARIES(${appname} ${FRAMEWORK_${fwname}})
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
endif()
endmacro(AddExternalFramework)
set (libpath ${CMAKE_SOURCE_DIR}/)
AddExternalFramework(opencv2 ${LIB_TARGET_NAME} ${libpath})