Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tracing / CMakeLists.txt
1 # we are in "src/tracing", so create the output dir manually.
2 # the source files include the tracing headers like
3 # #include "tracing/oprequest.h". so better put them into
4 # ${PROJECT_BINARY_DIR}/include, where acconfig.h is also located
5 set(working_dir ${CMAKE_BINARY_DIR}/include)
6 set(header_dir ${working_dir}/tracing)
7 file(MAKE_DIRECTORY ${header_dir})
8
9 add_custom_target(tracepoint_libraries)
10
11 file(GLOB tps "*.tp")
12 foreach(tp ${tps})
13   get_filename_component(name ${tp} NAME_WE)
14   set(header ${header_dir}/${name}.h)
15   add_custom_command(
16     OUTPUT ${header}
17     COMMAND ${LTTNG_GEN_TP} ${tp} -o tracing/${name}.h
18     DEPENDS ${tp}
19     WORKING_DIRECTORY ${working_dir}
20     COMMENT "generating ${header}")
21   add_custom_target(
22     ${name}-tp
23     DEPENDS ${header})
24 endforeach()
25
26 function(add_tracing_library name tracings version)
27   foreach(tp_file ${tracings})
28     get_filename_component(tp ${tp_file} NAME_WE)
29     list(APPEND hdrs
30       ${header_dir}/${tp}.h)
31     list(APPEND tpfiles ${tp}.c)
32   endforeach()
33   add_library(${name} SHARED ${hdrs} ${tpfiles})
34   target_link_libraries(${name} ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
35   string(REGEX MATCH "^[0-9]+" soversion ${version})
36   set_target_properties(${name} PROPERTIES
37     OUTPUT_NAME ${name}
38     VERSION ${version}
39     SOVERSION ${soversion}
40     INSTALL_RPATH "")
41   add_dependencies(tracepoint_libraries ${name})
42 endfunction()
43
44 set(osd_traces oprequest.tp osd.tp pg.tp)
45 add_tracing_library(osd_tp "${osd_traces}" 1.0.0)
46 add_tracing_library(rados_tp librados.tp 2.0.0)
47 add_tracing_library(os_tp objectstore.tp 1.0.0)
48
49 install(TARGETS rados_tp osd_tp os_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
50 if(WITH_RBD)
51   add_tracing_library(rbd_tp librbd.tp 1.0.0)
52   install(TARGETS rbd_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
53 endif(WITH_RBD)
54 if(WITH_OSD_INSTRUMENT_FUNCTIONS)
55   add_tracing_library(cyg_profile_tp cyg_profile.tp 1.0.0)
56   install(TARGETS cyg_profile_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
57 endif()
58 if(WITH_LTTNG AND WITH_EVENTTRACE)
59   add_tracing_library(eventtrace_tp eventtrace.tp 1.0.0)
60   install(TARGETS eventtrace_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
61 endif()
62