Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 1 | project(velia LANGUAGES CXX) |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 2 | cmake_minimum_required(VERSION 3.15) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 3 | |
| 4 | # Build options |
| 5 | set(CMAKE_CXX_STANDARD 17) |
| 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 7 | |
| 8 | set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}") |
| 9 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Woverloaded-virtual ${CMAKE_CXX_FLAGS}") |
| 10 | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
| 11 | set(CMAKE_CXX_FLAGS "-Wsuggest-override ${CMAKE_CXX_FLAGS}") |
| 12 | endif() |
| 13 | |
Tomáš Pecka | 5d4cf2a | 2020-07-13 13:19:41 +0200 | [diff] [blame] | 14 | if(CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) |
| 15 | set(STD_FILESYSTEM_LIBRARY c++fs) |
| 16 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1) |
| 17 | set(STD_FILESYSTEM_LIBRARY stdc++fs) |
| 18 | endif() |
| 19 | |
| 20 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 21 | add_custom_target(velia-version-cmake-ide |
| 22 | cmake/ProjectGitVersion.cmake |
| 23 | cmake/ProjectGitVersionRunner.cmake |
| 24 | ) |
| 25 | include(cmake/ProjectGitVersion.cmake) |
| 26 | prepare_git_version(VELIA_VERSION "0.0") |
| 27 | |
| 28 | find_package(Doxygen) |
| 29 | option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND}) |
| 30 | |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 31 | find_package(Boost REQUIRED) |
Tomáš Pecka | a193c03 | 2020-06-22 17:33:31 +0200 | [diff] [blame] | 32 | find_package(docopt REQUIRED) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 33 | find_package(spdlog REQUIRED) |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 34 | find_package(sdbus-c++ REQUIRED) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 35 | find_package(PkgConfig) |
| 36 | |
| 37 | pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd) |
Tomáš Pecka | 1f42cfe | 2020-10-21 18:38:27 +0200 | [diff] [blame] | 38 | if(${SYSTEMD_VERSION} VERSION_EQUAL 245) |
| 39 | message(FATAL_ERROR "Systemd 245 has a bug affecting DBus method calls using sdbus-c++. Please see https://github.com/Kistler-Group/sdbus-cpp/issues/106.") |
| 40 | endif() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 41 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 42 | pkg_check_modules(SYSREPO REQUIRED sysrepo-cpp>=1.4.79 IMPORTED_TARGET sysrepo) |
| 43 | pkg_check_modules(LIBYANG REQUIRED libyang-cpp>=1.0.190 IMPORTED_TARGET libyang) |
| 44 | |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 45 | include(GNUInstallDirs) |
| 46 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 47 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/) |
| 48 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 49 | set(YANG_SRCS |
| 50 | yang/iana-hardware@2018-03-13.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 51 | yang/ietf-hardware@2018-03-13.yang |
Tomáš Pecka | f98ce03 | 2021-01-14 13:35:00 +0100 | [diff] [blame] | 52 | yang/iana-crypt-hash@2014-08-06.yang |
| 53 | yang/ietf-inet-types@2013-07-15.yang |
| 54 | yang/ietf-netconf-acm@2018-02-14.yang |
| 55 | yang/ietf-system@2014-08-06.yang |
| 56 | yang/ietf-yang-types@2013-07-15.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 57 | ) |
| 58 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 59 | # Targets |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 60 | # - utils |
Tomáš Pecka | bd82886 | 2020-06-15 15:53:35 +0200 | [diff] [blame] | 61 | add_library(velia-utils STATIC |
Tomáš Pecka | a193c03 | 2020-06-22 17:33:31 +0200 | [diff] [blame] | 62 | src/utils/exceptions.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 63 | src/utils/exceptions.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 64 | src/utils/io.cpp |
| 65 | src/utils/io.h |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 66 | src/utils/journal.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 67 | src/utils/journal.h |
| 68 | src/utils/log.h |
| 69 | src/utils/log-fwd.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 70 | src/utils/log-init.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 71 | src/utils/log-init.h |
Tomáš Pecka | f02671e | 2021-01-13 09:09:48 +0100 | [diff] [blame] | 72 | src/utils/log-sysrepo.cpp |
| 73 | src/utils/log-sysrepo.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 74 | src/utils/time.cpp |
| 75 | src/utils/time.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 76 | ) |
Tomáš Pecka | f02671e | 2021-01-13 09:09:48 +0100 | [diff] [blame] | 77 | target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::SYSREPO) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 78 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 79 | # - health |
| 80 | add_library(velia-health STATIC |
| 81 | src/health/inputs/AbstractInput.cpp |
| 82 | src/health/inputs/DbusSemaphoreInput.cpp |
| 83 | src/health/inputs/DbusSystemdInput.cpp |
| 84 | src/health/manager/AbstractManager.cpp |
| 85 | src/health/manager/StateManager.cpp |
| 86 | src/health/outputs/LedSysfsDriver.cpp |
| 87 | src/health/outputs/callables.cpp |
| 88 | src/health/State.cpp |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 89 | ) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 90 | target_link_libraries(velia-health |
| 91 | PUBLIC |
| 92 | velia-utils |
| 93 | Boost::boost |
| 94 | SDBusCpp::sdbus-c++ |
| 95 | ${STD_FILESYSTEM_LIBRARY} |
| 96 | ) |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 97 | |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 98 | # - ietf-hardware |
| 99 | add_library(velia-ietf-hardware STATIC |
| 100 | src/ietf-hardware/sysfs/EMMC.cpp |
| 101 | src/ietf-hardware/sysfs/EMMC.h |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 102 | src/ietf-hardware/sysfs/HWMon.cpp |
| 103 | src/ietf-hardware/sysfs/HWMon.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 104 | src/ietf-hardware/IETFHardware.cpp |
| 105 | src/ietf-hardware/IETFHardware.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 106 | ) |
| 107 | target_link_libraries(velia-ietf-hardware |
| 108 | PUBLIC |
| 109 | velia-utils |
| 110 | ${STD_FILESYSTEM_LIBRARY} |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 111 | Boost::boost |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 112 | ) |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 113 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 114 | add_library(velia-ietf-hardware-sysrepo STATIC |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 115 | src/ietf-hardware/sysrepo/Sysrepo.cpp |
| 116 | src/ietf-hardware/sysrepo/Sysrepo.h |
| 117 | ) |
| 118 | target_link_libraries(velia-ietf-hardware-sysrepo |
| 119 | PUBLIC |
| 120 | velia-utils |
| 121 | PkgConfig::SYSREPO |
| 122 | PkgConfig::LIBYANG |
| 123 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 124 | |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame^] | 125 | # - ietf-system |
| 126 | add_library(velia-system STATIC |
| 127 | src/system/Sysrepo.cpp |
| 128 | src/system/Sysrepo.h |
| 129 | ) |
| 130 | target_link_libraries(velia-system |
| 131 | PUBLIC |
| 132 | velia-utils |
| 133 | PkgConfig::SYSREPO |
| 134 | PkgConfig::LIBYANG |
| 135 | ) |
| 136 | |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 137 | # - daemon |
| 138 | add_executable(veliad |
| 139 | src/main.cpp |
| 140 | src/Factory.cpp |
| 141 | src/Factory.h |
| 142 | ) |
| 143 | target_link_libraries(veliad |
| 144 | PUBLIC |
| 145 | velia-health |
| 146 | velia-ietf-hardware |
| 147 | velia-ietf-hardware-sysrepo |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame^] | 148 | velia-system |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 149 | docopt |
| 150 | ) |
| 151 | add_dependencies(veliad target-VELIA_VERSION) |
| 152 | target_include_directories(veliad PUBLIC ${CMAKE_BINARY_DIR}) |
| 153 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 154 | # Testing |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 155 | include(CTest) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 156 | if(BUILD_TESTING) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 157 | find_package(trompeloeil 33 REQUIRED) |
| 158 | find_package(doctest 2.3.1 REQUIRED) |
| 159 | |
Tomáš Pecka | efd8843 | 2020-06-17 15:31:39 +0200 | [diff] [blame] | 160 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/configure.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/configure.cmake.h) |
| 161 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 162 | add_library(DoctestIntegration STATIC |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 163 | tests/doctest_integration.cpp |
| 164 | tests/trompeloeil_doctest.h |
| 165 | tests/wait-a-bit-longer.cpp |
| 166 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 167 | target_link_libraries(DoctestIntegration doctest::doctest trompeloeil spdlog::spdlog) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 168 | target_include_directories(DoctestIntegration PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 169 | target_compile_definitions(DoctestIntegration PUBLIC DOCTEST_CONFIG_SUPER_FAST_ASSERTS) |
| 170 | |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 171 | add_library(DbusTesting STATIC |
| 172 | tests/dbus-helpers/dbus_semaphore_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 173 | tests/dbus-helpers/dbus_semaphore_server.h |
Tomáš Pecka | ccd80c3 | 2020-06-22 14:44:32 +0200 | [diff] [blame] | 174 | tests/dbus-helpers/dbus_systemd_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 175 | tests/dbus-helpers/dbus_systemd_server.h |
| 176 | ) |
| 177 | target_link_libraries(DbusTesting |
| 178 | PUBLIC |
| 179 | velia-utils |
| 180 | SDBusCpp::sdbus-c++ |
| 181 | ) |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 182 | |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 183 | add_library(FsTestUtils STATIC |
| 184 | tests/fs-helpers/FileInjector.cpp |
| 185 | tests/fs-helpers/FileInjector.h |
| 186 | tests/fs-helpers/utils.cpp |
| 187 | tests/fs-helpers/utils.h |
| 188 | ) |
| 189 | target_link_libraries(FsTestUtils |
| 190 | PUBLIC |
| 191 | ${STD_FILESYSTEM_LIBRARY} |
| 192 | ) |
| 193 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 194 | function(velia_test name) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 195 | add_executable(test-${name} ${CMAKE_SOURCE_DIR}/tests/${name}.cpp) |
| 196 | target_link_libraries(test-${name} DoctestIntegration ${ARGN}) |
| 197 | target_include_directories(test-${name} |
| 198 | PUBLIC |
| 199 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 200 | PRIVATE |
| 201 | ${CMAKE_BINARY_DIR} |
| 202 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 203 | |
| 204 | if(NOT CMAKE_CROSSCOMPILING) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 205 | add_test(test-${name} test-${name}) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 206 | endif() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 207 | endfunction() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 208 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 209 | find_program(SYSREPOCTL sysrepoctl) |
| 210 | find_program(SYSREPOCFG sysrepocfg) |
| 211 | |
| 212 | set(sysrepo_previous_fixture_name UNDEFINED) |
| 213 | function(sysrepo_fixture_env name) |
| 214 | set(test_name_init sysrepo:prep:${name}) |
| 215 | set(test_name_cleanup sysrepo:clean:${name}) |
| 216 | set(fixture_name sysrepo:env:${name}) |
| 217 | |
| 218 | add_test(NAME ${test_name_init} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} prepare ${ARGN}) |
| 219 | set_tests_properties(${test_name_init} PROPERTIES FIXTURES_SETUP ${fixture_name} RESOURCE_LOCK sysrepo) |
| 220 | add_test(NAME ${test_name_cleanup} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} uninstall ${ARGN}) |
| 221 | set_tests_properties(${test_name_cleanup} PROPERTIES FIXTURES_CLEANUP ${fixture_name} RESOURCE_LOCK sysrepo) |
| 222 | |
| 223 | if (sysrepo_previous_fixture_name) |
| 224 | set_tests_properties(${test_name_init} PROPERTIES DEPENDS sysrepo:clean:${sysrepo_previous_fixture_name}) |
| 225 | endif () |
| 226 | |
| 227 | set(sysrepo_previous_fixture_name ${name} PARENT_SCOPE) |
| 228 | endfunction() |
| 229 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 230 | velia_test(health_state-manager velia-health) |
| 231 | velia_test(health_input-semaphore velia-health DbusTesting) |
| 232 | velia_test(health_input-systemd velia-health DbusTesting) |
| 233 | velia_test(health_output-led velia-health) |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 234 | |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 235 | velia_test(hardware_emmc velia-ietf-hardware FsTestUtils) |
| 236 | velia_test(hardware_hwmon velia-ietf-hardware FsTestUtils) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 237 | |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame^] | 238 | sysrepo_fixture_env(sysrepo-ietf-system YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-system@2014-08-06.yang) |
| 239 | velia_test(sysrepo_system velia-system DbusTesting) |
| 240 | set_tests_properties( |
| 241 | test-sysrepo_system |
| 242 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-ietf-system |
| 243 | RESOURCE_LOCK sysrepo |
| 244 | ) |
| 245 | |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 246 | sysrepo_fixture_env(sysrepo-ietf-hardware YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-hardware@2018-03-13.yang YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-hardware@2018-03-13.yang FEATURE hardware-sensor) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 247 | velia_test(hardware_ietf-hardware velia-ietf-hardware velia-ietf-hardware-sysrepo) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 248 | set_tests_properties( |
| 249 | test-hardware_ietf-hardware |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 250 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-ietf-hardware |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 251 | RESOURCE_LOCK sysrepo |
| 252 | ) |
| 253 | |
| 254 | velia_test(sysrepo_two-daemons velia-ietf-hardware-sysrepo) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 255 | # ctest dance for sysrepo_two-daemons: compile daemon, create a fixture for test, add the test into the fixture |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 256 | add_executable(test-sysrepo_test_merge-daemon ${CMAKE_SOURCE_DIR}/tests/sysrepo_two-daemons_daemon.cpp) |
| 257 | target_link_libraries(test-sysrepo_test_merge-daemon PkgConfig::SYSREPO PkgConfig::LIBYANG) |
| 258 | |
| 259 | add_test(NAME sysrepo_test_merge-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh start) |
| 260 | add_test(NAME sysrepo_test_merge-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh stop) |
| 261 | set_tests_properties(sysrepo_test_merge-start PROPERTIES FIXTURES_SETUP sysrepo:two-daemons RESOURCE_LOCK sysrepo) |
| 262 | set_tests_properties(sysrepo_test_merge-stop PROPERTIES FIXTURES_CLEANUP sysrepo:two-daemons RESOURCE_LOCK sysrepo) |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 263 | |
| 264 | set_tests_properties( |
| 265 | test-sysrepo_two-daemons |
| 266 | PROPERTIES |
| 267 | FIXTURES_REQUIRED "sysrepo:two-daemons;sysrepo:env:sysrepo-ietf-hardware" |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 268 | RESOURCE_LOCK sysrepo |
| 269 | ) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 270 | # ensure we run two-daemons merge test and ietf-hardware test sequentially and don't cleanup before everything ends |
| 271 | set_tests_properties(sysrepo_test_merge-start PROPERTIES DEPENDS test-hardware_ietf-hardware) |
| 272 | set_tests_properties(sysrepo:clean:sysrepo-ietf-hardware PROPERTIES DEPENDS sysrepo_test_merge-stop) |
| 273 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 274 | |
| 275 | find_program(YANGLINT_PATH yanglint) |
| 276 | if (NOT YANGLINT_PATH) |
| 277 | message(FATAL_ERROR "Cannot find libyang's yanglint") |
| 278 | endif() |
| 279 | foreach(yang_file ${YANG_SRCS}) |
| 280 | add_test(NAME yang-tree:${yang_file} COMMAND ${YANGLINT_PATH} -f tree ${CMAKE_CURRENT_SOURCE_DIR}/${yang_file}) |
| 281 | endforeach() |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 282 | endif() |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 283 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 284 | if(WITH_DOCS) |
| 285 | set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) |
| 286 | set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) |
| 287 | configure_file(${doxyfile_in} ${doxyfile} @ONLY) |
| 288 | add_custom_target(doc |
| 289 | COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} |
| 290 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
| 291 | COMMENT "Generating API documentation with Doxygen" |
| 292 | VERBATIM |
| 293 | SOURCES ${doxyfile_in} |
| 294 | ) |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 295 | endif() |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 296 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 297 | set(YANG_DIR ${CMAKE_INSTALL_PREFIX}/share/velia/yang) |
| 298 | install(FILES ${YANG_SRCS} DESTINATION ${YANG_DIR}) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 299 | install(TARGETS veliad RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |