blob: c8146b00605879b11cf9e01ca25e8c32a383cb49 [file] [log] [blame]
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +05301cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
2project(phosphor-u-boot-env-mgr CXX)
Vernon Mauery6b888352022-09-29 14:26:15 -07003set(CMAKE_CXX_STANDARD 20)
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +05304set(CMAKE_CXX_STANDARD_REQUIRED ON)
5set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
6set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
7
8include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
9find_package(Boost REQUIRED)
10include_directories(${Boost_INCLUDE_DIRS})
11add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
12add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
13add_definitions(-DBOOST_ALL_NO_LIB)
14add_definitions(-DBOOST_NO_RTTI)
15add_definitions(-DBOOST_NO_TYPEID)
16add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
17
18set(SRC_FILES src/mainapp.cpp src/u-boot-env-mgr.cpp)
19
20# import sdbusplus
21find_package(PkgConfig REQUIRED)
22pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
23include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
24link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
25find_program(SDBUSPLUSPLUS sdbus++)
26
27# phosphor-dbus-interfaces
28find_package(PkgConfig REQUIRED)
29pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
30include_directories(${DBUSINTERFACE_INCLUDE_DIRS})
31link_directories(${DBUSINTERFACE_LIBRARY_DIRS})
32
33# import phosphor-logging
34find_package(PkgConfig REQUIRED)
35pkg_check_modules(LOGGING phosphor-logging REQUIRED)
36include_directories(${LOGGING_INCLUDE_DIRS})
37link_directories(${LOGGING_LIBRARY_DIRS})
38
39add_executable(${PROJECT_NAME} ${SRC_FILES})
40target_link_libraries(${PROJECT_NAME} ${SDBUSPLUSPLUS_LIBRARIES})
41target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES})
42target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
43target_link_libraries(${PROJECT_NAME} phosphor_logging)
44
Jason M. Billse48c5d32023-06-28 14:33:38 -070045pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
46
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +053047set(SERVICE_FILES
48 ${PROJECT_SOURCE_DIR}/xyz.openbmc_project.U_Boot.Environment.Manager.service
49 )
50
51install(TARGETS ${PROJECT_NAME} DESTINATION bin)
Jason M. Billse48c5d32023-06-28 14:33:38 -070052install(FILES ${SERVICE_FILES} DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}")
Richard Marian Thomaiyar7a362772019-06-16 19:11:35 +053053