forked from EVerest/everest-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
165 lines (134 loc) · 4.88 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
cmake_minimum_required(VERSION 3.14.7)
project(everest-core
VERSION 2024.1.0
DESCRIPTION "The open operating system for e-mobility charging stations"
LANGUAGES CXX C
)
find_package(everest-cmake 0.1
COMPONENTS bundling
PATHS ../everest-cmake
)
if (NOT everest-cmake_FOUND)
message(STATUS "Retreiving everest-cmake using FetchContent")
include(FetchContent)
FetchContent_Declare(
everest-cmake
GIT_REPOSITORY https://github.com/EVerest/everest-cmake.git
GIT_TAG main
)
FetchContent_MakeAvailable(everest-cmake)
set(everest-cmake_DIR "${everest-cmake_SOURCE_DIR}")
set(everest-cmake_FIND_COMPONENTS "bundling")
include("${everest-cmake_SOURCE_DIR}/everest-cmake-config.cmake")
endif()
# make own cmake modules available
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# test whether linking with libatomic is required on some platforms
include(CheckAtomic)
if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
set(ATOMIC_LIBS "atomic")
else()
set(ATOMIC_LIBS "")
endif()
option(CREATE_SYMLINKS "Create symlinks to javascript modules and auxillary files - for development purposes" OFF)
option(CMAKE_RUN_CLANG_TIDY "Run clang-tidy" OFF)
option(ISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES "Automatically generate and install certificates for development purposes" ON)
option(EVEREST_ENABLE_RUN_SCRIPT_GENERATION "Enables the generation of run scripts (convenience scripts for starting available configurations)" ON)
option(${PROJECT_NAME}_BUILD_TESTING "Build unit tests, used if included as dependency" OFF)
option(BUILD_TESTING "Build unit tests, used if standalone project" OFF)
if((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} OR ${PROJECT_NAME}_BUILD_TESTING) AND BUILD_TESTING)
set(EVEREST_CORE_BUILD_TESTING ON)
endif()
# This is a flag for building development tests, but not necessarily to run them, for expample in case
# tests requires hardware.
option(BUILD_DEV_TESTS "Build dev tests" OFF)
include(ev-define-dependency)
include("module-dependencies.cmake")
find_package(Boost
COMPONENTS
filesystem
program_options
system
thread
REQUIRED
)
if(NOT DISABLE_EDM)
# FIXME (aw): this implicit definition for child projects is hacky
set(THIRD_PARTY_APP_DST "${CMAKE_INSTALL_LIBEXECDIR}/everest/3rd_party")
evc_setup_edm()
# FIXME (aw): we need to set this by hand due to edm
set(EVEREST_SCHEMA_DIR ${everest-framework_SOURCE_DIR}/schemas)
else()
find_package(everest-framework REQUIRED)
find_package(everest-sunspec REQUIRED)
find_package(everest-modbus REQUIRED)
find_package(everest-ocpp REQUIRED)
find_package(everest-openv2g REQUIRED)
find_package(PalSigslot REQUIRED)
find_package(fsm REQUIRED)
find_package(slac REQUIRED)
find_package(pugixml REQUIRED)
find_package(CURL 7.84.0 REQUIRED)
find_package(ryml REQUIRED)
endif()
add_subdirectory(lib)
include(ev-project-bootstrap)
ev_add_project()
# create MF_ROOT_CA if not available
if (ISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES)
file(TOUCH config/certs/ca/mf/MF_ROOT_CA.pem)
endif()
# config
# FIXME (aw): this should be optional
add_subdirectory(config)
# install docker related files
install(
DIRECTORY "cmake/assets/docker"
DESTINATION "${CMAKE_INSTALL_DATADIR}/everest"
)
ev_install_project()
# configure clang-tidy if requested
if(CMAKE_RUN_CLANG_TIDY)
message("Enabling clang-tidy")
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
endif()
# build doxygen documentation if doxygen is available
find_package(Doxygen)
if(DOXYGEN_FOUND)
set( DOXYGEN_OUTPUT_DIRECTORY dist/docs )
doxygen_add_docs(doxygen-${PROJECT_NAME} everest.js include lib src)
endif()
# testing
if(EVEREST_CORE_BUILD_TESTING)
include(CTest)
enable_testing()
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
evc_include(CodeCoverage)
append_coverage_compiler_flags()
add_subdirectory(tests)
setup_target_for_coverage_gcovr_html(
NAME ${PROJECT_NAME}_gcovr_coverage
EXECUTABLE test_config
DEPENDENCIES test_config everest
)
setup_target_for_coverage_lcov(
NAME ${PROJECT_NAME}_lcov_coverage
EXECUTABLE test_config
DEPENDENCIES test_config everest
)
else()
message("Not running unit tests")
endif()
# convenience target for integration tests
add_custom_target(install_everest_testing
COMMAND
if [ -z "${CPM_PACKAGE_everest-utils_SOURCE_DIR}" ] \;
then echo "Could not determine location of everest-utils, please install everest-testing manually!" \;
else echo "Found everest-utils at ${CPM_PACKAGE_everest-utils_SOURCE_DIR}" \;
${PYTHON_EXECUTABLE} -m pip install "${CPM_PACKAGE_everest-utils_SOURCE_DIR}/everest-testing" \;
fi\;
DEPENDS
everestpy_pip_install_dist
COMMENT
"Installing dependencies for testing EVerest"
)