From 6165e07cd0ef6da314ed1ef4f58fe47b7d8112db Mon Sep 17 00:00:00 2001 From: "Czarnowski, Przemyslaw" Date: Thu, 21 Oct 2021 14:15:59 +0200 Subject: virtual-media: CMake update - Fixed standalone builds: - added boost to standalone build, - sdbusplus version bumped up (for dbus signal support) - Fixed warnings when finding udev. Tested: Standalone compilation works in "clean" system, yocto compiles without regression. Change-Id: Iddaa980ec2d299ff836d2e06970ebc5a5b1cf3d9 Signed-off-by: Czarnowski, Przemyslaw --- CMakeLists.txt | 50 +++++++++++++++++++++++++++++++++----------------- cmake/Findudev.cmake | 2 +- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bc3452..e9eb2a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,11 +25,27 @@ option(LEGACY_MODE_ENABLED if(NOT ${YOCTO_DEPENDENCIES}) include(ExternalProject) + ExternalProject_Add( + Boost + URL "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" + URL_MD5 "33334dd7f862e8ac9fe1cc7c6584fb6d" + SOURCE_DIR ${CMAKE_BINARY_DIR}/src/boost + BINARY_DIR ${CMAKE_BINARY_DIR}/libs/boost + CONFIGURE_COMMAND cd && ./bootstrap.sh + BUILD_COMMAND cd && ./b2 --exec-prefix= + --prefix= --with-system --with-coroutine install + INSTALL_COMMAND "" + UPDATE_COMMAND "") + + set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/libs/boost/ ${CMAKE_PREFIX_PATH}) + include_directories(SYSTEM ${CMAKE_BINARY_DIR}/libs/boost/include) + link_directories(SYSTEM ${CMAKE_BINARY_DIR}/libs/boost/lib) + ExternalProject_Add( sdbusplus-project PREFIX ${CMAKE_BINARY_DIR}/sdbusplus-project GIT_REPOSITORY https://github.com/openbmc/sdbusplus.git - GIT_TAG c08cf5283b80a071d19506d9a462f6c69e1797f1 + GIT_TAG afe80cf2e5dc4aefe3b041adeb0230e61929bf12 SOURCE_DIR ${CMAKE_BINARY_DIR}/sdbusplus-src BINARY_DIR ${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND "" @@ -39,6 +55,9 @@ if(NOT ${YOCTO_DEPENDENCIES}) LOG_DOWNLOAD ON UPDATE_COMMAND "") + include_directories(${CMAKE_BINARY_DIR}/sdbusplus-src) + link_directories(${CMAKE_BINARY_DIR}/sdbusplus-src/.libs) + ExternalProject_Add( nlohmann-json GIT_REPOSITORY "https://github.com/nlohmann/json.git" @@ -54,10 +73,20 @@ if(NOT ${YOCTO_DEPENDENCIES}) UPDATE_COMMAND "") include_directories(${CMAKE_BINARY_DIR}/prefix/include) - include_directories(${CMAKE_BINARY_DIR}/sdbusplus-src) - - link_directories(${CMAKE_BINARY_DIR}/sdbusplus-src/.libs) +else() + # Include Boost library. This allows specify exact version of BOOST to be + # used, especially important while using valgrind, to point BOOST that is + # compiled with valgrind support + if(${BOOST_VERSION}) + find_package(Boost ${BOOST_VERSION} EXACT) + else() + find_package(Boost 1.69 REQUIRED COMPONENTS coroutine context) + endif() + message("++ Using Boost version: " ${Boost_VERSION}) + + include_directories(${Boost_INCLUDE_DIRS}) + link_directories(${Boost_LIBRARY_DIRS}) endif() # Include UDEV library @@ -65,19 +94,6 @@ find_package(udev REQUIRED) include_directories(${UDEV_INCLUDE_DIRS}) link_directories(${UDEV_LIBRARIES}) -# Include Boost library This allows specify exact version of BOOST to be used, -# especially important while using valgrind, to point BOOST that is compiled -# with valgrind support -if(${BOOST_VERSION}) - find_package(Boost ${BOOST_VERSION} EXACT) -else() - find_package(Boost 1.69 REQUIRED) -endif() -message("++ Using Boost version: " ${Boost_VERSION}) - -include_directories(${Boost_INCLUDE_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) - # Boost related definitions add_definitions(-DBOOST_COROUTINES_NO_DEPRECATION_WARNING) add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) diff --git a/cmake/Findudev.cmake b/cmake/Findudev.cmake index ce454d5..89d5312 100644 --- a/cmake/Findudev.cmake +++ b/cmake/Findudev.cmake @@ -60,7 +60,7 @@ find_path(UDEV_INCLUDE_DIR ) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(UDEV +find_package_handle_standard_args(udev DEFAULT_MSG UDEV_LIBRARY UDEV_INCLUDE_DIR -- cgit v1.2.3