Jason M. Bills | 1490b14 | 2019-07-01 15:48:43 -0700 | [diff] [blame] | 1 | cmake_minimum_required (VERSION 3.6) |
| 2 | project (host-error-monitor CXX) |
| 3 | set (CMAKE_CXX_STANDARD 17) |
| 4 | set (CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | |
| 6 | add_executable (host-error-monitor src/host_error_monitor.cpp) |
| 7 | |
Jason M. Bills | 9478544 | 2020-01-07 15:22:09 -0800 | [diff] [blame] | 8 | option (HOST_ERROR_CRASHDUMP_ON_SMI_TIMEOUT "Enable crashdump on SMI Timeout." |
| 9 | OFF) |
| 10 | |
| 11 | target_compile_definitions (host-error-monitor PRIVATE |
| 12 | $<$<BOOL:${HOST_ERROR_CRASHDUMP_ON_SMI_TIMEOUT}>: |
| 13 | -DHOST_ERROR_CRASHDUMP_ON_SMI_TIMEOUT>) |
| 14 | |
Jason M. Bills | 1490b14 | 2019-07-01 15:48:43 -0700 | [diff] [blame] | 15 | target_include_directories (host-error-monitor PRIVATE ${CMAKE_SOURCE_DIR}) |
| 16 | |
Jason M. Bills | 6a2cb69 | 2019-08-06 11:03:49 -0700 | [diff] [blame] | 17 | target_link_libraries (host-error-monitor sdbusplus -lsystemd gpiodcxx peci) |
Jason M. Bills | 1490b14 | 2019-07-01 15:48:43 -0700 | [diff] [blame] | 18 | |
| 19 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 20 | |
| 21 | install (TARGETS host-error-monitor |
| 22 | RUNTIME DESTINATION bin |
| 23 | LIBRARY DESTINATION lib |
| 24 | ARCHIVE DESTINATION lib/static) |
| 25 | |
| 26 | find_package (Boost 1.66 REQUIRED) |
| 27 | include_directories (${BOOST_SRC_DIR}) |
| 28 | |
| 29 | add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 30 | add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) |
| 31 | add_definitions (-DBOOST_ALL_NO_LIB) |
| 32 | add_definitions (-DBOOST_NO_RTTI) |
| 33 | add_definitions (-DBOOST_NO_TYPEID) |
| 34 | add_definitions (-DBOOST_ASIO_DISABLE_THREADS) |
| 35 | |
| 36 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 37 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") |
| 38 | |
| 39 | set ( |
| 40 | SERVICE_FILES |
| 41 | ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.HostErrorMonitor.service |
| 42 | ) |
| 43 | install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |