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) |
Chalapathi Venkataramashetty | ffc5538 | 2021-02-03 10:12:35 +0000 | [diff] [blame^] | 5 | # Temporarily disable rtti |
| 6 | # See https://github.com/chriskohlhoff/asio/issues/533 |
| 7 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 8 | |
| 9 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 10 | |
| 11 | include(GNUInstallDirs) |
| 12 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) |
| 13 | |
| 14 | set(SRC_FILES src/mainapp.cpp src/pfr_mgr.cpp) |
| 15 | |
| 16 | find_package(Boost REQUIRED) |
| 17 | include_directories(${Boost_INCLUDE_DIRS}) |
| 18 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 19 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 20 | add_definitions(-DBOOST_ALL_NO_LIB) |
| 21 | add_definitions(-DBOOST_NO_RTTI) |
| 22 | add_definitions(-DBOOST_NO_TYPEID) |
| 23 | add_definitions(-DBOOST_ASIO_DISABLE_THREADS) |
| 24 | |
| 25 | # import libsystemd |
| 26 | find_package(PkgConfig REQUIRED) |
| 27 | pkg_check_modules(SYSTEMD libsystemd REQUIRED) |
| 28 | include_directories(${SYSTEMD_INCLUDE_DIRS}) |
| 29 | link_directories(${SYSTEMD_LIBRARY_DIRS}) |
| 30 | |
| 31 | # import sdbusplus |
| 32 | find_package(PkgConfig REQUIRED) |
| 33 | pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED) |
| 34 | include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS}) |
| 35 | link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS}) |
| 36 | find_program(SDBUSPLUSPLUS sdbus++) |
| 37 | |
| 38 | # import phosphor-logging |
| 39 | find_package(PkgConfig REQUIRED) |
| 40 | pkg_check_modules(LOGGING phosphor-logging REQUIRED) |
| 41 | include_directories(${LOGGING_INCLUDE_DIRS}) |
| 42 | link_directories(${LOGGING_LIBRARY_DIRS}) |
| 43 | |
| 44 | add_executable(${PROJECT_NAME} ${SRC_FILES}) |
| 45 | target_link_libraries(${PROJECT_NAME} systemd) |
| 46 | target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs") |
| 47 | target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) |
| 48 | target_link_libraries(${PROJECT_NAME} phosphor_logging) |
| 49 | target_link_libraries(${PROJECT_NAME} pfr) |
| 50 | target_link_libraries(${PROJECT_NAME} i2c) |
Chalapathi Venkataramashetty | 53b8700 | 2020-07-03 09:52:44 +0000 | [diff] [blame] | 51 | target_link_libraries(${PROJECT_NAME} gpiodcxx) |
AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 52 | |
| 53 | install(TARGETS ${PROJECT_NAME} DESTINATION bin) |