Kuiying Wang | 64ff7ce | 2018-08-15 11:17:06 +0800 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) |
Jason M. Bills | 0d57f4e | 2021-10-21 14:11:41 -0700 | [diff] [blame] | 2 | project(power-control CXX) |
Patrick Venture | 219a2f9 | 2018-11-05 16:54:36 -0800 | [diff] [blame] | 3 | set(CMAKE_CXX_STANDARD 17) |
Kuiying Wang | 64ff7ce | 2018-08-15 11:17:06 +0800 | [diff] [blame] | 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | |
Jason M. Bills | 0d57f4e | 2021-10-21 14:11:41 -0700 | [diff] [blame] | 6 | option ( |
| 7 | CHASSIS_SYSTEM_RESET |
| 8 | "Enable chassis system power reset to allow removing |
| 9 | power and restoring back" |
| 10 | OFF |
| 11 | ) |
| 12 | option ( |
| 13 | USE_PLT_RST |
| 14 | "Use the PLT_RST eSPI signal to detect warm reset |
| 15 | instead of POST Complete" |
| 16 | OFF |
| 17 | ) |
| 18 | |
| 19 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 20 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 21 | add_definitions(-DBOOST_ALL_NO_LIB) |
| 22 | add_definitions(-DBOOST_NO_RTTI) |
| 23 | add_definitions(-DBOOST_NO_TYPEID) |
| 24 | add_definitions(-DBOOST_ASIO_DISABLE_THREADS) |
| 25 | |
| 26 | set(SRC_FILES src/power_control.cpp) |
| 27 | |
| 28 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 29 | target_link_libraries(${PROJECT_NAME} gpiodcxx) |
| 30 | target_link_libraries(${PROJECT_NAME} systemd) |
| 31 | target_link_libraries(${PROJECT_NAME} sdbusplus) |
| 32 | |
| 33 | target_compile_definitions ( |
| 34 | ${PROJECT_NAME} PRIVATE $<$<BOOL:${CHASSIS_SYSTEM_RESET}>: |
| 35 | -DCHASSIS_SYSTEM_RESET> |
| 36 | ${PROJECT_NAME} PRIVATE $<$<BOOL:${USE_PLT_RST}>: |
| 37 | -DUSE_PLT_RST> |
| 38 | ) |
| 39 | |
| 40 | install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 41 | |
| 42 | # Temporarily disable rtti |
| 43 | # See https://github.com/chriskohlhoff/asio/issues/533 |
| 44 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 45 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") |
| 46 | |
| 47 | set( |
| 48 | SERVICE_FILES |
| 49 | ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.service |
| 50 | ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.target |
| 51 | ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.Chassis.Control.Power@.service |
| 52 | ) |
| 53 | |
| 54 | set( |
| 55 | CONFIG_FILE |
| 56 | ${PROJECT_SOURCE_DIR}/config/power-config-host0.json |
| 57 | ) |
| 58 | |
| 59 | install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |
| 60 | install(FILES ${CONFIG_FILE} DESTINATION /usr/share/x86-power-control/) |