]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build: Add WITH_BOOST_VALGRIND option 34043/head
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 18 Mar 2020 20:26:30 +0000 (16:26 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 20 Mar 2020 04:51:49 +0000 (00:51 -0400)
To build Boost.Context (and other libraries) with support to allow
them to be valground usefully, and to include the define to link
against them.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
CMakeLists.txt
cmake/modules/BuildBoost.cmake

index e0b0b5b710791a0cf4657eb60f39a10bac8327a6..d2eb97288871466d17d9af0ec70312bfde9349f2 100644 (file)
@@ -656,6 +656,9 @@ if(WITH_GRAFANA)
   add_subdirectory(monitoring/grafana/dashboards)
 endif()
 
+CMAKE_DEPENDENT_OPTION(WITH_BOOST_VALGRIND "Boost support for valgrind" OFF
+  "NOT WITH_SYSTEM_BOOST" OFF)
+
 include(CTags)
 option(CTAG_EXCLUDES "Exclude files/directories when running ctag.")
 add_tags(ctags
index 2e92132366c6c6987d2bc61af419dc9996bad6ef..900e0e539e53ecf255732bd94ad7c9e8c218037c 100644 (file)
@@ -131,6 +131,9 @@ function(do_build_boost version)
     list(APPEND b2 architecture=arm)
     list(APPEND b2 binary-format=elf)
   endif()
+  if(WITH_BOOST_VALGRIND)
+    list(APPEND b2 valgrind=on)
+  endif()
   set(build_command
     ${b2} headers stage
     #"--buildid=ceph" # changes lib names--can omit for static
@@ -224,6 +227,10 @@ macro(build_boost version)
       INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
       IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
       IMPORTED_LOCATION "${Boost_${upper_c}_LIBRARY}")
+    if(c MATCHES "coroutine|context")
+      set_target_properties(Boost::${c} PROPERTIES
+       INTERFACE_COMPILE_DEFINITIONS "BOOST_USE_VALGRIND")
+    endif()
     list(APPEND Boost_LIBRARIES ${Boost_${upper_c}_LIBRARY})
   endforeach()
   foreach(c ${Boost_BUILD_COMPONENTS})