Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.6) |
| 2 | project(libpeci) |
| 3 | |
| 4 | add_library(peci SHARED peci.c) |
| 5 | |
| 6 | set_property(TARGET peci PROPERTY C_STANDARD 99) |
| 7 | target_include_directories(peci PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
| 8 | set_target_properties(peci PROPERTIES VERSION "1.0" SOVERSION "1") |
| 9 | |
Jason M. Bills | bdefaa3 | 2021-11-12 14:09:20 -0800 | [diff] [blame] | 10 | option(DBUS_RAW_PECI "Add the raw PECI D-Bus daemon to the build." OFF) |
| 11 | |
Jason M. Bills | 7ef5a55 | 2020-04-06 14:58:44 -0700 | [diff] [blame] | 12 | set( |
| 13 | CMAKE_C_FLAGS |
| 14 | "${CMAKE_C_FLAGS} \ |
| 15 | -Wall \ |
| 16 | -Wextra \ |
| 17 | -Wcast-align \ |
| 18 | -Wunused \ |
| 19 | -Wconversion \ |
| 20 | -Wsign-conversion \ |
| 21 | -Wnull-dereference \ |
| 22 | -Wdouble-promotion \ |
| 23 | -Wformat=2 \ |
| 24 | -Wno-unused-parameter \ |
| 25 | -Werror \ |
| 26 | -Wduplicated-cond \ |
| 27 | -Wduplicated-branches \ |
| 28 | -Wlogical-op \ |
| 29 | " |
| 30 | ) |
| 31 | |
| 32 | install(TARGETS peci DESTINATION lib) |
| 33 | install(FILES peci.h DESTINATION include) |
| 34 | |
| 35 | add_executable(peci_cmds peci_cmds.c) |
| 36 | add_dependencies(peci_cmds peci) |
| 37 | target_link_libraries(peci_cmds peci) |
| 38 | |
| 39 | install(TARGETS peci_cmds |
| 40 | RUNTIME DESTINATION bin |
| 41 | LIBRARY DESTINATION lib |
| 42 | ARCHIVE DESTINATION lib/static) |
Jason M. Bills | bdefaa3 | 2021-11-12 14:09:20 -0800 | [diff] [blame] | 43 | |
| 44 | if(${DBUS_RAW_PECI}) |
| 45 | add_executable(raw-peci dbus_raw_peci.cpp) |
| 46 | add_dependencies(raw-peci peci) |
| 47 | |
| 48 | find_package(Boost 1.73 REQUIRED) |
| 49 | include_directories(${BOOST_SRC_DIR}) |
| 50 | |
| 51 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 52 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 53 | add_definitions(-DBOOST_ALL_NO_LIB) |
| 54 | add_definitions(-DBOOST_NO_RTTI) |
| 55 | add_definitions(-DBOOST_NO_TYPEID) |
| 56 | |
| 57 | target_link_libraries(raw-peci peci -lsystemd sdbusplus) |
| 58 | |
| 59 | install(TARGETS raw-peci |
| 60 | RUNTIME DESTINATION bin |
| 61 | LIBRARY DESTINATION lib |
| 62 | ARCHIVE DESTINATION lib/static) |
| 63 | |
| 64 | set(SERVICE_FILES ${PROJECT_SOURCE_DIR}/service_files/com.intel.peci.service) |
| 65 | |
| 66 | install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/) |
| 67 | endif() |