blob: b01f6cb56506da5416cd8985b9543044c5da6abd [file] [log] [blame]
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
2
3cmake_policy (SET CMP0054 NEW)
4
5option (YOCTO "Use YOCTO depedencies system" OFF)
6include (ExternalProject)
7set (CMAKE_CXX_STANDARD 17)
8set (CMAKE_CXX_STANDARD_REQUIRED ON)
9set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
10
Jayashree-D0c810ef2020-12-10 11:42:59 +053011# Temporarily disable rtti
12#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
Vijay Khemkae7d23d02019-03-08 13:13:40 -080013
14project (fb-ipmi-oem CXX)
15
16add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)
17add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED)
18add_definitions (-DBOOST_ALL_NO_LIB)
19add_definitions (-DBOOST_NO_RTTI)
20add_definitions (-DBOOST_NO_TYPEID)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070021add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
22add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
23add_definitions (-Wno-psabi)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080024
25if (NOT YOCTO)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070026 include_directories (SYSTEM non-yocto)
27
Vijay Khemkae7d23d02019-03-08 13:13:40 -080028 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 Khemka1ac0b6b2019-08-21 15:02:42 -070036 link_directories (${CMAKE_BINARY_DIR}/prefix/lib)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080037
Vijay Khemkae7d23d02019-03-08 13:13:40 -080038 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 Khemka1ac0b6b2019-08-21 15:02:42 -070042 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include)
43 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/ipmid/user_channel)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080044
45 include_directories (${CMAKE_BINARY_DIR}) # link_directories
46 # (${CMAKE_BINARY_DIR}/sdbusplus-
47 # src/.libs)
48endif ()
49
50if (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 Khemka1ac0b6b2019-08-21 15:02:42 -070056 pkg_check_modules (LIBIPMID libipmid REQUIRED)
57 include_directories (SYSTEM ${LIBIPMID_INCLUDE_DIRS})
58 link_directories (${LIBIPMID_LIBRARY_DIRS})
Vijay Khemkae7d23d02019-03-08 13:13:40 -080059
Vijay Khemkae7d23d02019-03-08 13:13:40 -080060endif ()
61
62include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
63
Kumar Thangavel41ad4ff2020-06-11 10:31:07 +053064SET(bicFile "")
65
66if(BIC)
67 SET(bicFile "src/biccommands.cpp")
68endif()
69
Vijay Khemkae7d23d02019-03-08 13:13:40 -080070add_library (zfboemcmds
Vijay Khemkaa2d52f12019-03-27 14:54:00 -070071 SHARED src/oemcommands.cpp src/appcommands.cpp
Vijay Khemka1744cb32019-04-10 14:54:09 -070072 src/storagecommands.cpp src/usb-dbg.cpp
Kumar Thangavel41ad4ff2020-06-11 10:31:07 +053073 src/selcommands.cpp src/transportcommands.cpp ${bicFile})
74
Vijay Khemkae7d23d02019-03-08 13:13:40 -080075set_target_properties (zfboemcmds PROPERTIES VERSION "0.1.0")
76set_target_properties (zfboemcmds PROPERTIES SOVERSION "0")
77target_link_libraries (zfboemcmds sdbusplus)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070078target_link_libraries (zfboemcmds ipmid)
79target_link_libraries (zfboemcmds -luserlayer)
80target_link_libraries (zfboemcmds -lchannellayer)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080081target_link_libraries (zfboemcmds ${CMAKE_THREAD_LIBS_INIT})
82target_link_libraries (zfboemcmds phosphor_logging)
83
Vijay Khemka11b33a02019-12-13 12:04:20 -080084set (PACKAGE_DIR /usr/share/lcd-debug/)
Vijay Khemka427b2762019-12-12 12:49:25 -080085set (CONFIG_FILES post_desc.json gpio_desc.json cri_sensors.json)
Vijay Khemkacc0d6d92019-08-27 14:51:17 -070086
Vijay Khemkae7d23d02019-03-08 13:13:40 -080087install (TARGETS zfboemcmds DESTINATION lib/ipmid-providers)
Vijay Khemkacc0d6d92019-08-27 14:51:17 -070088install (FILES ${CONFIG_FILES} DESTINATION ${PACKAGE_DIR})
Manikandan Elumalai63227df2020-12-02 04:58:12 +053089
90if(BIC)
91set (CONFIG_FILES_YV2 yosemitev2/gpio_desc.json)
92install (FILES ${CONFIG_FILES_YV2} DESTINATION ${PACKAGE_DIR})
93endif()