Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 1 | cmake_minimum_required (VERSION 3.5 FATAL_ERROR) |
| 2 | |
| 3 | cmake_policy (SET CMP0054 NEW) |
| 4 | |
| 5 | option (YOCTO "Use YOCTO depedencies system" OFF) |
| 6 | include (ExternalProject) |
| 7 | set (CMAKE_CXX_STANDARD 17) |
| 8 | set (CMAKE_CXX_STANDARD_REQUIRED ON) |
| 9 | set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) |
| 10 | |
| 11 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 12 | |
| 13 | project (fb-ipmi-oem CXX) |
| 14 | |
| 15 | add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 16 | add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) |
| 17 | add_definitions (-DBOOST_ALL_NO_LIB) |
| 18 | add_definitions (-DBOOST_NO_RTTI) |
| 19 | add_definitions (-DBOOST_NO_TYPEID) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 20 | add_definitions (-DBOOST_ASIO_DISABLE_THREADS) |
| 21 | add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING) |
| 22 | add_definitions (-Wno-psabi) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 23 | |
| 24 | if (NOT YOCTO) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 25 | include_directories (SYSTEM non-yocto) |
| 26 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 27 | configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt) |
| 28 | execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
| 29 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty) |
| 30 | execute_process (COMMAND ${CMAKE_COMMAND} --build . |
| 31 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty) |
| 32 | |
| 33 | set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH}) |
| 34 | include_directories (${CMAKE_BINARY_DIR}/prefix/include) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 35 | link_directories (${CMAKE_BINARY_DIR}/prefix/lib) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 36 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 37 | include_directories (${CMAKE_BINARY_DIR}/sdbusplus-src) |
| 38 | link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs) |
| 39 | include_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src) |
| 40 | link_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src/.libs) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 41 | include_directories (SYSTEM ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include) |
| 42 | include_directories (SYSTEM ${CMAKE_BINARY_DIR}/ipmid/user_channel) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 43 | |
| 44 | include_directories (${CMAKE_BINARY_DIR}) # link_directories |
| 45 | # (${CMAKE_BINARY_DIR}/sdbusplus- |
| 46 | # src/.libs) |
| 47 | endif () |
| 48 | |
| 49 | if (YOCTO) |
| 50 | find_package (PkgConfig REQUIRED) |
| 51 | pkg_check_modules (LOGGING phosphor-logging REQUIRED) |
| 52 | include_directories (${LOGGING_INCLUDE_DIRS}) |
| 53 | link_directories (${LOGGING_LIBRARY_DIRS}) |
| 54 | |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 55 | pkg_check_modules (LIBIPMID libipmid REQUIRED) |
| 56 | include_directories (SYSTEM ${LIBIPMID_INCLUDE_DIRS}) |
| 57 | link_directories (${LIBIPMID_LIBRARY_DIRS}) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 58 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 59 | endif () |
| 60 | |
| 61 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 62 | |
| 63 | add_library (zfboemcmds |
Vijay Khemka | a2d52f1 | 2019-03-27 14:54:00 -0700 | [diff] [blame] | 64 | SHARED src/oemcommands.cpp src/appcommands.cpp |
Vijay Khemka | 1744cb3 | 2019-04-10 14:54:09 -0700 | [diff] [blame] | 65 | src/storagecommands.cpp src/usb-dbg.cpp |
Vijay Khemka | 11b9c3b | 2019-08-21 15:21:42 -0700 | [diff] [blame] | 66 | src/selcommands.cpp src/transportcommands.cpp) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 67 | set_target_properties (zfboemcmds PROPERTIES VERSION "0.1.0") |
| 68 | set_target_properties (zfboemcmds PROPERTIES SOVERSION "0") |
| 69 | target_link_libraries (zfboemcmds sdbusplus) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 70 | target_link_libraries (zfboemcmds ipmid) |
| 71 | target_link_libraries (zfboemcmds -luserlayer) |
| 72 | target_link_libraries (zfboemcmds -lchannellayer) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 73 | target_link_libraries (zfboemcmds ${CMAKE_THREAD_LIBS_INIT}) |
| 74 | target_link_libraries (zfboemcmds phosphor_logging) |
| 75 | |
Vijay Khemka | cc0d6d9 | 2019-08-27 14:51:17 -0700 | [diff] [blame^] | 76 | set (PACKAGE_DIR /usr/share/ipmi-providers/) |
| 77 | set (CONFIG_FILES post_desc.json) |
| 78 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 79 | install (TARGETS zfboemcmds DESTINATION lib/ipmid-providers) |
Vijay Khemka | cc0d6d9 | 2019-08-27 14:51:17 -0700 | [diff] [blame^] | 80 | install (FILES ${CONFIG_FILES} DESTINATION ${PACKAGE_DIR}) |