blob: 3503c7fee115498829a7af5ff2d696979f4364f6 [file] [log] [blame]
Cheng C Yangeecaf822019-12-19 00:34:23 +08001cmake_minimum_required (VERSION 3.2 FATAL_ERROR)
2include (ExternalProject)
3set (CMAKE_CXX_STANDARD 17)
4set (CMAKE_CXX_STANDARD_REQUIRED ON)
5set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
6set (DBUS_OBJECT_NAME "xyz/openbmc_project/Smbios/MDR_V2")
7set (DBUS_INTF_NAME "xyz.openbmc_project.Smbios.MDR_V2")
8
9set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
10
11include_directories (
12 ${CMAKE_CURRENT_SOURCE_DIR}/include/phosphor-dbus-interfaces
13)
14include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
15link_directories (${DBUSINTERFACE_LIBRARIES})
16
17find_package (PkgConfig REQUIRED)
18pkg_check_modules (SYSTEMD libsystemd REQUIRED)
19include_directories (${SYSTEMD_INCLUDE_DIRS})
20link_directories (${SYSTEMD_LIBRARY_DIRS})
21
22# import sdbusplus
23find_package (PkgConfig REQUIRED)
24pkg_check_modules (SDBUSPLUSPLUS sdbusplus REQUIRED)
25include_directories (${SDBUSPLUSPLUS_INCLUDE_DIRS})
26link_directories (${SDBUSPLUSPLUS_LIBRARY_DIRS})
27
28# phosphor-dbus-interfaces
29find_package (PkgConfig REQUIRED)
30pkg_check_modules (DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
31include_directories (${DBUSINTERFACE_INCLUDE_DIRS})
32link_directories (${DBUSINTERFACE_LIBRARY_DIRS})
33
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080034set (SRC_FILES src/mdrv2.cpp src/mdrv2_main.cpp src/cpu.cpp src/dimm.cpp
35 src/system.cpp)
Cheng C Yangeecaf822019-12-19 00:34:23 +080036
37include_directories (${CMAKE_CURRENT_BINARY_DIR})
38
39find_package (PkgConfig REQUIRED)
40pkg_check_modules (SDBUSPLUSPLUS sdbusplus REQUIRED)
41include_directories (${SDBUSPLUSPLUS_INCLUDE_DIRS})
42link_directories (${SDBUSPLUSPLUS_LIBRARY_DIRS})
43find_program (SDBUSPLUSPLUS sdbus++)
44
45add_executable (smbiosmdrv2app ${SRC_FILES})
46target_link_libraries (smbiosmdrv2app ${SYSTEMD_LIBRARIES})
47target_link_libraries (smbiosmdrv2app ${DBUSINTERFACE_LIBRARIES})
48target_link_libraries (smbiosmdrv2app ${SDBUSPLUSPLUS_LIBRARIES})
49target_link_libraries (smbiosmdrv2app phosphor_logging)
50
51install (TARGETS smbiosmdrv2app DESTINATION bin)