blob: 1f9aba2599d12cc5ab1fc025f5eb25313666a352 [file] [log] [blame]
Kuiying Wang64ff7ce2018-08-15 11:17:06 +08001cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
2project(power-control CXX)
James Feist676d2c32019-02-14 10:07:27 -08003set(CMAKE_CXX_STANDARD 17)
Kuiying Wang64ff7ce2018-08-15 11:17:06 +08004set(CMAKE_CXX_STANDARD_REQUIRED ON)
5
Kuiying Wang64ff7ce2018-08-15 11:17:06 +08006set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
7include(GNUInstallDirs)
8
9include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
10include_directories(${CMAKE_CURRENT_BINARY_DIR})
11
12set(DBUS_OBJECT_NAME "xyz/openbmc_project/Chassis/Control/Power")
13set(DBUS_INTF_NAME "xyz.openbmc_project.Chassis.Control.Power")
14
15add_definitions(-DDBUS_OBJECT_NAME="/${DBUS_OBJECT_NAME}0")
16add_definitions(-DDBUS_INTF_NAME="${DBUS_INTF_NAME}")
17set(SRC_FILES
18 src/power_control.cpp
19 src/main.cpp
20)
21
Kuiying Wangc8153bc2018-11-09 16:34:33 +080022set (
23 SERVICE_FILES
24 service-files/intel-power-start@.service
25 service-files/intel-power-stop@.service
26 service-files/intel-power-warm-reset@.service
27 service-files/obmc-chassis-hard-poweroff@.target
28 service-files/obmc-chassis-poweroff@.target
29 service-files/obmc-chassis-poweron@.target
30 service-files/obmc-chassis-powerreset@.target
31 service-files/obmc-host-reboot@.target
32 service-files/obmc-host-soft-reboot@.target
33 service-files/obmc-host-start@.target
34 service-files/obmc-host-startmin@.target
35 service-files/obmc-host-stop@.target
36 service-files/obmc-host-warm-reset@.target
37 service-files/obmc-send-signal-host-starting@.service
38 service-files/obmc-send-signal-host-stopping@.service
39 service-files/obmc-send-signal-post-host-start@.service
40 service-files/obmc-send-signal-post-host-stop@.service
41 service-files/obmc-send-signal-pre-host-start@.service
42 service-files/obmc-send-signal-pre-host-stop@.service
43 service-files/op-reset-chassis-on@.service
44 service-files/op-reset-chassis-running@.service
45 service-files/xyz.openbmc_project.Chassis.Control.Power@.service
46)
47
Kuiying Wang64ff7ce2018-08-15 11:17:06 +080048# import sdbusplus
49find_package(PkgConfig REQUIRED)
50pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
51include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
52link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
53find_program(SDBUSPLUSPLUS sdbus++)
54
55# import phosphor-logging
56find_package(PkgConfig REQUIRED)
57pkg_check_modules(LOGGING phosphor-logging REQUIRED)
58include_directories(${LOGGING_INCLUDE_DIRS})
59link_directories(${LOGGING_LIBRARY_DIRS})
60
61# phosphor-dbus-interfaces
62find_package(PkgConfig REQUIRED)
63pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
64include_directories(${DBUSINTERFACE_INCLUDE_DIRS})
65link_directories(${DBUSINTERFACE_LIBRARY_DIRS})
66
67add_executable(${PROJECT_NAME} ${SRC_FILES})
68target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES}
69 chassisgpio )
70target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs -lphosphor_dbus")
71
72install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
Kuiying Wangc8153bc2018-11-09 16:34:33 +080073install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
74