Fix cmake for non yocto
Clean up lots of target from CMakeLists.txt.in which are already
part of CI. Added new ipmid library link and make changes to build
it from CI.
Change-Id: I2114e5ec9f0a194214e53f8e7fda873be758da91
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4971b5..1711e6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,8 +17,13 @@
add_definitions (-DBOOST_ALL_NO_LIB)
add_definitions (-DBOOST_NO_RTTI)
add_definitions (-DBOOST_NO_TYPEID)
+add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
+add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
+add_definitions (-Wno-psabi)
if (NOT YOCTO)
+ include_directories (SYSTEM non-yocto)
+
configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt)
execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty)
@@ -27,13 +32,14 @@
set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH})
include_directories (${CMAKE_BINARY_DIR}/prefix/include)
-endif ()
+ link_directories (${CMAKE_BINARY_DIR}/prefix/lib)
-if (NOT YOCTO)
include_directories (${CMAKE_BINARY_DIR}/sdbusplus-src)
link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs)
include_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src)
link_directories (${CMAKE_BINARY_DIR}/phosphor-logging-src/.libs)
+ include_directories (SYSTEM ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include)
+ include_directories (SYSTEM ${CMAKE_BINARY_DIR}/ipmid/user_channel)
include_directories (${CMAKE_BINARY_DIR}) # link_directories
# (${CMAKE_BINARY_DIR}/sdbusplus-
@@ -46,22 +52,10 @@
include_directories (${LOGGING_INCLUDE_DIRS})
link_directories (${LOGGING_LIBRARY_DIRS})
-endif ()
+ pkg_check_modules (LIBIPMID libipmid REQUIRED)
+ include_directories (SYSTEM ${LIBIPMID_INCLUDE_DIRS})
+ link_directories (${LIBIPMID_LIBRARY_DIRS})
-include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-if (NOT YOCTO)
- set (SENSOR_TEST_SRC tests/test_sensorcommands.cpp)
-
- find_package (GTest REQUIRED)
-
- enable_testing ()
-
- add_executable (runSensorTests ${SENSOR_TEST_SRC})
- add_test (NAME test_sensorcommands COMMAND runSensorTests)
- target_link_libraries (runSensorTests ${GTEST_BOTH_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- phosphor_logging sdbusplus -lsystemd)
endif ()
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -69,10 +63,13 @@
add_library (zfboemcmds
SHARED src/oemcommands.cpp src/appcommands.cpp
src/storagecommands.cpp src/usb-dbg.cpp
- src/transportcommands.cpp)
+ src/transportcommands.cpp)
set_target_properties (zfboemcmds PROPERTIES VERSION "0.1.0")
set_target_properties (zfboemcmds PROPERTIES SOVERSION "0")
target_link_libraries (zfboemcmds sdbusplus)
+target_link_libraries (zfboemcmds ipmid)
+target_link_libraries (zfboemcmds -luserlayer)
+target_link_libraries (zfboemcmds -lchannellayer)
target_link_libraries (zfboemcmds ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (zfboemcmds phosphor_logging)
diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in
index 811ad43..f50f74d 100644
--- a/CMakeLists.txt.in
+++ b/CMakeLists.txt.in
@@ -6,107 +6,26 @@
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix/include)
# requires apt install autoconf-archive and autoconf
-externalproject_add (
- sdbusplus-project PREFIX ${CMAKE_BINARY_DIR}/sdbusplus-project
- GIT_REPOSITORY https://github.com/openbmc/sdbusplus.git GIT_TAG
- 6b4fb2969cd0c853ff6aa7f9bdd3ddaa0081c204 SOURCE_DIR
- ${CMAKE_BINARY_DIR}/sdbusplus-src BINARY_DIR
- ${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND "" BUILD_COMMAND cd
- ${CMAKE_BINARY_DIR}/sdbusplus-src && ./bootstrap.sh clean && ./bootstrap.sh
- && ./configure --prefix=${CMAKE_BINARY_DIR}/prefix
- CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ --enable-transaction && make
- && make install INSTALL_COMMAND "" LOG_DOWNLOAD ON
-)
externalproject_add (
- dbus-interfaces PREFIX ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces DEPENDS
- sdbusplus-project GIT_REPOSITORY
- https://github.com/openbmc/phosphor-dbus-interfaces GIT_TAG
- 4132f4b6b1de57a993af9bd2bcd039957786a227 SOURCE_DIR
- ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-src BINARY_DIR
- ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-build CONFIGURE_COMMAND ""
- BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-src && echo
- "#!/bin/bash" > build.sh && echo
- "export PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}"
- >> build.sh && echo "export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH}"
- >> build.sh && echo
- "export PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig" >>
- build.sh && echo "./bootstrap.sh " >> build.sh && echo
- "./configure --prefix=${CMAKE_BINARY_DIR}/prefix CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ "
- >> build.sh && echo "make verbose=1" >> build.sh && echo "make install " >>
- build.sh && chmod 777 build.sh && ./build.sh INSTALL_COMMAND "" LOG_DOWNLOAD
- ON
-)
-
-externalproject_add (
- cereal GIT_REPOSITORY https://github.com/USCiLab/cereal GIT_TAG
- 51cbda5f30e56c801c07fe3d3aba5d7fb9e6cca4 SOURCE_DIR
- "${CMAKE_BINARY_DIR}/cereal-src" BINARY_DIR
- "${CMAKE_BINARY_DIR}/cereal-build" CONFIGURE_COMMAND "" BUILD_COMMAND ""
- INSTALL_COMMAND mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/cereal" && cp
- -r "${CMAKE_BINARY_DIR}/cereal-src/include/cereal"
- "${CMAKE_BINARY_DIR}/prefix/include"
-)
-
-externalproject_add (
- phosphor-logging PREFIX ${CMAKE_BINARY_DIR}/phosphor-logging DEPENDS cereal
- sdbusplus-project dbus-interfaces GIT_REPOSITORY
- https://github.com/openbmc/phosphor-logging GIT_TAG
- 477b731ad0fd8c116ffcaa8265a508c9fb112479 SOURCE_DIR
- ${CMAKE_BINARY_DIR}/phosphor-logging-src BINARY_DIR
- ${CMAKE_BINARY_DIR}/phosphor-logging-build CONFIGURE_COMMAND ""
- BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-logging-src && echo
- "#!/bin/bash" > build.sh && echo
- "export PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}"
- >> build.sh && echo "export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH}"
- >> build.sh && echo
- "export PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
- >> build.sh && echo "./bootstrap.sh clean" >> build.sh && echo
- "./bootstrap.sh" >> build.sh && echo
- "./configure --prefix=${CMAKE_BINARY_DIR}/prefix CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ \
- YAML_DIR=${CMAKE_BINARY_DIR}/prefix/share/phosphor-dbus-yaml/yaml --enable-metadata-processing"
- >> build.sh && echo "make verbose=1" >> build.sh && echo "make install " >>
- build.sh && chmod 777 build.sh && ./build.sh INSTALL_COMMAND "" LOG_DOWNLOAD
- ON
-)
-
-externalproject_add (
- nlohmann-json GIT_REPOSITORY "https://github.com/nlohmann/json.git" GIT_TAG
- d2dd27dc3b8472dbaa7d66f83619b3ebcd9185fe SOURCE_DIR
- "${CMAKE_BINARY_DIR}/nlohmann-json-src" BINARY_DIR
- "${CMAKE_BINARY_DIR}/nlohmann-json-build" CONFIGURE_COMMAND "" BUILD_COMMAND
- "" INSTALL_COMMAND mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/nlohmann" &&
- cp -r "${CMAKE_BINARY_DIR}/nlohmann-json-src/include/nlohmann"
- "${CMAKE_BINARY_DIR}/prefix/include"
-)
-
-externalproject_add (
- host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid DEPENDS
- sdbusplus-project dbus-interfaces nlohmann-json GIT_REPOSITORY
+ host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid GIT_REPOSITORY
https://github.com/openbmc/phosphor-host-ipmid SOURCE_DIR
- ${CMAKE_BINARY_DIR}/phosphor-ipmi-host BINARY_DIR
- ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-build CONFIGURE_COMMAND ""
- BUILD_COMMAND "" INSTALL_COMMAND mkdir -p
- "${CMAKE_BINARY_DIR}/prefix/include/ipmid" && cp
- ${CMAKE_BINARY_DIR}/phosphor-ipmi-host/include/ipmid/api.h
- ${CMAKE_BINARY_DIR}/prefix/include/ipmid LOG_DOWNLOAD ON
+ ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src BINARY_DIR
+ ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-build CONFIGURE_COMMAND cd
+ ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export
+ PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}
+ && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export
+ PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && ./bootstrap.sh
+ && ./configure --prefix=${CMAKE_BINARY_DIR}/prefix
+ CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/
+ CXXFLAGS=-Wno-error=unused-result LDFLAGS=-L${CMAKE_BINARY_DIR}/prefix/lib/
+ BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export
+ PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}
+ && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export
+ PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && make -j
+ verbose=1 INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src &&
+ make install && mkdir -p
+ "${CMAKE_BINARY_DIR}/prefix/include/ipmid" && cp include/ipmid/api.h
+ "${CMAKE_BINARY_DIR}/prefix/include/ipmid/" LOG_DOWNLOAD ON
)
-externalproject_add (
- Boost URL
- https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
- URL_MD5 d275cd85b00022313c171f602db59fc5 SOURCE_DIR
- "${CMAKE_BINARY_DIR}/boost-src" BINARY_DIR "${CMAKE_BINARY_DIR}/boost-build"
- CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND mkdir -p
- "${CMAKE_BINARY_DIR}/prefix/include/" && cp -R
- ${CMAKE_BINARY_DIR}/boost-src/boost ${CMAKE_BINARY_DIR}/prefix/include
-)
-
-externalproject_add (
- gtest GIT_REPOSITORY "https://github.com/google/googletest.git" GIT_TAG
- dfa853b63d17c787914b663b50c2095a0c5b706e CMAKE_ARGS
- -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-build SOURCE_DIR
- "${CMAKE_BINARY_DIR}/googletest-src" BINARY_DIR
- "${CMAKE_BINARY_DIR}/googletest-build" CMAKE_ARGS
- -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/prefix
-)