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