-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
92 lines (73 loc) · 2.82 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
# CMake Version
CMAKE_MINIMUM_REQUIRED (VERSION 3.2.0)
# Project Name
PROJECT(LUNA_SW_PLATFORM)
#
# Configuration
#
# SET(CMAKE_VERBOSE_MAKEFILE ON)
#
option(GIT_SUBMODULE "Check submodules during build" OFF)
option(USE_MBEDTLS "Use Mbedtls library" OFF)
option(USE_CURL "Use Curl library" OFF)
if (GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
# cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.arm.cmake
#
# To build with a release mode, cmake -DCMAKE_BUILD_TYPE=Release ..
#
if(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_DEBUG_POSTFIX "d")
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting Luna build type - ${CMAKE_BUILD_TYPE}")
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set Build Directories
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(LUNA_SW_PLATFORM ${CMAKE_CURRENT_SOURCE_DIR})
#
# You can refer to following the SET command when you need to set the environment value in dependency Libraries.
#
# Check OS and Processor Information
#
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
ADD_DEFINITIONS(-DOSX)
endif()
if (USE_CURL)
ADD_DEFINITIONS(-LUNA_USE_CURL)
endif()
ADD_DEFINITIONS(-Wall -DCALIB_CFG_OS="${CMAKE_SYSTEM_NAME}" -DCALIB_CFG_CPU="${CMAKE_SYSTEM_PROCESSOR}")
if (USE_MBEDTLS)
option(ENABLE_TESTING "Build mbed TLS tests." OFF)
option(ENABLE_PROGRAMS "Build mbed TLS programs." OFF)
ADD_SUBDIRECTORY(dependency/mbedtls)
endif()
#
# Make Libraries
#
ADD_SUBDIRECTORY(src/Library/ccCore)
ADD_SUBDIRECTORY(src/Library/ccNetwork)
ADD_SUBDIRECTORY(src/Library/ccWebServer)
ADD_SUBDIRECTORY(src/FossLibrary/ccJsonParser)
ADD_SUBDIRECTORY(src/FossLibrary/ccWebsocketClient)
if (USE_CURL EQUAL ON)
ADD_SUBDIRECTORY(src/FossLibrary/ccRestClient)
else()
message(STATUS "=============================================================================================")
message(STATUS "The ccRestClient is excluded in building libraries because Luna doesn't support CURL library.")
message(STATUS "=============================================================================================")
endif()
ADD_SUBDIRECTORY(src/FossLibrary/ccMqttClient)
ADD_SUBDIRECTORY(src/FossLibrary/poco)
ADD_SUBDIRECTORY(src/ThirdPartyLibrary/ccMongooseWebServer)
ADD_SUBDIRECTORY(src/ThirdPartyLibrary/ccPocoWebServer)