blob: a3a15a2710fe15ed7f44fc2280125630dc7afe71 [file] [log] [blame]
AppaRao Pulie63eeda2019-07-05 16:25:38 +05301cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
AppaRao Pulidcf13122020-05-28 01:21:39 +05302project(pfr-manager CXX)
AppaRao Pulie63eeda2019-07-05 16:25:38 +05303set(CMAKE_CXX_STANDARD 17)
4set(CMAKE_CXX_STANDARD_REQUIRED ON)
Chalapathi Venkataramashettyffc55382021-02-03 10:12:35 +00005# Temporarily disable rtti
6# See https://github.com/chriskohlhoff/asio/issues/533
7#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
AppaRao Pulie63eeda2019-07-05 16:25:38 +05308
9set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
10
11include(GNUInstallDirs)
12include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
13
14set(SRC_FILES src/mainapp.cpp src/pfr_mgr.cpp)
15
16find_package(Boost REQUIRED)
17include_directories(${Boost_INCLUDE_DIRS})
18add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
19add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
20add_definitions(-DBOOST_ALL_NO_LIB)
21add_definitions(-DBOOST_NO_RTTI)
22add_definitions(-DBOOST_NO_TYPEID)
23add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
24
25# import libsystemd
26find_package(PkgConfig REQUIRED)
27pkg_check_modules(SYSTEMD libsystemd REQUIRED)
28include_directories(${SYSTEMD_INCLUDE_DIRS})
29link_directories(${SYSTEMD_LIBRARY_DIRS})
30
31# import sdbusplus
32find_package(PkgConfig REQUIRED)
33pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
34include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
35link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
36find_program(SDBUSPLUSPLUS sdbus++)
37
38# import phosphor-logging
39find_package(PkgConfig REQUIRED)
40pkg_check_modules(LOGGING phosphor-logging REQUIRED)
41include_directories(${LOGGING_INCLUDE_DIRS})
42link_directories(${LOGGING_LIBRARY_DIRS})
43
44add_executable(${PROJECT_NAME} ${SRC_FILES})
45target_link_libraries(${PROJECT_NAME} systemd)
46target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs")
47target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
48target_link_libraries(${PROJECT_NAME} phosphor_logging)
49target_link_libraries(${PROJECT_NAME} pfr)
50target_link_libraries(${PROJECT_NAME} i2c)
Chalapathi Venkataramashetty53b87002020-07-03 09:52:44 +000051target_link_libraries(${PROJECT_NAME} gpiodcxx)
AppaRao Pulie63eeda2019-07-05 16:25:38 +053052
53install(TARGETS ${PROJECT_NAME} DESTINATION bin)