Enable tracing by default if LTTng is available

Also removed the colcon.meta file that implicitly enabled tracing anyway
This commit is contained in:
Tobias Blass 2019-07-19 10:02:56 +02:00
parent 74a781a1b9
commit 1452787336
5 changed files with 49 additions and 60 deletions

View file

@ -12,21 +12,17 @@ endif()
find_package(ament_cmake_ros REQUIRED)
option(WITH_LTTNG "Include support for tracing with LTTng" OFF)
option(WITH_LTTNG "Enable support for tracing with LTTng" ON)
if(WITH_LTTNG)
# Try to find LTTng
find_package(PkgConfig REQUIRED)
pkg_check_modules(LTTNG REQUIRED lttng-ust)
endif()
if(LTTNG_FOUND)
set(LTTNG_TP_FILES
include/tracetools/tp_call.h
src/tp_call.c
)
set(TRACING_ENABLED TRUE)
message("LTTng found: tracing enabled")
elseif(WITH_LTTNG)
message("LTTng NOT found: tracing disabled")
# Set TRACING_ENABLED if we can find lttng-ust
# TODO: Should these be quiet?
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(LTTNG lttng-ust)
if(LTTNG_FOUND)
set(TRACING_ENABLED TRUE)
endif()
endif()
endif()
include_directories(include)
@ -54,7 +50,10 @@ set(SOURCES
src/utils.cpp
)
if(TRACING_ENABLED)
list(APPEND SOURCES ${LTTNG_TP_FILES})
list(APPEND SOURCES
include/tracetools/tp_call.h
src/tp_call.c)
endif()
add_library(${PROJECT_NAME} SHARED ${SOURCES})