blob: d54c71d06dc271950405229ed7b457c39f84e130 [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
11set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
12
13project (fb-ipmi-oem CXX)
14
15add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)
16add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED)
17add_definitions (-DBOOST_ALL_NO_LIB)
18add_definitions (-DBOOST_NO_RTTI)
19add_definitions (-DBOOST_NO_TYPEID)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070020add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
21add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
22add_definitions (-Wno-psabi)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080023
24if (NOT YOCTO)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070025 include_directories (SYSTEM non-yocto)
26
Vijay Khemkae7d23d02019-03-08 13:13:40 -080027 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 Khemka1ac0b6b2019-08-21 15:02:42 -070035 link_directories (${CMAKE_BINARY_DIR}/prefix/lib)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080036
Vijay Khemkae7d23d02019-03-08 13:13:40 -080037 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 Khemka1ac0b6b2019-08-21 15:02:42 -070041 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include)
42 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/ipmid/user_channel)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080043
44 include_directories (${CMAKE_BINARY_DIR}) # link_directories
45 # (${CMAKE_BINARY_DIR}/sdbusplus-
46 # src/.libs)
47endif ()
48
49if (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 Khemka1ac0b6b2019-08-21 15:02:42 -070055 pkg_check_modules (LIBIPMID libipmid REQUIRED)
56 include_directories (SYSTEM ${LIBIPMID_INCLUDE_DIRS})
57 link_directories (${LIBIPMID_LIBRARY_DIRS})
Vijay Khemkae7d23d02019-03-08 13:13:40 -080058
Vijay Khemkae7d23d02019-03-08 13:13:40 -080059endif ()
60
61include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
62
63add_library (zfboemcmds
Vijay Khemkaa2d52f12019-03-27 14:54:00 -070064 SHARED src/oemcommands.cpp src/appcommands.cpp
Vijay Khemka1744cb32019-04-10 14:54:09 -070065 src/storagecommands.cpp src/usb-dbg.cpp
Vijay Khemka11b9c3b2019-08-21 15:21:42 -070066 src/selcommands.cpp src/transportcommands.cpp)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080067set_target_properties (zfboemcmds PROPERTIES VERSION "0.1.0")
68set_target_properties (zfboemcmds PROPERTIES SOVERSION "0")
69target_link_libraries (zfboemcmds sdbusplus)
Vijay Khemka1ac0b6b2019-08-21 15:02:42 -070070target_link_libraries (zfboemcmds ipmid)
71target_link_libraries (zfboemcmds -luserlayer)
72target_link_libraries (zfboemcmds -lchannellayer)
Vijay Khemkae7d23d02019-03-08 13:13:40 -080073target_link_libraries (zfboemcmds ${CMAKE_THREAD_LIBS_INIT})
74target_link_libraries (zfboemcmds phosphor_logging)
75
Vijay Khemkacc0d6d92019-08-27 14:51:17 -070076set (PACKAGE_DIR /usr/share/ipmi-providers/)
77set (CONFIG_FILES post_desc.json)
78
Vijay Khemkae7d23d02019-03-08 13:13:40 -080079install (TARGETS zfboemcmds DESTINATION lib/ipmid-providers)
Vijay Khemkacc0d6d92019-08-27 14:51:17 -070080install (FILES ${CONFIG_FILES} DESTINATION ${PACKAGE_DIR})