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) |
Alan Kuo | 0171dd6 | 2021-04-15 10:47:32 +0800 | [diff] [blame] | 3 | option ( |
| 4 | ENABLE_BIOS_POST_CODE_LOG |
| 5 | "Enable Bios Post Code Logging" |
| 6 | OFF |
| 7 | ) |
Kuiying Wang | 3a04440 | 2019-02-19 15:00:11 +0800 | [diff] [blame] | 8 | set(CMAKE_CXX_STANDARD 17) |
| 9 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 10 | |
| 11 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 12 | include(GNUInstallDirs) |
| 13 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) |
| 14 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
| 15 | |
Jonathan Doman | 08125ca | 2021-01-07 17:49:15 -0800 | [diff] [blame] | 16 | set(DBUS_OBJECT_NAME "xyz/openbmc_project/State/Boot/PostCode0") |
Kuiying Wang | 3a04440 | 2019-02-19 15:00:11 +0800 | [diff] [blame] | 17 | set(DBUS_INTF_NAME "xyz.openbmc_project.State.Boot.PostCode") |
| 18 | |
| 19 | add_definitions(-DDBUS_OBJECT_NAME="/${DBUS_OBJECT_NAME}") |
| 20 | add_definitions(-DDBUS_INTF_NAME="${DBUS_INTF_NAME}") |
| 21 | set(SRC_FILES src/post_code.cpp |
| 22 | src/main.cpp ) |
| 23 | set ( SERVICE_FILES |
Kumar Thangavel | fd45f78 | 2020-09-01 22:59:00 +0530 | [diff] [blame] | 24 | service_files/xyz.openbmc_project.State.Boot.PostCode.service |
| 25 | service_files/xyz.openbmc_project.State.Boot.PostCode@.service ) |
Kuiying Wang | 3a04440 | 2019-02-19 15:00:11 +0800 | [diff] [blame] | 26 | |
| 27 | # import sdbusplus |
| 28 | find_package(PkgConfig REQUIRED) |
| 29 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) |
| 30 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) |
| 31 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) |
| 32 | find_program(SDBUSPLUSPLUS sdbus++) |
| 33 | |
| 34 | # import phosphor-logging |
| 35 | find_package(PkgConfig REQUIRED) |
| 36 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) |
| 37 | include_directories(${LOGGING_INCLUDE_DIRS}) |
| 38 | link_directories(${LOGGING_LIBRARY_DIRS}) |
| 39 | |
| 40 | # phosphor-dbus-interfaces |
| 41 | find_package(PkgConfig REQUIRED) |
| 42 | pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) |
| 43 | include_directories(${DBUSINTERFACE_INCLUDE_DIRS}) |
| 44 | link_directories(${DBUSINTERFACE_LIBRARY_DIRS}) |
| 45 | |
| 46 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 47 | target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES} ) |
| 48 | target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs -lphosphor_dbus") |
| 49 | |
| 50 | install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
Alan Kuo | 0171dd6 | 2021-04-15 10:47:32 +0800 | [diff] [blame] | 51 | target_compile_definitions ( |
| 52 | ${PROJECT_NAME} PRIVATE $<$<BOOL:${ENABLE_BIOS_POST_CODE_LOG}>: -DENABLE_BIOS_POST_CODE_LOG> |
| 53 | ) |
Kumar Thangavel | fd45f78 | 2020-09-01 22:59:00 +0530 | [diff] [blame] | 54 | install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |