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})
9 add_custom_target(tracepoint_libraries)
13 get_filename_component(name ${tp} NAME_WE)
14 set(header ${header_dir}/${name}.h)
17 COMMAND ${LTTNG_GEN_TP} ${tp} -o tracing/${name}.h
19 WORKING_DIRECTORY ${working_dir}
20 COMMENT "generating ${header}")
26 function(add_tracing_library name tracings version)
27 foreach(tp_file ${tracings})
28 get_filename_component(tp ${tp_file} NAME_WE)
30 ${header_dir}/${tp}.h)
31 list(APPEND tpfiles ${tp}.c)
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
39 SOVERSION ${soversion}
41 add_dependencies(tracepoint_libraries ${name})
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(rbd_tp librbd.tp 1.0.0)
48 add_tracing_library(os_tp objectstore.tp 1.0.0)
50 install(TARGETS rados_tp osd_tp rbd_tp os_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
51 if(WITH_OSD_INSTRUMENT_FUNCTIONS)
52 add_tracing_library(cyg_profile_tp cyg_profile.tp 1.0.0)
53 install(TARGETS cyg_profile_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})
55 if(WITH_LTTNG AND WITH_EVENTTRACE)
56 add_tracing_library(eventtrace_tp eventtrace.tp 1.0.0)
57 install(TARGETS eventtrace_tp DESTINATION ${CMAKE_INSTALL_LIBDIR})