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 | |
Jayashree-D | 0c810ef | 2020-12-10 11:42:59 +0530 | [diff] [blame] | 11 | # Temporarily disable rtti |
| 12 | #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 13 | |
| 14 | project (fb-ipmi-oem CXX) |
| 15 | |
| 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) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 21 | add_definitions (-DBOOST_ASIO_DISABLE_THREADS) |
| 22 | add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING) |
| 23 | add_definitions (-Wno-psabi) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 24 | |
| 25 | if (NOT YOCTO) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 26 | include_directories (SYSTEM non-yocto) |
| 27 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 28 | configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt) |
| 29 | execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
| 30 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty) |
| 31 | execute_process (COMMAND ${CMAKE_COMMAND} --build . |
| 32 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty) |
| 33 | |
| 34 | set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH}) |
| 35 | include_directories (${CMAKE_BINARY_DIR}/prefix/include) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 36 | link_directories (${CMAKE_BINARY_DIR}/prefix/lib) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 37 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 38 | include_directories (${CMAKE_BINARY_DIR}/sdbusplus-src) |
| 39 | link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs) |
| 40 | include_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src) |
| 41 | link_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src/.libs) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 42 | include_directories (SYSTEM ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include) |
| 43 | include_directories (SYSTEM ${CMAKE_BINARY_DIR}/ipmid/user_channel) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 44 | |
| 45 | include_directories (${CMAKE_BINARY_DIR}) # link_directories |
| 46 | # (${CMAKE_BINARY_DIR}/sdbusplus- |
| 47 | # src/.libs) |
| 48 | endif () |
| 49 | |
| 50 | if (YOCTO) |
| 51 | find_package (PkgConfig REQUIRED) |
| 52 | pkg_check_modules (LOGGING phosphor-logging REQUIRED) |
| 53 | include_directories (${LOGGING_INCLUDE_DIRS}) |
| 54 | link_directories (${LOGGING_LIBRARY_DIRS}) |
| 55 | |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 56 | pkg_check_modules (LIBIPMID libipmid REQUIRED) |
| 57 | include_directories (SYSTEM ${LIBIPMID_INCLUDE_DIRS}) |
| 58 | link_directories (${LIBIPMID_LIBRARY_DIRS}) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 59 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 60 | endif () |
| 61 | |
| 62 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 63 | |
Kumar Thangavel | 41ad4ff | 2020-06-11 10:31:07 +0530 | [diff] [blame] | 64 | SET(bicFile "") |
| 65 | |
| 66 | if(BIC) |
| 67 | SET(bicFile "src/biccommands.cpp") |
| 68 | endif() |
| 69 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 70 | add_library (zfboemcmds |
Vijay Khemka | a2d52f1 | 2019-03-27 14:54:00 -0700 | [diff] [blame] | 71 | SHARED src/oemcommands.cpp src/appcommands.cpp |
Vijay Khemka | 1744cb3 | 2019-04-10 14:54:09 -0700 | [diff] [blame] | 72 | src/storagecommands.cpp src/usb-dbg.cpp |
Kumar Thangavel | 41ad4ff | 2020-06-11 10:31:07 +0530 | [diff] [blame] | 73 | src/selcommands.cpp src/transportcommands.cpp ${bicFile}) |
| 74 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 75 | set_target_properties (zfboemcmds PROPERTIES VERSION "0.1.0") |
| 76 | set_target_properties (zfboemcmds PROPERTIES SOVERSION "0") |
| 77 | target_link_libraries (zfboemcmds sdbusplus) |
Vijay Khemka | 1ac0b6b | 2019-08-21 15:02:42 -0700 | [diff] [blame] | 78 | target_link_libraries (zfboemcmds ipmid) |
| 79 | target_link_libraries (zfboemcmds -luserlayer) |
| 80 | target_link_libraries (zfboemcmds -lchannellayer) |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 81 | target_link_libraries (zfboemcmds ${CMAKE_THREAD_LIBS_INIT}) |
| 82 | target_link_libraries (zfboemcmds phosphor_logging) |
| 83 | |
Vijay Khemka | 11b33a0 | 2019-12-13 12:04:20 -0800 | [diff] [blame] | 84 | set (PACKAGE_DIR /usr/share/lcd-debug/) |
Vijay Khemka | 427b276 | 2019-12-12 12:49:25 -0800 | [diff] [blame] | 85 | set (CONFIG_FILES post_desc.json gpio_desc.json cri_sensors.json) |
Vijay Khemka | cc0d6d9 | 2019-08-27 14:51:17 -0700 | [diff] [blame] | 86 | |
Vijay Khemka | e7d23d0 | 2019-03-08 13:13:40 -0800 | [diff] [blame] | 87 | install (TARGETS zfboemcmds DESTINATION lib/ipmid-providers) |
Vijay Khemka | cc0d6d9 | 2019-08-27 14:51:17 -0700 | [diff] [blame] | 88 | install (FILES ${CONFIG_FILES} DESTINATION ${PACKAGE_DIR}) |
Manikandan Elumalai | 63227df | 2020-12-02 04:58:12 +0530 | [diff] [blame] | 89 | |
| 90 | if(BIC) |
| 91 | set (CONFIG_FILES_YV2 yosemitev2/gpio_desc.json) |
| 92 | install (FILES ${CONFIG_FILES_YV2} DESTINATION ${PACKAGE_DIR}) |
| 93 | endif() |