blob: 0216891ebda0073650a33bbe1535fec7c03a4939 [file] [log] [blame]
Ed Tanousf61ca6f2019-08-15 15:09:05 -07001cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
2project(power-control CXX)
3set(CMAKE_CXX_STANDARD 17)
4set(CMAKE_CXX_STANDARD_REQUIRED ON)
5
Vijay Khemka04175c22020-10-09 14:28:11 -07006option (
7 CHASSIS_SYSTEM_RESET
8 "Enable chassis system power reset to allow removing
9 power and restoring back"
10 OFF
11)
Jason M. Billsfb957332021-01-28 13:18:46 -080012option (
13 USE_PLT_RST
14 "Use the PLT_RST eSPI signal to detect warm reset
15 instead of POST Complete"
16 OFF
17)
Vijay Khemka04175c22020-10-09 14:28:11 -070018
Ed Tanousf61ca6f2019-08-15 15:09:05 -070019add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
20add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
21add_definitions(-DBOOST_ALL_NO_LIB)
22add_definitions(-DBOOST_NO_RTTI)
23add_definitions(-DBOOST_NO_TYPEID)
24add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
25
26set(SRC_FILES src/power_control.cpp)
27
28add_executable(${PROJECT_NAME} ${SRC_FILES})
29target_link_libraries(${PROJECT_NAME} -lstdc++fs)
30target_link_libraries(${PROJECT_NAME} chassisi2c)
31target_link_libraries(${PROJECT_NAME} i2c)
32target_link_libraries(${PROJECT_NAME} gpiodcxx)
33target_link_libraries(${PROJECT_NAME} systemd)
34target_link_libraries(${PROJECT_NAME} sdbusplus)
35
Vijay Khemka04175c22020-10-09 14:28:11 -070036target_compile_definitions (
37 ${PROJECT_NAME} PRIVATE $<$<BOOL:${CHASSIS_SYSTEM_RESET}>:
38 -DCHASSIS_SYSTEM_RESET>
Jason M. Billsfb957332021-01-28 13:18:46 -080039 ${PROJECT_NAME} PRIVATE $<$<BOOL:${USE_PLT_RST}>:
40 -DUSE_PLT_RST>
Vijay Khemka04175c22020-10-09 14:28:11 -070041)
42
Ed Tanousf61ca6f2019-08-15 15:09:05 -070043install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
44
Andrew Geissler46152f92020-10-05 13:29:38 -050045# 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 Tanousf61ca6f2019-08-15 15:09:05 -070049
50set(
51 SERVICE_FILES
Vijay Khemkab0c613a2020-05-06 11:11:04 -070052 ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.service
53 ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.target
Priyatharshan P70120512020-09-16 18:47:20 +053054 ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.Chassis.Control.Power@.service
Ed Tanousf61ca6f2019-08-15 15:09:05 -070055 )
Priyatharshan Pe4d7f2b2020-06-22 22:41:42 +053056
57set(
58 CONFIG_FILE
59 ${PROJECT_SOURCE_DIR}/config/power-config-host0.json
60 )
61
Ed Tanousf61ca6f2019-08-15 15:09:05 -070062install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
Kumar Thangavel699b5652020-08-04 22:38:33 +053063install(FILES ${CONFIG_FILE} DESTINATION /usr/share/x86-power-control/)