-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (66 loc) · 2.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
cmake_minimum_required(VERSION 3.14)
project(
smarthome-distribution
DESCRIPTION "A stable and secure smart home implementation."
HOMEPAGE_URL "https://github.com/haydenmcp/smarthome"
LANGUAGES CXX
VERSION 0.0.1)
include(CMakeDependentOption)
include(InstallRequiredSystemLibraries)
include(GNUInstallDirs)
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE BOOL "Ensure all windows symbols are exported." FORCE)
file(TO_CMAKE_PATH "$ENV{SystemDrive}/smarthome" SMARTHOME_HOME)
set(SMARTHOME_HOME "${SMARTHOME_HOME}" CACHE PATH "" FORCE)
file(TO_CMAKE_PATH "${SMARTHOME_HOME}/data" SMARTHOME_DATA)
set(SMARTHOME_DATA "${SMARTHOME_DATA}" CACHE PATH "" FORCE)
file(TO_CMAKE_PATH "${SMARTHOME_HOME}/programs" SMARTHOME_PROGRAMS)
set(SMARTHOME_PROGRAMS "${SMARTHOME_PROGRAMS}" CACHE PATH "" FORCE)
# On first build in a given tree initialize default install prefix
set(CMAKE_INSTALL_PREFIX "${SMARTHOME_PROGRAMS}/smarthome" CACHE PATH "" FORCE)
file(RELATIVE_PATH SMARTHOME_SUBPROJECT_INSTALL_RELATIVE_RPATH
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH "${ORIGIN}" "${ORIGIN}/${SMARTHOME_SUBPROJECT_INSTALL_RELATIVE_RPATH}")
option(SMARTHOME_MASTER_PROJECT "Indicates whether smarthome is currently the main project." OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SMARTHOME_MASTER_PROJECT ON)
endif()
# Distribution options
option(INCLUDE_SMARTHOME_CLI "Include smarthome distribution command-line interface (CLI)." ${SMARTHOME_MASTER_PROJECT})
option(INCLUDE_SMARTHOME_DOCS "Include smarthome distribution documentation." ${SMARTHOME_MASTER_PROJECT})
option(INCLUDE_SMARTHOME_EXAMPLES "Include smarthome distribution examples." ${SMARTHOME_MASTER_PROJECT})
option(INCLUDE_SMARTHOME_TESTS "Include smarthome distribution tests." ${SMARTHOME_MASTER_PROJECT})
option(INCLUDE_DEVICE_PACKAGE "Include device package." ${SMARTHOME_MASTER_PROJECT})
option(INCLUDE_SENSOR_PACKAGE "Include sensor package." ${SMARTHOME_MASTER_PROJECT})
set(SMARTHOME_PACKAGE_DEPENDENCIES "git" "clang" "build-essential" "nodejs" "npm")
add_subdirectory("core")
add_subdirectory("logger")
if(INCLUDE_DEVICE_PACKAGE)
add_subdirectory("device")
endif()
if(INCLUDE_SENSOR_PACKAGE)
add_subdirectory("sensor")
endif()
if(INCLUDE_SMARTHOME_CLI)
add_subdirectory("cli")
endif()
if(INCLUDE_SMARTHOME_DOCS)
add_subdirectory("docs")
endif()
if(INCLUDE_SMARTHOME_EXAMPLES)
add_subdirectory("example")
endif()
if(INCLUDE_SMARTHOME_TESTS)
enable_testing()
endif()
if (GENERATE_SMARTHOME_PACKAGE)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
add_subdirectory("package")
endif()
include("setup/CMakeLists.txt")