-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
93 lines (76 loc) · 3.92 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
# Project information.
cmake_minimum_required( VERSION 3.2.0 )
project( TuyaIoTLinkSdkEmbeddedC
VERSION 202108.03
LANGUAGES C )
# Allow the project to be organized into folders.
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# Use C90.
set( CMAKE_C_STANDARD 90 )
set( CMAKE_C_STANDARD_REQUIRED ON )
# For debug
add_compile_options( -g )
# Set Compiler
# set(CMAKE_C_COMPILER arm-linux-androideabi-gcc)
# set(CMAKE_CXX_COMPILER arm-linux-androideabi-g++)
# Do not allow in-source build.
if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} )
message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." )
endif()
# Set global path variables.
get_filename_component(__root_dir "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
set(ROOT_DIR ${__root_dir} CACHE INTERNAL "C SDK source root.")
set(EXAMPLES_DIR "${ROOT_DIR}/examples" CACHE INTERNAL "C SDK examples root.")
set(PLATFORM_DIR "${ROOT_DIR}/platform" CACHE INTERNAL "C SDK platform root.")
set(LIBRARIES_DIR "${ROOT_DIR}/libraries" CACHE INTERNAL "C SDK libraries root.")
set(LINKSDK_DIRS "${ROOT_DIR}")
set(INTERFACE_DIRS "${ROOT_DIR}/interface")
# Configure options to always show in CMake GUI.
option( BUILD_TESTS
"Set this to ON to build both demo and test executables. When OFF, only demo executables are built."
OFF )
option( BUILD_CLONE_SUBMODULES
"Set this to ON to automatically clone any required Git submodules. When OFF, submodules must be manually cloned."
ON )
option( DOWNLOAD_CERTS
"Set this to ON to automatically download certificates needed to run the demo. When OFF, certificates must be manually downloaded."
ON )
# Unity test framework does not export the correct symbols for DLLs.
set( ALLOW_SHARED_LIBRARIES ON )
include( CMakeDependentOption )
CMAKE_DEPENDENT_OPTION( BUILD_SHARED_LIBS
"Set this to ON to build all libraries as shared libraries. When OFF, libraries build as static libraries."
ON "${ALLOW_SHARED_LIBRARIES}"
OFF )
# Set output directories.
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
# Add platform.
add_subdirectory( platform )
# Add middleware.
add_subdirectory( middleware )
# Add utils.
add_subdirectory( utils )
# Add link core.
add_subdirectory( src )
# # Build the demos.
add_subdirectory( examples )
message(STATUS "------------------------------------------------------------" )
message(STATUS "[Link SDK] Configuration summary." )
message(STATUS "------------------------------------------------------------ ")
message(STATUS " System configuration:" )
message(STATUS " .. Processor type .............. = ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS " .. CMake executable ............ = ${CMAKE_COMMAND}" )
message(STATUS " .. CMake version ............... = ${CMAKE_VERSION}" )
message(STATUS " .. System name ................. = ${CMAKE_SYSTEM}" )
message(STATUS " .. C++ compiler ................ = ${CMAKE_CXX_COMPILER}" )
message(STATUS " .. C compiler .................. = ${CMAKE_C_COMPILER}" )
message(STATUS " .. C FLAGS ..................... = ${CMAKE_C_FLAGS}" )
message(STATUS " .. size(void*) ................. = ${CMAKE_SIZEOF_VOID_P}" )
message(STATUS " Project configuration:" )
message(STATUS " .. Build test programs ........ = ${WITH_TESTS}" )
message(STATUS " .. Build utility tools ........ = ${WITH_TOOLS}" )
message(STATUS " .. Disable PNG support ........ = ${WITHOUT_PNG}" )
message(STATUS " .. Installation prefix ......... = ${CMAKE_INSTALL_PREFIX}" )
message(STATUS "------------------------------------------------------------ ")