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