Kuiying Wang | 64ff7ce | 2018-08-15 11:17:06 +0800 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) |
| 2 | project(power-control CXX) |
James Feist | 676d2c3 | 2019-02-14 10:07:27 -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 | |
Kuiying Wang | 64ff7ce | 2018-08-15 11:17:06 +0800 | [diff] [blame] | 6 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 7 | include(GNUInstallDirs) |
| 8 | |
| 9 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) |
| 10 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
| 11 | |
| 12 | set(DBUS_OBJECT_NAME "xyz/openbmc_project/Chassis/Control/Power") |
| 13 | set(DBUS_INTF_NAME "xyz.openbmc_project.Chassis.Control.Power") |
| 14 | |
| 15 | add_definitions(-DDBUS_OBJECT_NAME="/${DBUS_OBJECT_NAME}0") |
| 16 | add_definitions(-DDBUS_INTF_NAME="${DBUS_INTF_NAME}") |
| 17 | set(SRC_FILES |
| 18 | src/power_control.cpp |
| 19 | src/main.cpp |
| 20 | ) |
| 21 | |
Kuiying Wang | c8153bc | 2018-11-09 16:34:33 +0800 | [diff] [blame] | 22 | set ( |
| 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 Wang | 64ff7ce | 2018-08-15 11:17:06 +0800 | [diff] [blame] | 48 | # import sdbusplus |
| 49 | find_package(PkgConfig REQUIRED) |
| 50 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) |
| 51 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) |
| 52 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) |
| 53 | find_program(SDBUSPLUSPLUS sdbus++) |
| 54 | |
| 55 | # import phosphor-logging |
| 56 | find_package(PkgConfig REQUIRED) |
| 57 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) |
| 58 | include_directories(${LOGGING_INCLUDE_DIRS}) |
| 59 | link_directories(${LOGGING_LIBRARY_DIRS}) |
| 60 | |
| 61 | # phosphor-dbus-interfaces |
| 62 | find_package(PkgConfig REQUIRED) |
| 63 | pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) |
| 64 | include_directories(${DBUSINTERFACE_INCLUDE_DIRS}) |
| 65 | link_directories(${DBUSINTERFACE_LIBRARY_DIRS}) |
| 66 | |
| 67 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 68 | target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES} |
| 69 | chassisgpio ) |
| 70 | target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs -lphosphor_dbus") |
| 71 | |
| 72 | install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
Kuiying Wang | c8153bc | 2018-11-09 16:34:33 +0800 | [diff] [blame] | 73 | install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |
| 74 | |