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