-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (95 loc) · 5.19 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
# ────────────────────────────────────────────────────────────
# ╔╗ ╔╗ ╔══╗ ╔════╗
# ║╚╗╔╝║ ╚╣╠╝ ║╔╗╔╗║
# ╚╗╚╝╔╝ ║║ ╔══╗ ╚╝║║╚╝
# ╚╗╔╝ ║║ ║╔╗║ ║║
# ║║ ╔╣╠╗ ║╚╝║ ║║
# ╚╝ ╚══╝ ╚══╝ ╚╝
# ╔╗╔═╗ ╔╗ ╔╗
# ║║║╔╝ ╔╝╚╗ ║║
# ║╚╝╝ ╔══╗ ╔══╗ ╔══╗ ╔╗╚╗╔╝ ╔══╗ ╔╗ ╔╗╔╗ ╔══╗ ║║ ╔══╗
# ║╔╗║ ║║═╣ ║║═╣ ║╔╗║ ╠╣ ║║ ║ ═╣ ╠╣ ║╚╝║ ║╔╗║ ║║ ║║═╣
# ║║║╚╗ ║║═╣ ║║═╣ ║╚╝║ ║║ ║╚╗ ╠═ ║ ║║ ║║║║ ║╚╝║ ║╚╗ ║║═╣
# ╚╝╚═╝ ╚══╝ ╚══╝ ║╔═╝ ╚╝ ╚═╝ ╚══╝ ╚╝ ╚╩╩╝ ║╔═╝ ╚═╝ ╚══╝
# ║║ ║║
# ╚╝ ╚╝
#
# Lead Maintainer: Roman Kutashenko <[email protected]>
# ────────────────────────────────────────────────────────────
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
# ---------------------------------------------------------------------------
# Project version
# ---------------------------------------------------------------------------
set(KS_TARGET_VERSION "0.1.0")
# ---------------------------------------------------------------------------
# Options
# ---------------------------------------------------------------------------
option(BUILD_DEVICE_ENABLE "Enable building of Device app" ON)
option(BUILD_EMULATORS_ENABLE "Enable building of Device emulators" ON)
option(BUILD_APP_ENABLE "Enable building of Application" ON)
# ---------------------------------------------------------------------------
# Include Cmake helpers
# ---------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if (BUILD_APP_ENABLE)
include(vsplatforms)
endif()
include(varpadding)
#include(clangformat)
# ---------------------------------------------------------------------------
# Define project
# ---------------------------------------------------------------------------
project(yiot VERSION ${KS_TARGET_VERSION} LANGUAGES C CXX)
file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${KS_TARGET_VERSION}")
# ---------------------------------------------------------------------------
# Detecting platform if KS_PLATFORM not specified
# ---------------------------------------------------------------------------
if(NOT KS_PLATFORM)
if(ANDROID)
message(STATUS "Detected target platform: [Android]")
set(KS_PLATFORM "android")
elseif(UNIX)
message(STATUS "Detected target platform: [Unix]")
set(KS_PLATFORM "linux")
elseif(MACOS)
message(STATUS "Detected target platform: [MacOS]")
set(KS_PLATFORM "macos")
elseif(IOS)
message(STATUS "Detected target platform: [IOS]")
set(KS_PLATFORM "ios")
elseif(WIN32)
message(STATUS "Detected target platform: [Windows]")
set(KS_PLATFORM "windows")
endif()
endif()
if ((KS_PLATFORM STREQUAL "linux") OR (KS_PLATFORM STREQUAL "macos") OR (KS_PLATFORM STREQUAL "windows"))
set (KS_PLATFORM_DESKTOP ON)
else()
set (KS_PLATFORM_DESKTOP OFF)
endif()
message(STATUS "KS_PLATFORM: ${KS_PLATFORM}")
message(STATUS "KS_PLATFORM_DESKTOP: ${KS_PLATFORM_DESKTOP}")
# ---------------------------------------------------------------------------
# Platform limitations
# ---------------------------------------------------------------------------
if (NOT KS_PLATFORM STREQUAL "linux")
set (BUILD_DEVICE_ENABLE OFF)
endif()
if ((NOT KS_PLATFORM STREQUAL "linux") AND (NOT KS_PLATFORM STREQUAL "macos"))
set (BUILD_EMULATORS_ENABLE OFF)
endif()
# ---------------------------------------------------------------------------
# YIoT-core
# ---------------------------------------------------------------------------
set(VIRGIL_IOT_CONFIG_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ext/yiot-core/iotkit/sdk/config/pc)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ext/yiot-core)
# ---------------------------------------------------------------------------
# Device Applications
# ---------------------------------------------------------------------------
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/device-app)
# ---------------------------------------------------------------------------
# Cross-platform control applications
# ---------------------------------------------------------------------------
if (BUILD_APP_ENABLE)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/controll-app)
endif()