AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.5 FATAL_ERROR) |
AppaRao Puli | dcf1312 | 2020-05-28 01:21:39 +0530 | [diff] [blame] | 2 | project(pfr-manager CXX) |
AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 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) |
Chalapathi Venkataramashetty | 53b8700 | 2020-07-03 09:52:44 +0000 | [diff] [blame] | 49 | target_link_libraries(${PROJECT_NAME} gpiodcxx) |
AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 50 | |
| 51 | install(TARGETS ${PROJECT_NAME} DESTINATION bin) |