AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame^] | 1 | cmake_minimum_required(VERSION 3.5 FATAL_ERROR) |
| 2 | project(intel-pfr-manager CXX) |
| 3 | set(CMAKE_CXX_STANDARD 17) |
| 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 6 | |
| 7 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 8 | |
| 9 | include(GNUInstallDirs) |
| 10 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) |
| 11 | |
| 12 | set(SRC_FILES src/mainapp.cpp src/pfr_mgr.cpp) |
| 13 | |
| 14 | find_package(Boost REQUIRED) |
| 15 | include_directories(${Boost_INCLUDE_DIRS}) |
| 16 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 17 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 18 | add_definitions(-DBOOST_ALL_NO_LIB) |
| 19 | add_definitions(-DBOOST_NO_RTTI) |
| 20 | add_definitions(-DBOOST_NO_TYPEID) |
| 21 | add_definitions(-DBOOST_ASIO_DISABLE_THREADS) |
| 22 | |
| 23 | # import libsystemd |
| 24 | find_package(PkgConfig REQUIRED) |
| 25 | pkg_check_modules(SYSTEMD libsystemd REQUIRED) |
| 26 | include_directories(${SYSTEMD_INCLUDE_DIRS}) |
| 27 | link_directories(${SYSTEMD_LIBRARY_DIRS}) |
| 28 | |
| 29 | # import sdbusplus |
| 30 | find_package(PkgConfig REQUIRED) |
| 31 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) |
| 32 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) |
| 33 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) |
| 34 | find_program(SDBUSPLUSPLUS sdbus++) |
| 35 | |
| 36 | # import phosphor-logging |
| 37 | find_package(PkgConfig REQUIRED) |
| 38 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) |
| 39 | include_directories(${LOGGING_INCLUDE_DIRS}) |
| 40 | link_directories(${LOGGING_LIBRARY_DIRS}) |
| 41 | |
| 42 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 43 | target_link_libraries(${PROJECT_NAME} systemd) |
| 44 | target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs") |
| 45 | target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) |
| 46 | target_link_libraries(${PROJECT_NAME} phosphor_logging) |
| 47 | target_link_libraries(${PROJECT_NAME} pfr) |
| 48 | target_link_libraries(${PROJECT_NAME} i2c) |
| 49 | |
| 50 | install(TARGETS ${PROJECT_NAME} DESTINATION bin) |