Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) |
| 2 | project(power-control CXX) |
| 3 | set(CMAKE_CXX_STANDARD 17) |
| 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | |
Vijay Khemka | 04175c2 | 2020-10-09 14:28:11 -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 | ) |
Jason M. Bills | fb95733 | 2021-01-28 13:18:46 -0800 | [diff] [blame] | 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 | ) |
Vijay Khemka | 04175c2 | 2020-10-09 14:28:11 -0700 | [diff] [blame] | 18 | |
Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 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} -lstdc++fs) |
| 30 | target_link_libraries(${PROJECT_NAME} chassisi2c) |
| 31 | target_link_libraries(${PROJECT_NAME} i2c) |
| 32 | target_link_libraries(${PROJECT_NAME} gpiodcxx) |
| 33 | target_link_libraries(${PROJECT_NAME} systemd) |
| 34 | target_link_libraries(${PROJECT_NAME} sdbusplus) |
| 35 | |
Vijay Khemka | 04175c2 | 2020-10-09 14:28:11 -0700 | [diff] [blame] | 36 | target_compile_definitions ( |
| 37 | ${PROJECT_NAME} PRIVATE $<$<BOOL:${CHASSIS_SYSTEM_RESET}>: |
| 38 | -DCHASSIS_SYSTEM_RESET> |
Jason M. Bills | fb95733 | 2021-01-28 13:18:46 -0800 | [diff] [blame] | 39 | ${PROJECT_NAME} PRIVATE $<$<BOOL:${USE_PLT_RST}>: |
| 40 | -DUSE_PLT_RST> |
Vijay Khemka | 04175c2 | 2020-10-09 14:28:11 -0700 | [diff] [blame] | 41 | ) |
| 42 | |
Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 43 | install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 44 | |
Andrew Geissler | 46152f9 | 2020-10-05 13:29:38 -0500 | [diff] [blame] | 45 | # Temporarily disable rtti |
| 46 | # See https://github.com/chriskohlhoff/asio/issues/533 |
| 47 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 48 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") |
Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 49 | |
| 50 | set( |
| 51 | SERVICE_FILES |
Vijay Khemka | b0c613a | 2020-05-06 11:11:04 -0700 | [diff] [blame] | 52 | ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.service |
| 53 | ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.target |
Priyatharshan P | 7012051 | 2020-09-16 18:47:20 +0530 | [diff] [blame] | 54 | ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.Chassis.Control.Power@.service |
Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 55 | ) |
Priyatharshan P | e4d7f2b | 2020-06-22 22:41:42 +0530 | [diff] [blame] | 56 | |
| 57 | set( |
| 58 | CONFIG_FILE |
| 59 | ${PROJECT_SOURCE_DIR}/config/power-config-host0.json |
| 60 | ) |
| 61 | |
Ed Tanous | f61ca6f | 2019-08-15 15:09:05 -0700 | [diff] [blame] | 62 | install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |
Kumar Thangavel | 699b565 | 2020-08-04 22:38:33 +0530 | [diff] [blame] | 63 | install(FILES ${CONFIG_FILE} DESTINATION /usr/share/x86-power-control/) |