blob: 4cf015b5d39af587cba829f534a9a999872e258a [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
6add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
7add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
8add_definitions(-DBOOST_ALL_NO_LIB)
9add_definitions(-DBOOST_NO_RTTI)
10add_definitions(-DBOOST_NO_TYPEID)
11add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
12
13set(SRC_FILES src/power_control.cpp)
14
15add_executable(${PROJECT_NAME} ${SRC_FILES})
16target_link_libraries(${PROJECT_NAME} -lstdc++fs)
17target_link_libraries(${PROJECT_NAME} chassisi2c)
18target_link_libraries(${PROJECT_NAME} i2c)
19target_link_libraries(${PROJECT_NAME} gpiodcxx)
20target_link_libraries(${PROJECT_NAME} systemd)
21target_link_libraries(${PROJECT_NAME} sdbusplus)
22
23install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
24
25set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
26set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
27
28set(
29 SERVICE_FILES
Vijay Khemkab0c613a2020-05-06 11:11:04 -070030 ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.service
31 ${PROJECT_SOURCE_DIR}/service_files/chassis-system-reset.target
Ed Tanousf61ca6f2019-08-15 15:09:05 -070032 ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.Chassis.Control.Power.service
33 )
Priyatharshan Pe4d7f2b2020-06-22 22:41:42 +053034
35set(
36 CONFIG_FILE
37 ${PROJECT_SOURCE_DIR}/config/power-config-host0.json
38 )
39
Ed Tanousf61ca6f2019-08-15 15:09:05 -070040install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
Priyatharshan Pe4d7f2b2020-06-22 22:41:42 +053041install(FILES ${CONFIG_FILE} DESTINATION /usr/share/power-control/)