Richard Marian Thomaiyar | 7a36277 | 2019-06-16 19:11:35 +0530 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.5 FATAL_ERROR) |
| 2 | project(phosphor-u-boot-env-mgr CXX) |
Vernon Mauery | 6b88835 | 2022-09-29 14:26:15 -0700 | [diff] [blame^] | 3 | set(CMAKE_CXX_STANDARD 20) |
Richard Marian Thomaiyar | 7a36277 | 2019-06-16 19:11:35 +0530 | [diff] [blame] | 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 6 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") |
| 7 | |
| 8 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 9 | find_package(Boost REQUIRED) |
| 10 | include_directories(${Boost_INCLUDE_DIRS}) |
| 11 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 12 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 13 | add_definitions(-DBOOST_ALL_NO_LIB) |
| 14 | add_definitions(-DBOOST_NO_RTTI) |
| 15 | add_definitions(-DBOOST_NO_TYPEID) |
| 16 | add_definitions(-DBOOST_ASIO_DISABLE_THREADS) |
| 17 | |
| 18 | set(SRC_FILES src/mainapp.cpp src/u-boot-env-mgr.cpp) |
| 19 | |
| 20 | # import sdbusplus |
| 21 | find_package(PkgConfig REQUIRED) |
| 22 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) |
| 23 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) |
| 24 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) |
| 25 | find_program(SDBUSPLUSPLUS sdbus++) |
| 26 | |
| 27 | # phosphor-dbus-interfaces |
| 28 | find_package(PkgConfig REQUIRED) |
| 29 | pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) |
| 30 | include_directories(${DBUSINTERFACE_INCLUDE_DIRS}) |
| 31 | link_directories(${DBUSINTERFACE_LIBRARY_DIRS}) |
| 32 | |
| 33 | # import phosphor-logging |
| 34 | find_package(PkgConfig REQUIRED) |
| 35 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) |
| 36 | include_directories(${LOGGING_INCLUDE_DIRS}) |
| 37 | link_directories(${LOGGING_LIBRARY_DIRS}) |
| 38 | |
| 39 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 40 | target_link_libraries(${PROJECT_NAME} ${SDBUSPLUSPLUS_LIBRARIES}) |
| 41 | target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES}) |
| 42 | target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) |
| 43 | target_link_libraries(${PROJECT_NAME} phosphor_logging) |
| 44 | |
| 45 | set(SERVICE_FILES |
| 46 | ${PROJECT_SOURCE_DIR}/xyz.openbmc_project.U_Boot.Environment.Manager.service |
| 47 | ) |
| 48 | |
| 49 | install(TARGETS ${PROJECT_NAME} DESTINATION bin) |
| 50 | install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |
| 51 | |