| Kuiying Wang | 3a04440 | 2019-02-19 15:00:11 +0800 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) | 
|  | 2 | project(post-code-manager CXX) | 
|  | 3 | set(CMAKE_CXX_STANDARD 17) | 
|  | 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | 
|  | 5 |  | 
|  | 6 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | 
|  | 7 | include(GNUInstallDirs) | 
|  | 8 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) | 
|  | 9 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | 
|  | 10 |  | 
|  | 11 | set(DBUS_OBJECT_NAME "xyz/openbmc_project/State/Boot/PostCode") | 
|  | 12 | set(DBUS_INTF_NAME "xyz.openbmc_project.State.Boot.PostCode") | 
|  | 13 |  | 
|  | 14 | add_definitions(-DDBUS_OBJECT_NAME="/${DBUS_OBJECT_NAME}") | 
|  | 15 | add_definitions(-DDBUS_INTF_NAME="${DBUS_INTF_NAME}") | 
|  | 16 | set(SRC_FILES src/post_code.cpp | 
|  | 17 | src/main.cpp ) | 
|  | 18 | set ( SERVICE_FILES | 
| Kumar Thangavel | fd45f78 | 2020-09-01 22:59:00 +0530 | [diff] [blame^] | 19 | service_files/xyz.openbmc_project.State.Boot.PostCode.service | 
|  | 20 | service_files/xyz.openbmc_project.State.Boot.PostCode@.service ) | 
| Kuiying Wang | 3a04440 | 2019-02-19 15:00:11 +0800 | [diff] [blame] | 21 |  | 
|  | 22 | # import sdbusplus | 
|  | 23 | find_package(PkgConfig REQUIRED) | 
|  | 24 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) | 
|  | 25 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) | 
|  | 26 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) | 
|  | 27 | find_program(SDBUSPLUSPLUS sdbus++) | 
|  | 28 |  | 
|  | 29 | # import phosphor-logging | 
|  | 30 | find_package(PkgConfig REQUIRED) | 
|  | 31 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) | 
|  | 32 | include_directories(${LOGGING_INCLUDE_DIRS}) | 
|  | 33 | link_directories(${LOGGING_LIBRARY_DIRS}) | 
|  | 34 |  | 
|  | 35 | # phosphor-dbus-interfaces | 
|  | 36 | find_package(PkgConfig REQUIRED) | 
|  | 37 | pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) | 
|  | 38 | include_directories(${DBUSINTERFACE_INCLUDE_DIRS}) | 
|  | 39 | link_directories(${DBUSINTERFACE_LIBRARY_DIRS}) | 
|  | 40 |  | 
|  | 41 | add_executable(${PROJECT_NAME} ${SRC_FILES}) | 
|  | 42 | target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES} ) | 
|  | 43 | target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs -lphosphor_dbus") | 
|  | 44 |  | 
|  | 45 | install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) | 
| Kumar Thangavel | fd45f78 | 2020-09-01 22:59:00 +0530 | [diff] [blame^] | 46 | install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |