forked from OpenCyphal-Garage/libcyphal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (112 loc) · 4.3 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
113
114
115
116
117
118
119
120
121
122
123
124
125
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
#
cmake_minimum_required(VERSION 3.22.0)
# +---------------------------------------------------------------------------+
# | PROJECT
# +---------------------------------------------------------------------------+
include(cmake/CMakeCommon.cmake REQUIRED)
project(libcyphal
VERSION ${LIBCYPHAL_VERSION}
LANGUAGES CXX C
HOMEPAGE_URL https://github.com/OpenCyphal/libcyphal
)
# +---------------------------------------------------------------------------+
# | SUBPROJECTS
# +---------------------------------------------------------------------------+
add_subdirectory(test/unittest)
add_subdirectory(docs)
if (${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
add_subdirectory(demonstration/linux)
endif()
# +---------------------------------------------------------------------------+
# | DEFAULT BUILD SUPPORT
# +---------------------------------------------------------------------------+
add_custom_target(
docs
DEPENDS
generate_libcyphal_docs
)
add_custom_target(
build
DEPENDS
build_unittests
build_examples
)
if (${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
add_dependencies(
build
libcyphal_demo_posix
)
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
add_custom_target(
unittest
DEPENDS
run_unittests
gcovr_html_report_for_unittest
run_examples
gcovr_html_report_for_examples
)
else()
add_custom_target(
unittest
DEPENDS
run_unittests
run_examples
)
endif()
add_custom_target(
release
DEPENDS
build
unittest
docs
)
# Don't normalize deviance: if CMAKE_TOOLCHAIN_FILE is not set then provide
# an initalized default to display in the status thus avoiding a warning about
# using an uninitialized variable.
if (NOT CMAKE_TOOLCHAIN_FILE)
set(LOCAL_CMAKE_TOOLCHAIN_FILE "(not set)")
else()
set(LOCAL_CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE})
endif()
message(STATUS "-------------------------------------------------------------------\n\
| ${CMAKE_PROJECT_NAME}
-- -------------------------------------------------------------------\n\
LIBCYPHAL_ROOT: ${LIBCYPHAL_ROOT}\n\
LIBCYPHAL_INCLUDE: ${LIBCYPHAL_INCLUDE}\n\
LIBCYPHAL_VERSION: ${LIBCYPHAL_VERSION}\n\
LIBCYPHAL_INTROSPECTION_TRACE_ENABLE: ${LIBCYPHAL_INTROSPECTION_TRACE_ENABLE}\n\
LIBCYPHAL_INTROSPECTION_ENABLE_ASSERT: ${LIBCYPHAL_INTROSPECTION_ENABLE_ASSERT}\n\
CETLVAST_CPP_STANDARD: ${CETLVAST_CPP_STANDARD}\n\
CMAKE_PROJECT_NAME: ${CMAKE_PROJECT_NAME}\n\
CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}\n\
CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}\n\
CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}\n\
CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}\n\
CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}\n\
CMAKE_MESSAGE_LOG_LEVEL: ${CMAKE_MESSAGE_LOG_LEVEL}\n\
CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}\n\
CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n\
FETCHCONTENT_FULLY_DISCONNECTED: ${FETCHCONTENT_FULLY_DISCONNECTED}\n\
\n\
CETL
CETL_ENABLE_DEBUG_ASSERT: ${CETL_ENABLE_DEBUG_ASSERT}\n\
\n\
Standard Library\n\
LIBCXX_ENABLE_ASSERTIONS: ${LIBCXX_ENABLE_ASSERTIONS}\n\
-- ------------------------------------------------------------------\n\
")
message(STATUS "[ Build Kit ]-------------------------------------------\n\
CMAKE_TOOLCHAIN_FILE: ${LOCAL_CMAKE_TOOLCHAIN_FILE}\n\
CETLVAST_FLAG_SET: ${CETLVAST_FLAG_SET}\n\
CMAKE_CXX_COMPILER_[ID-VER]: ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}\n\
CMAKE_C_COMPILER_[ID-VER]: ${CMAKE_CXX_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}\n\
CMAKE_AR: ${CMAKE_AR}\n\
CMAKE_LINKER: ${CMAKE_LINKER}\n\
CMAKE_RANLIB: ${CMAKE_RANLIB}\n\
CMAKE_[lang]_PLATFORM_ID: ${CMAKE_CXX_PLATFORM_ID}\n\
-----------------------------------------------------------\n\
")